From cb257baec0667bfe19e66863ae79a51c3806eecd Mon Sep 17 00:00:00 2001 From: Nick Chambers Date: Sun, 10 Jul 2022 17:19:44 -0500 Subject: [PATCH] Remove defaults from utility functions --- src/gargoyle.c | 6 +++--- src/scribe.c | 5 ----- src/sleuth.c | 5 ----- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/gargoyle.c b/src/gargoyle.c index ec2b5a3..3fc7d50 100644 --- a/src/gargoyle.c +++ b/src/gargoyle.c @@ -32,7 +32,7 @@ uint8_t gargoyle_digest_argv(uint16_t optc, struct gargoyle_optn *optv, int *arg if(*(arg + 1) == '-') { const char *brand = arg + 2; - optn = gargoyle_find_brand(optc, optv, brand, NULL, 0, flags); + optn = gargoyle_find_brand(optc, optv, brand, "no-", 3, flags); if(!optn) { if(flags & GARGOYLE_FLG_STRCT) { @@ -50,7 +50,7 @@ uint8_t gargoyle_digest_argv(uint16_t optc, struct gargoyle_optn *optv, int *arg const char *val = NULL; if(optn->type & GARGOYLE_TYPE_BOOL) { - res = gargoyle_from_bool(optn, brand, NULL, 0, flags); + res = gargoyle_from_bool(optn, brand, "no-", 3, flags); } else if(*(brand + optn->brand_sz) == '=') { val = brand + optn->brand_sz + 1; res = gargoyle_from_rope(optn, val, flags); @@ -95,7 +95,7 @@ uint8_t gargoyle_digest_argv(uint16_t optc, struct gargoyle_optn *optv, int *arg const char *val = NULL; if(optn->type & GARGOYLE_TYPE_BOOL) { - res = gargoyle_from_bool(optn, "", NULL, 0, flags); + res = gargoyle_from_bool(optn, "", "*", 1, flags); } else if(*(idx + 1)) { val = idx + 1; res = gargoyle_from_rope(optn, val, flags); diff --git a/src/scribe.c b/src/scribe.c index a0b3d1a..abf8ece 100644 --- a/src/scribe.c +++ b/src/scribe.c @@ -4,11 +4,6 @@ #include uint8_t gargoyle_from_bool(struct gargoyle_optn *opt, const char *brand, const char *neg, uint16_t neg_sz, gargoyle_flag_type flags) { - if(!neg) { - neg = "no-"; - neg_sz = 3; - } - if(opt->val) { uint8_t *val = opt->val; *val = !gargoyle_cmp(brand, neg, neg_sz, flags); diff --git a/src/sleuth.c b/src/sleuth.c index 6dbf9c2..82b0b17 100644 --- a/src/sleuth.c +++ b/src/sleuth.c @@ -5,11 +5,6 @@ #include struct gargoyle_optn *gargoyle_find_brand(uint16_t optc, struct gargoyle_optn *optv, const char *brand, const char *neg, uint16_t neg_sz, gargoyle_flag_type flags) { - if(!neg) { - neg = "no-"; - neg_sz = 3; - } - for(; optc; optc -= 1, optv += 1) { const char *idx = brand;