[PATCH] libc: fix strtoq

Natanael Copa natanael.copa at gmail.com
Fri Nov 26 14:49:56 UTC 2010


strtoq should always return a quad_t and be an alias of strtol on
64 bit and strtoll on 32 bit.

Signed-off-by: Natanael Copa <natanael.copa at gmail.com>
---
 include/stdlib.h     |    2 +-
 libc/stdlib/stdlib.c |    3 +++
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/include/stdlib.h b/include/stdlib.h
index ce92ccd..300edf0 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -214,7 +214,7 @@ __END_NAMESPACE_STD
 
 /* Convert a string to a quadword integer.  */
 __extension__
-extern long long int strtoq (__const char *__restrict __nptr,
+extern quad_t strtoq (__const char *__restrict __nptr,
 			     char **__restrict __endptr, int __base)
      __THROW __nonnull ((1)) __wur;
 /* Convert a string to an unsigned quadword integer.  */
diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c
index ad0c4aa..4d608ee 100644
--- a/libc/stdlib/stdlib.c
+++ b/libc/stdlib/stdlib.c
@@ -342,6 +342,9 @@ extern __typeof(__XL_NPP(strtol)) __XL_NPP(strtoll);
 libc_hidden_proto(__XL_NPP(strtoll))
 strong_alias(__XL_NPP(strtol),__XL_NPP(strtoll))
 libc_hidden_def(__XL_NPP(strtoll))
+#if !defined(L_strtol_l)
+strong_alias(strtol,strtoq)
+#endif
 #endif
 
 #endif
-- 
1.7.3.2



More information about the uClibc mailing list