Hi Simon,

> How about adding inetutils u_* syntax-checks to gnulib's maint.mk?
> 
> sc_unsigned_char:
>         @prohibit=u''_char \
>         halt='don'\''t use u''_char; instead use unsigned char' \
>           $(_sc_search_regexp)
> 
> sc_unsigned_long:
>         @prohibit=u''_long \
>         halt='don'\''t use u''_long; instead use unsigned long' \
>           $(_sc_search_regexp)
> 
> sc_unsigned_short:
>         @prohibit=u''_short \
>         halt='don'\''t use u''_short; instead use unsigned short' \
>           $(_sc_search_regexp)
> 
> sc_unsigned_int:
>         @prohibit=u''_int \
>         halt='don'\''t use u''_int; instead use unsigned int' \
>           $(_sc_search_regexp)

Sounds good to me. My only suggestion is to move the sc_unsigned_long
rule after the sc_unsigned_int rule.

> The u_char/u_long/u_short/u_int idiom used to be common but today I
> don't think any reasonable code should use it.

I agree. For some time, Linux kernel headers used these types heavily,
IIRC. But nowadays, they are nearly gone there as well.

> The only usage in gnulib is lib/inet_ntop.c and lib/inet_pton.c.  It
> seems u_char was removed in most places of the code except a few
> remaining type casts/comments:
> 
> lib/inet_ntop.c: *      (2) takes a u_char* not an in_addr as input
> lib/inet_pton.c:          *tp++ = (u_char) (val >> 8) & 0xff;
> lib/inet_pton.c:          *tp++ = (u_char) val & 0xff;
> lib/inet_pton.c:      *tp++ = (u_char) (val >> 8) & 0xff;
> lib/inet_pton.c:      *tp++ = (u_char) val & 0xff;

Feel free to modernize.

Bruno




Reply via email to