[flashrom] [PATCH] C99 cleanliness

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Mon Aug 27 00:09:40 CEST 2012

Am 26.08.2012 02:35 schrieb Stefan Tauner:
> i looked into this again (mainly from a linux perspective),

Thanks a lot, I had forgotten that the patch was acked.

> here is what i have found out:
> following functions are not in c99:
>  - strdup (posix, all over the place, easily replaceable)
>  - getpagesize (alternatives:
> http://en.wikipedia.org/wiki/Page_(computer_memory)#Determining_the_page_size_in_a_program
>  - strcasecmp, strncasecmp (posix)
>  - popen/pclose (posix, will be gone with internal dmi decoder)
>  - usleep (posix, and even there deprecated!)
>  - gethostbyname et al (posix, serprog only)
>    also, struct hostent->h_addr should be h_addr_list[0]
>  - fileno (posix, used in flashrom.c)
> the termios flag CRTSCTS is not specified in c or posix (bsd, used in
> serial.c's sp_openserport)
> and then there is the __asm__ __volatile__ thingy.
> not too bad imho.
> it gets worse with -pedantic of course...
>  - unnamed unions (which became part of c11)
>  - empty struct initializers ({}, mostly fixed by using {0} although
>    gcc and clang continue to warn if there are substructs. this would
>    lead to things like {{{{{0}}}}} in some cases and that's just not
>    worth it.)
>  - 0-sized arrays (coreboot_tables.h, wtf?)
>  - lots of: pointer of type ‘void *’ used in arithmetic (mmio
>    functions/macros)
> i have fixed the h_addr and __asm__ __volatile__ problem and also
> replaced all empty struct initializers with {0} as this is the standard
> 0/NULL initializer (as discussed in the -p internal:mainboard= thread
> IIRC) in my tested_stuff branch.

Excellent, thank you!
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>

Can you please commit that very soon?



More information about the flashrom mailing list