Explorar el Código

- Add strtouq alias (to strtoul) for 64bit

The strtouq alias was only available on 32bit, breaking compilation of stuff
using strtouq on 64bit machines. At the same time use the correct return
type (u_quad_t).

Signed-of-by: Peter Korsgaard <jacmet@sunsite.dk>
Bernhard Reutner-Fischer hace 15 años
padre
commit
6886887bc8
Se han modificado 2 ficheros con 6 adiciones y 1 borrados
  1. 3 1
      include/stdlib.h
  2. 3 0
      libc/stdlib/stdlib.c

+ 3 - 1
include/stdlib.h

@@ -209,6 +209,8 @@ libc_hidden_proto(strtoul)
 __END_NAMESPACE_STD
 
 #ifdef __USE_BSD
+#include <sys/types.h> /* for u_quad_t */
+
 /* Convert a string to a quadword integer.  */
 __extension__
 extern long long int strtoq (__const char *__restrict __nptr,
@@ -216,7 +218,7 @@ extern long long int strtoq (__const char *__restrict __nptr,
      __THROW __nonnull ((1)) __wur;
 /* Convert a string to an unsigned quadword integer.  */
 __extension__
-extern unsigned long long int strtouq (__const char *__restrict __nptr,
+extern u_quad_t strtouq (__const char *__restrict __nptr,
 				       char **__restrict __endptr, int __base)
      __THROW __nonnull ((1)) __wur;
 #endif /* GCC and use BSD.  */

+ 3 - 0
libc/stdlib/stdlib.c

@@ -401,6 +401,9 @@ extern __typeof(__XL_NPP(strtoul)) __XL_NPP(strtoull);
 libc_hidden_proto(__XL_NPP(strtoull))
 strong_alias(__XL_NPP(strtoul),__XL_NPP(strtoull))
 libc_hidden_def(__XL_NPP(strtoull))
+#if !defined(L_strtoul_l)
+strong_alias(strtoul,strtouq)
+#endif
 #endif