Re: [PATCH v1 3/5] list-objects-filter: implement composite filters
- From
Jeff King <peff@peff.net>
- Date
- May 31, 2019, 21:10 UTC
- 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:
Show 13 quoted lines
> > > +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