Re: [PATCH v3 2/4] parse-options: extract lookup_long_opt() from parse_long_opt()

From
Christian Couder <hidden>
Date
2026-11-02 15:20:44
Reply to
Kaartic Sivaraam, 2026-10-30
On Fri, Oct 30, 2026 at 10:09 PM Kaartic Sivaraam
[off-list ref] wrote:
On 10/12/26 13:14, Christian Couder wrote:
quoted
+static enum parse_opt_result parse_long_opt(struct parse_opt_ctx_t *p,
+                                         const char *arg,
+                                         const struct option *options)
+{
+     struct parsed_option found;
+     struct parsed_option other;
+     const char *stuck;
+     enum long_opt_lookup result = lookup_long_opt(p, arg, options,
+                                                   &found, &other, &stuck);
+
Would it not be better to consume the `enum long_op_lookup` return value
via a switch rather than having a set of if statements to cover all the
cases?
Yeah, it might be a bit better with a switch, so the v4 I just sent
uses a switch.

Thanks.
Thread (41 messages) 41 messages, 4 authors, last reply 5d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help