On Thu, Mar 13, 2014 at 4:35 PM, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote: > 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. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html