[PATCH] ui-snapshot.c: Terminate cgit_snapshot_formats[] properly

Jason A. Donenfeld Jason at zx2c4.com
Mon Mar 4 00:59:07 CET 2013


John is right here -- { } isn't valid C -- GCC is fine with it though.

{ 0 } or { NULL } are both extremely widespread terminators, so I
could imagine gcc special casing it for Wmissing-field-initializers.
Furthermore, when you do neglect to set all the fields explicitly, the
unset ones are zeroed out. So, the zero in { 0 } doesn't ever really
apply to any particular field, since they're all set to that value.
It's basically a nice syntax for zeroing stack variables.




More information about the CGit mailing list