[tyndur-devel] [PATCH] strto(u)l: 0x ist nur ein Praefix, wenn danach noch was kommt
Kevin Wolf ·
On Sun, Sep 20, 2009 at 06:35:44PM +0200, Antoine Kaufmann wrote: > On Tue, Sep 15 21:41, Kevin Wolf wrote: > > ! strtou(l): Wenn nach dem 0x keine gueltige Ziffer mehr kommt, ist es > > entweder keine Hexzahl (Basis 0) oder eine Null ohne 0x vorne dran > > (Basis 16). > > > > Signed-off-by: Kevin Wolf <kevin at tyndur.org> > > --- > > src/lib/stdlibc/strtol.c | 9 ++++++++- > > src/lib/string.c | 15 ++++++++++++--- > > 2 files changed, 20 insertions(+), 4 deletions(-) > > > > diff --git a/src/lib/stdlibc/strtol.c b/src/lib/stdlibc/strtol.c > > index d605144..2387e98 100644 > > --- a/src/lib/stdlibc/strtol.c > > +++ b/src/lib/stdlibc/strtol.c > > @@ -31,6 +31,13 @@ > > #include "limits.h" > > #include "types.h" > > > > +static int is_hexdigit(char x) > > +{ > > + return (x >= '0' && x <= '9') > > + || (x >= 'a' && x <= 'f') > > + || (x >= 'A' && x <= 'F'); > > +} > > Was hast du denn gegen unser isxdigit()? 1. Das wär ja viel zu einfach 2. Viel - siehe folgende Patches ;-) Ich änder's ab.