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

Re: [PATCH v4] install_branch_config: simplify verbose messages logic

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Mar 13, 2014, 22:45 UTC
Message-ID
<CAPig+cS9n64boSSgoK-z=V9QFkvr=1Z2Db5KRrsyZNDthDE27A@mail.gmail.com>
In-Reply-To
<CAPig+cQU5__EPA2C3QvCPAT4od3Ux8kCgq-2H8nCddGdNqaG0A@mail.gmail.com>
On Thu, Mar 13, 2014 at 4:35 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 14 quoted lines
> A more table-driven approach might look something
> like this:
>
>     struct M { const char *s; const char **a1; const char **a2; }
>     message[][2][2] = {{{
>         { "Branch %s set ... %s ... %s", &shortname, &origin },
>         ...
>     }},{{
>         { "Branch %s set ... %s", &remote, NULL },
>         ...
>     }}};
>
>     const struct M *m = message[!remote_is_branch][!origin][!rebasing];
>     printf_ln(m->s, local, *m->a1, *m->a2);

Of course, using NULL in the table like that would crash when dereferenced: *m->a2. It was just an quick example typed on-the-fly. Real code would want to be more careful.

Previous: Eric Sunshine
Message 7 of 7 in “install_branch_config: simplify verbose messages logic”
  1. install_branch_config: simplify verbose messages logicPaweł Wawruch, Mar 12, 2014
  2. Eric SunshineMar 12, 2014
  3. Junio C HamanoMar 12, 2014
  4. Eric SunshineMar 12, 2014
  5. Junio C HamanoMar 13, 2014
  6. Eric SunshineMar 13, 2014
  7. Eric SunshineMar 13, 2014

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.