On Fri, May 31, 2019 at 05:10:42PM -0400, Jeff King wrote: > 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 Using hex_to_bytes worked out quite nicely, thanks!