From: Felipe Contreras Date: Fri, 28 May 2021 16:38:59 GMT Subject: Re: [PATCH 1/2] [GSOC] ref-filter: add %(raw) atom Message-ID: <60b11ca3bfdb1_4b03220842@natae.notmuch> In-Reply-To: ZheNing Hu wrote: > Junio C Hamano 于2021年5月28日周五 上午11:04写道: > > "ZheNing Hu via GitGitGadget" writes: > > > +static int memcasecmp(const void *vs1, const void *vs2, size_t n) > > > +{ > > > + size_t i; > > > + const char *s1 = (const char *)vs1; > > > + const char *s2 = (const char *)vs2; > > > + > > > + for (i = 0; i < n; i++) { > > > + unsigned char u1 = s1[i]; > > > + unsigned char u2 = s2[i]; > > > + int U1 = toupper (u1); > > > + int U2 = toupper (u2); > > > > Does toupper('\0') even have a defined meaning? > Forget about this inelegant help function. As I said in my reply to Felipe, > this is copied from gunlib... Even if you use my modified version (which hopefully is not so inelegant), the comment about toupper('\0') still applies. My reading of `man toupper(3)` is that if c is neither lowercase or uppercase it is returned as-is. As long as it's unsigned char, which '\0' is. So I think the behavior is indeed defined. -- Felipe Contreras