From: Jeff King Date: Fri, 31 May 2019 21:10:42 GMT Subject: Re: [PATCH v1 3/5] list-objects-filter: implement composite filters Message-ID: <20190531211041.GA19792@sigill.intra.peff.net> In-Reply-To: <20190531204821.GC4641@comcast.net> On Fri, May 31, 2019 at 01:48:21PM -0700, Matthew DeVore wrote: > > > +static int digit_value(int c, struct strbuf *errbuf) { > > > + if (c >= '0' && c <= '9') > > > + return c - '0'; > > > + if (c >= 'a' && c <= 'f') > > > + return c - 'a' + 10; > > > + if (c >= 'A' && c <= 'F') > > > + return c - 'A' + 10; > > > > I'm sure there's something I'm missing here. But why are you manually > > decoding hex instead of using strtol or sscanf or something? > > > > I'll have to give this a try. Thank you for the suggestion. Try our hex_to_bytes() helper (or if you really want to go low-level, your conditionals can be replaced by lookups in the hexval table). -Peff