Eric Wong <normalperson@yhbt.net> writes:Sorry, there is no elegance to it as far as I can see. A macro invocation that creates a private function while it does not look like a function definition is already bad, you cannot have a comma in the stmt part, and the bare semicolons in the parenthesised text look insane. If your patch were like this, it would have been a bit easier for me to understand what was going on during my first pass: static struct exec_args *ui_optparse (struct opt_spec *s, int ac, char **av, int *ac_p, int what) { struct exec_args *ea = one_arg(s, ac, av, ac_p); if (!ea) return NULL; switch (what) { case IGNORE_MISSING: not_new = 1; break; case VERBOSE: verbose = 1; break; case HELP: usage(update_index_usage); break; } return nil_exec_args(ea); } instead of gitopt_eat(opt_ignore_missing, not_new = 1;) gitopt_eat(opt_verbose, verbose = 1;) gitopt_eat(opt_h, usage(update_index_usage);) Then, you would give an extra element in the table, and your argument parsing/splitting routine passes that one to the handler function: static const struct opt_spec update_index_ost[] = { ... { "ignore-missing", 0, 0, 0, ui_optparse, IGNORE_MISSING }, { "verbose", 0, 0, 0, ui_optparse, VERBOSE }, { "help", 'h', 0, 0, ui_optparse, HELP }, { 0, 0 } Another thing is I do not think we would want to make the argument parsing into callback style interface like you did. It actively encourages the option variables to be global (you could make it file scoped static but they are global nevertheless). If you can make it an iterator style, it would be a lot easier to see what is going on, I suspect. Then you would not even need the callback function pointers and small functions created by magic eat() macros. - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
| monstr | [PATCH 27/56] microblaze_v2: support for a.out |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Rafael J. Wysocki | [Bug #10493] mips BCM47XX compile error |
git: | |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| David Miller | [GIT]: Networking |
| Frans Pop | svc: failed to register lockdv1 RPC service (errno 97). |
