git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Make builtin-reset.c use parse_options.

From
CRCarlos Rica <jasampler@gmail.com>
Date
Mar 3, 2008, 14:39 UTC
Message-ID
<1b46aba20803030639i73557fb3v44de6387b8fd57a7@mail.gmail.com>
In-Reply-To
<20080302213843.GA13954@steel.home>
On Sun, Mar 2, 2008 at 10:38 PM, Alex Riesen <raa.lkml@gmail.com> wrote:
Show 18 quoted lines
> Carlos Rica, Sun, Mar 02, 2008 19:40:09 +0100:
>
> > On Sun, Mar 2, 2008 at 4:55 PM, Alex Riesen <raa.lkml@gmail.com> wrote:
>  > >
>  > >  "static const struct option options[] = {"
>  >
>  > The other files using parse_options have only "static", or nothing.
>
>  Well, they all miss something. Besides all nice things about static
>  syntax checking, the compiler (GCC) can optimize string constants to
>  use the same data (not that it is interesting in this particular
>  case).
>
>
>  > To make "options" static, then reset_type and quiet should be
>  > static too, otherwise it cannot compile (in my system).
>
>  Of course. Is it a problem for user-interface level code?

The only problem could come from reusing this code to calling many times to a cmd_reset function in the future. Then, I would prefer not to worry about previous values in the variables by using only automatic variables in the function.

Anyway, "const" is nice, since the options struct doesn't change.
Previous: Alex Riesen
Message 15 of 15 in “Make builtin-reset.c use parse_options.”
  1. Make builtin-reset.c use parse_options.Carlos Rica, Mar 1, 2008
  2. Junio C HamanoMar 2, 2008
  3. Carlos RicaMar 2, 2008
  4. Junio C HamanoMar 2, 2008
  5. Carlos RicaMar 3, 2008
  6. Pierre HabouzitMar 3, 2008
  7. Junio C HamanoMar 3, 2008
  8. Pierre HabouzitMar 4, 2008
  9. Johannes SchindelinMar 2, 2008
  10. Alex RiesenMar 2, 2008
  11. Carlos RicaMar 2, 2008
  12. Alex RiesenMar 2, 2008
  13. Carlos RicaMar 2, 2008
  14. Alex RiesenMar 2, 2008
  15. Carlos RicaMar 3, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.