lkml.org 
[lkml]   [2010]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v1.3 1/4] lib: hex2bin converts ascii hexadecimal string to binary
From
Date
On Thu, 2010-11-11 at 19:48 +0000, David Howells wrote:
> Mimi Zohar <zohar@linux.vnet.ibm.com> wrote:
>
> > +void hex2bin(unsigned char *mem, char *buf, int count)
>
> I think this needs a little adjustment. I would recommend something like the
> following declaration:
>
> void hex2bin(u8 *buf, const char *data, size_t count)
>
> since the output data is binary (so use u8*), you're only reading the source
> data (so should use a const pointer) and you don't want to see a negative
> count (so use size_t).

right, thanks.

> Also, I'd suggest calling the source arg 'data' and the output arg 'buf' or
> maybe src/dst.
>
> David

Definitely better. (Remnant from kgdb_hex2mem() naming.)

thanks,

Mimi




\
 
 \ /
  Last update: 2010-11-11 23:25    [W:0.045 / U:0.392 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site