Increase `idx` in `gargoyle_find_brand` by the negate size

This commit is contained in:
Nick Chambers 2022-06-29 16:06:49 -05:00
parent 52577843c3
commit 224baa071b
1 changed files with 6 additions and 1 deletions

View File

@ -5,11 +5,16 @@
#include <stddef.h>
struct gargoyle_opt *gargoyle_find_brand(uint16_t optc, struct gargoyle_opt *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;
if(optv->type & GARGOYLE_TYPE_BOOL && gargoyle_cmp(idx, neg, neg_sz, flags)) {
idx += 3;
idx += neg_sz;
}
uint8_t end = !*(idx + optv->brand_sz);