Remove defaults from utility functions

This commit is contained in:
Nick Chambers 2022-07-10 17:19:44 -05:00
parent 9f4a7f2bd0
commit cb257baec0
3 changed files with 3 additions and 13 deletions

View File

@ -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);

View File

@ -4,11 +4,6 @@
#include <stdlib.h>
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);

View File

@ -5,11 +5,6 @@
#include <stddef.h>
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;