Re: [PATCH] main: Use static global rather than 'General' string literal.
Denis Kenzior <[email protected]>
| Newsgroups | dev.linux.lists.connman |
|---|---|
| Message-ID | <[email protected]> |
Hi Grant, > > +/* > + * This is declared as 'const char *const' to effect an immutable > + * pointer to an immutable null-terminated character string such that > + * it ends up in .text, not .data (which would otherwise be the case > + * for a 'const char *' declaration), and with the 'static' > + * storage/scope qualifier, the compiler can optimize its use within > + * this file as it sees fit. > + */ I think you already had a similar comment in src/gateway.c. Since this is something that makes sense to make into the accepted (and encouraged) pattern, would it make sense to document this in doc/coding-style.txt and avoid replicating this verbiage across the project? > +static const char *const general_group_name = "General"; Given doc/coding-style.txt, item M3, should this be 'static const char * const'? Also, since you're using this somewhat like a #defined constant, should this be capitalized for clarity? Regards, -Denis