From: Adam Dickmeiss Date: Tue, 2 Mar 2010 11:29:46 +0000 (+0100) Subject: Add odr_strtol (strtol for Odr_int). X-Git-Tag: v4.0.2~10 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=f2891d8771cb23cc70d973c6785bec20e31f511e;p=yaz-moved-to-github.git Add odr_strtol (strtol for Odr_int). --- diff --git a/include/yaz/odr.h b/include/yaz/odr.h index 8d8cc49..eb12dd4 100644 --- a/include/yaz/odr.h +++ b/include/yaz/odr.h @@ -342,6 +342,8 @@ YAZ_EXPORT const char **odr_get_element_path(ODR o); YAZ_EXPORT Odr_int odr_atoi(const char *s); +YAZ_EXPORT Odr_int odr_strtol(const char *nptr, char **endptr, int base); + YAZ_END_CDECL #include diff --git a/src/odr_mem.c b/src/odr_mem.c index 88f012c..9972c10 100644 --- a/src/odr_mem.c +++ b/src/odr_mem.c @@ -125,21 +125,26 @@ int odr_seek(ODR o, int whence, int offset) return 0; } -Odr_int odr_atoi(const char *s) +Odr_int odr_strtol(const char *nptr, char **endptr, int base) { #if NMEM_64 - char *endptr; #if WIN32 - return _strtoui64(s, &endptr, 10); + return _strtoui64(nptr, endptr, base); #else - return strtoll(s, &endptr, 10); + return strtoll(nptr, endptr, base); #endif #else - return atoi(s); + return strtol(nptr, endptr, base); #endif } +Odr_int odr_atoi(const char *s) +{ + char *endptr; + return odr_strtol(s, &endptr, 10); +} + /* * Local variables: * c-basic-offset: 4