Messages in this thread |  | | | Subject | Re: [PATCH 12/12] net: use the common ascii hex helpers | | From | Harvey Harrison <> | | Date | Fri, 02 May 2008 17:15:55 -0700 |
| |
On Fri, 2008-05-02 at 17:08 -0700, Andrew Morton wrote: > > > Yup. After a bit of testing and tyre-kicking I'll probably slip > > > lib-add-ascii-hex-helper-functions.patch into mainline so that we can > > > trickle all the *-use-the-common-ascii-hex-helpers.patch patches out to the > > > various maintainers. > > > > > > > I suppose the hex_asc array and hex_to_int could also use > > EXPORT_SYMBOL(). > > gack. How could you do all those patches without discovering this? Please > go give your QA staff a wedgie.
Sorry about the fat-fingered send, as before:
allyesconfig :(
> yes, hex_to_u8() is more specific and better defined than hex_to_int(). > > Although anally it should perhaps be two_digit_hex_to_ulong, > four_digit_hex_to_ulong, etc. > > ho hum, I'll drop them all.
int hex_char_to_int(char ch) { return -1 if not [a-fA-F0-9] } int hex_to_u8(const char *buf, u8 *val) int hex_to_u16(const char *buf, u16 *val) int hex_to_u32(const char *buf, u32 *val) int hex_to_u64(const char *buf, u64 *val)
Which return the number of chars read and reads up to a maximum of 2,4,8,16 chars respectively and returns early if a non-hex char is encountered.
Thoughts?
Harvey
|  |