Skip to content

Commit

Permalink
trurl: use casecompare instead of a strncasecmp define
Browse files Browse the repository at this point in the history
Reported-by: Krishean Draconis
Bug: https://tech.lgbt/@krishean/112871913828723815
  • Loading branch information
bagder committed Jul 29, 2024
1 parent 83332d8 commit d5a28fd
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions trurl.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ static int casecompare(const char *first, const char *second, size_t max)

return raw_toupper(*first) - raw_toupper(*second);
}
#define strncasecmp(x,y,z) casecompare(x,y,z)

static void message_low(const char *prefix, const char *suffix,
const char *fmt, va_list ap)
Expand Down Expand Up @@ -1184,10 +1183,8 @@ static void trim(struct option *o)
else
qlen = strlen(q);

if((pattern && (inslen <= qlen) &&
!strncasecmp(q, ptr, inslen)) ||
(!pattern && (inslen == qlen) &&
!strncasecmp(q, ptr, inslen))) {
if((pattern && (inslen <= qlen) && !casecompare(q, ptr, inslen)) ||
(!pattern && (inslen == qlen) && !casecompare(q, ptr, inslen))) {
/* this qpair should be stripped out */
free(qpairs[i].str);
free(qpairsdec[i].str);
Expand Down

0 comments on commit d5a28fd

Please sign in to comment.