Re: [PATCH 3/13] FAT: IS_BADCHAR/IS_REPLACECHR/IS_SKIPCHAR cleanup

From: Al Viro
Date: Mon Jan 17 2005 - 13:45:22 EST


On Tue, Jan 18, 2005 at 02:41:05AM +0900, OGAWA Hirofumi wrote:
> +static inline wchar_t vfat_bad_char(wchar_t w)
> +{
> + return (w < 0x0020)
> + || (w == 0x002A) /* * */ || (w == 0x003F) /* ? */
> + || (w == 0x003C) /* < */ || (w == 0x003E) /* > */
> + || (w == 0x007C) /* | */ || (w == 0x0022) /* " */
> + || (w == 0x003A) /* : */ || (w == 0x002F) /* / */
> + || (w == 0x005C);/* \ */
> +}

Ugh... What's wrong with comparison to '*', '<', etc.? All values are
below 0x80, so signedness of char doesn't matter and when they get
promoted to int, they will give you the values you want...

> +static inline wchar_t vfat_replace_char(wchar_t w)
> +{
> + return (w == 0x005B) /* [ */ || (w == 0x005D) /* ] */
> + || (w == 0x003B) /* ; */ || (w == 0x002C) /* , */
> + || (w == 0x002B) /* + */ || (w == 0x003D);/* = */
> +}

Ditto.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/