]> mj.ucw.cz Git - libucw.git/commitdiff
libucw: Fixed infinite recursion in str_to_int().
authorPavel Charvat <pchar@ucw.cz>
Fri, 18 Jun 2010 06:17:10 +0000 (08:17 +0200)
committerPavel Charvat <pchar@ucw.cz>
Fri, 18 Jun 2010 06:17:10 +0000 (08:17 +0200)
ucw/strtonum.h

index 03ec68958536c046dc11fd04a0280a9c7b31e901..28580415f7b7f412ceec6e1c1b12c0658b036689 100644 (file)
@@ -34,16 +34,16 @@ enum str_to_num_flags {
 #define STN_DECLARE_CONVERTOR(type, suffix)                                                         \
 const char *str_to_##suffix(type *num, const char *str, const char **next, const uns flags)
 
-#define STN_SIGNED_CONVERTOR(utype, itype, suffix)                                                  \
-static inline const char *str_to_##suffix(itype *num, const char *str, const char **next, const uns flags) \
+#define STN_SIGNED_CONVERTOR(type, suffix, usuffix)                                                  \
+static inline const char *str_to_##suffix(type *num, const char *str, const char **next, const uns flags) \
 {                                                                                                   \
-  return str_to_##suffix((utype*) num, str, next, flags | STN_SIGNED);                               \
+  return str_to_##usuffix((void *) num, str, next, flags | STN_SIGNED);                               \
 }
 
 STN_DECLARE_CONVERTOR(uns, uns);
-STN_SIGNED_CONVERTOR(uns, int, int)
+STN_SIGNED_CONVERTOR(int, int, uns)
 
 STN_DECLARE_CONVERTOR(uintmax_t, uintmax);
-STN_SIGNED_CONVERTOR(uintmax_t, intmax_t, intmax)
+STN_SIGNED_CONVERTOR(intmax_t, intmax, uintmax)
 
 #endif