]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
regex: simplify by using intprops.h
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 15 Oct 2018 03:20:08 +0000 (22:20 -0500)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 15 Oct 2018 04:36:55 +0000 (23:36 -0500)
[BZ#23744]
* posix/regex_internal.h [_LIBC]: Include intprops.h.
(TYPE_SIGNED, INT_ADD_WRAPV) [_LIBC]: Remove.
intprops.h defines them.

ChangeLog
posix/regex_internal.h

index 52299e6c56a821600222cc314c046f48375aec1b..26017655f9a46ec340d910203954a9564d7ff3d1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2018-10-14  Paul Eggert  <eggert@cs.ucla.edu>
 
+       regex: simplify by using intprops.h
+       [BZ#23744]
+       * posix/regex_internal.h [_LIBC]: Include intprops.h.
+       (TYPE_SIGNED, INT_ADD_WRAPV) [_LIBC]: Remove.
+       intprops.h defines them.
+
        regex: __builtin_expect → __glibc_unlikely
        [BZ#23744]
        This refactoring was prompted by a problem when the regex code is
index de4bcbdc2d5b91640c1673523cf163babbef6960..f4b27028689684684277b747377099278a2d4e2b 100644 (file)
 #include <stdbool.h>
 #include <stdint.h>
 
-/* Properties of integers.  Although Gnulib has intprops.h, glibc does
-   without for now.  */
-#ifndef _LIBC
-# include "intprops.h"
-#else
-/* True if the real type T is signed.  */
-# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
-
-/* True if adding the nonnegative Idx values A and B would overflow.
-   If false, set *R to A + B.  A, B, and R may be evaluated more than
-   once, or zero times.  Although this is not a full implementation of
-   Gnulib INT_ADD_WRAPV, it is good enough for glibc regex code.
-   FIXME: This implementation is a fragile stopgap, and this file would
-   be simpler and more robust if intprops.h were migrated into glibc.  */
-# define INT_ADD_WRAPV(a, b, r) \
-   (IDX_MAX - (a) < (b) ? true : (*(r) = (a) + (b), false))
-#endif
+#include <intprops.h>
 
 #ifdef _LIBC
 # include <libc-lock.h>