]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Make strtoimax, strtoumax, wcstoimax, wcstoumax into aliases
authorJoseph Myers <joseph@codesourcery.com>
Tue, 8 Dec 2020 18:15:27 +0000 (18:15 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Tue, 8 Dec 2020 18:15:27 +0000 (18:15 +0000)
The functions strtoimax, strtoumax, wcstoimax, wcstoumax currently
have three implementations each (wordsize-32, wordsize-64 and dummy
implementation in stdlib/ using #error), defining the functions as
thin wrappers round corresponding *_internal functions.  Simplify the
code by changing them into aliases of functions such as strtol and
wcstoull.  This is more consistent with how e.g. imaxdiv is handled.

Tested for x86_64 and x86.

22 files changed:
include/inttypes.h
stdlib/Makefile
stdlib/strtoimax.c [deleted file]
stdlib/strtoll.c
stdlib/strtoull.c
stdlib/strtoumax.c [deleted file]
stdlib/wcstoimax.c [deleted file]
stdlib/wcstoumax.c [deleted file]
sysdeps/wordsize-32/strtoimax.c [deleted file]
sysdeps/wordsize-32/strtoumax.c [deleted file]
sysdeps/wordsize-32/wcstoimax.c [deleted file]
sysdeps/wordsize-32/wcstoumax.c [deleted file]
sysdeps/wordsize-64/strtoimax.c [deleted file]
sysdeps/wordsize-64/strtol.c
sysdeps/wordsize-64/strtoul.c
sysdeps/wordsize-64/strtoumax.c [deleted file]
sysdeps/wordsize-64/wcstoimax.c [deleted file]
sysdeps/wordsize-64/wcstol.c
sysdeps/wordsize-64/wcstoul.c
sysdeps/wordsize-64/wcstoumax.c [deleted file]
wcsmbs/wcstoll.c
wcsmbs/wcstoull.c

index 3a583c6c074eea0360fb1d552b0bd49d3a77bbfc..9cb6636b1362a0317ee2679ad451d2ecd53b6467 100644 (file)
@@ -1,6 +1,3 @@
 #ifndef _INTTYPES_H
 #include <stdlib/inttypes.h>
-#ifndef _ISOMAC
-libc_hidden_proto (strtoumax)
-#endif
 #endif
index f8a1660186a6b51f55c115d3ec8098f87a869332..29b7cd7071d6a14fcdebfce0be348d8288bb7d1f 100644 (file)
@@ -56,7 +56,6 @@ routines      :=                                                            \
        system canonicalize                                                   \
        a64l l64a                                                             \
        rpmatch strfmon strfmon_l getsubopt xpg_basename fmtmsg               \
-       strtoimax strtoumax wcstoimax wcstoumax                               \
        getcontext setcontext makecontext swapcontext
 aux =  grouping groupingwc tens_in_limb
 
diff --git a/stdlib/strtoimax.c b/stdlib/strtoimax.c
deleted file mode 100644 (file)
index f1de70f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#error "The correct implementation must be chosen based on the `intmax_t' type"
index b156665fc7382fb3e11c0020839bba086a38d62c..a6b693a341996bfb9f19fc1038604466e4d5a0ce 100644 (file)
@@ -30,4 +30,5 @@ compat_symbol (libc, __strtoll_internal, __strtoq_internal, GLIBC_2_0);
 
 # endif
 weak_alias (strtoll, strtoq)
+weak_alias (strtoll, strtoimax)
 #endif
index b4bf9a97d9b480ad354f86bc9ef0fbe396b6e3f8..dd57aa550c3929230f59b7f846fb7e81674add4d 100644 (file)
@@ -30,4 +30,5 @@ compat_symbol (libc, __strtoull_internal, __strtouq_internal, GLIBC_2_0);
 
 # endif
 weak_alias (strtoull, strtouq)
+weak_alias (strtoull, strtoumax)
 #endif
diff --git a/stdlib/strtoumax.c b/stdlib/strtoumax.c
deleted file mode 100644 (file)
index 508cb19..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#error "The correct implementation must be chosen based on the `uintmax_t' type"
diff --git a/stdlib/wcstoimax.c b/stdlib/wcstoimax.c
deleted file mode 100644 (file)
index f1de70f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#error "The correct implementation must be chosen based on the `intmax_t' type"
diff --git a/stdlib/wcstoumax.c b/stdlib/wcstoumax.c
deleted file mode 100644 (file)
index 508cb19..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#error "The correct implementation must be chosen based on the `uintmax_t' type"
diff --git a/sysdeps/wordsize-32/strtoimax.c b/sysdeps/wordsize-32/strtoimax.c
deleted file mode 100644 (file)
index be1b71e..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Convert string to maximal integer.
-   Copyright (C) 1997-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <inttypes.h>
-#include <stdlib.h>
-
-intmax_t
-strtoimax (const char *__restrict nptr, char **__restrict endptr, int base)
-{
-  return __strtoll_internal (nptr, endptr, base, 0);
-}
diff --git a/sysdeps/wordsize-32/strtoumax.c b/sysdeps/wordsize-32/strtoumax.c
deleted file mode 100644 (file)
index c6f090c..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Convert string to maximal unsigned integer.
-   Copyright (C) 1997-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <inttypes.h>
-#include <stdlib.h>
-
-uintmax_t
-strtoumax (const char *__restrict nptr, char **__restrict endptr, int base)
-{
-  return __strtoull_internal (nptr, endptr, base, 0);
-}
-libc_hidden_def (strtoumax)
diff --git a/sysdeps/wordsize-32/wcstoimax.c b/sysdeps/wordsize-32/wcstoimax.c
deleted file mode 100644 (file)
index ce72558..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Convert wide-character string to maximal integer.
-   Copyright (C) 1997-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <inttypes.h>
-#include <wchar.h>
-
-intmax_t
-wcstoimax (const wchar_t *__restrict nptr, wchar_t **__restrict endptr,
-          int base)
-{
-  return __wcstoll_internal (nptr, endptr, base, 0);
-}
diff --git a/sysdeps/wordsize-32/wcstoumax.c b/sysdeps/wordsize-32/wcstoumax.c
deleted file mode 100644 (file)
index ee47b25..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Convert wide-character string to maximal unsigned integer.
-   Copyright (C) 1997-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <inttypes.h>
-#include <wchar.h>
-
-uintmax_t
-wcstoumax (const wchar_t *__restrict nptr, wchar_t **__restrict endptr,
-          int base)
-{
-  return __wcstoull_internal (nptr, endptr, base, 0);
-}
diff --git a/sysdeps/wordsize-64/strtoimax.c b/sysdeps/wordsize-64/strtoimax.c
deleted file mode 100644 (file)
index 9df5f2f..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Convert string to maximal integer.
-   Copyright (C) 1997-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <inttypes.h>
-#include <stdlib.h>
-
-intmax_t
-strtoimax (const char *__restrict nptr, char **__restrict endptr, int base)
-{
-  return __strtol_internal (nptr, endptr, base, 0);
-}
index ac17bbe4c81b4a21e48622728a5826222ee5cbed..a1b23741538b0a86a7626877fc6bc5f5d50f489d 100644 (file)
@@ -14,3 +14,4 @@ weak_alias (strtol, strtoll)
 libc_hidden_ver (strtol, strtoll)
 weak_alias (strtol, strtoq)
 libc_hidden_ver (strtol, strtoq)
+weak_alias (strtol, strtoimax)
index 401882ce0d1b47a49acd9d95ccc841f5cca3f519..856aa11dee71f3700b3db4fd61b6f2e4295b42d8 100644 (file)
@@ -12,3 +12,4 @@ strong_alias (__strtoul_internal, __strtoull_internal)
 libc_hidden_ver (__strtoul_internal, __strtoull_internal)
 weak_alias (strtoul, strtoull)
 weak_alias (strtoul, strtouq)
+weak_alias (strtoul, strtoumax)
diff --git a/sysdeps/wordsize-64/strtoumax.c b/sysdeps/wordsize-64/strtoumax.c
deleted file mode 100644 (file)
index aad697b..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Convert string to maximal unsigned integer.
-   Copyright (C) 1997-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <inttypes.h>
-#include <stdlib.h>
-
-uintmax_t
-strtoumax (const char *__restrict nptr, char **__restrict endptr, int base)
-{
-  return __strtoul_internal (nptr, endptr, base, 0);
-}
-libc_hidden_def (strtoumax)
diff --git a/sysdeps/wordsize-64/wcstoimax.c b/sysdeps/wordsize-64/wcstoimax.c
deleted file mode 100644 (file)
index 6a91737..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Convert wide-character string to maximal integer.
-   Copyright (C) 1997-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <inttypes.h>
-#include <wchar.h>
-
-intmax_t
-wcstoimax (const wchar_t *__restrict nptr, wchar_t **__restrict endptr,
-          int base)
-{
-  return __wcstol_internal (nptr, endptr, base, 0);
-}
index b10895a82ba6018fe1c2c27a17850c60d2bcd495..f99c273d954efb8cd7c506a21e971b89c5219664 100644 (file)
@@ -12,3 +12,4 @@ strong_alias (__wcstol_internal, __wcstoll_internal)
 libc_hidden_ver (__wcstol_internal, __wcstoll_internal)
 weak_alias (wcstol, wcstoll)
 weak_alias (wcstol, wcstoq)
+weak_alias (wcstol, wcstoimax)
index 2becb807449c5a116ef022c139031b225fe73cf4..e1458e17f3f9fb50a4584b6707b7e3f9f5a28c8f 100644 (file)
@@ -12,3 +12,4 @@ strong_alias (__wcstoul_internal, __wcstoull_internal)
 libc_hidden_ver (__wcstoul_internal, __wcstoull_internal)
 weak_alias (wcstoul, wcstoull)
 weak_alias (wcstoul, wcstouq)
+weak_alias (wcstoul, wcstoumax)
diff --git a/sysdeps/wordsize-64/wcstoumax.c b/sysdeps/wordsize-64/wcstoumax.c
deleted file mode 100644 (file)
index c11053c..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Convert wide-character string to maximal unsigned integer.
-   Copyright (C) 1997-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <inttypes.h>
-#include <wchar.h>
-
-uintmax_t
-wcstoumax (const wchar_t *__restrict nptr, wchar_t **__restrict endptr,
-          int base)
-{
-  return __wcstoul_internal (nptr, endptr, base, 0);
-}
index 9f5ea00ef6291100084806828460dcd061586d5b..2871db888432ef1c1acfd8ae16e7f1d8c56354ab 100644 (file)
@@ -22,3 +22,4 @@
 #include "wcstol.c"
 
 weak_alias (wcstoll, wcstoq)
+weak_alias (wcstoll, wcstoimax)
index 7ba8ebde83744b1d5eae7d7d08a8aed9c72565e6..b9080302f3253bd0ef5886e69635adaf90d0b4e0 100644 (file)
@@ -22,3 +22,4 @@
 #include "wcstoul.c"
 
 weak_alias (wcstoull, wcstouq)
+weak_alias (wcstoull, wcstoumax)