]> Savannah Git Hosting - gnulib.git/commitdiff
canonicalize: remove NARROW_ADDRESSES optimization
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 1 Jan 2021 23:54:43 +0000 (15:54 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 1 Jan 2021 23:55:17 +0000 (15:55 -0800)
* lib/canonicalize-lgpl.c, lib/canonicalize.c (NARROW_ADDRESSES):
Remove, and remove all uses, as the optimization is arguably not
worth the extra complexity.  Suggested by Adhemerval Zanella in:
https://sourceware.org/pipermail/libc-alpha/2020-December/121203.html

ChangeLog
lib/canonicalize-lgpl.c
lib/canonicalize.c

index 2d498a5e96610016c65b949ca806a98bfc6e79e7..fc45e11767ca60792f194b8fa54213e5ecd67053 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2021-01-01  Paul Eggert  <eggert@cs.ucla.edu>
+
+       canonicalize: remove NARROW_ADDRESSES optimization
+       * lib/canonicalize-lgpl.c, lib/canonicalize.c (NARROW_ADDRESSES):
+       Remove, and remove all uses, as the optimization is arguably not
+       worth the extra complexity.  Suggested by Adhemerval Zanella in:
+       https://sourceware.org/pipermail/libc-alpha/2020-December/121203.html
+
 2021-01-01  Bruno Haible  <bruno@clisp.org>
 
        stddef: Try harder to get max_align_t defined on OpenBSD.
index 560e24288f18eb5cc685a584e6b4ae237496a7dd..698f9ede25570ef2775d3c772ff510336425b796 100644 (file)
 # define IF_LINT(Code) /* empty */
 #endif
 
-/* True if adding two valid object sizes might overflow idx_t.
-   As a practical matter, this cannot happen on 64-bit machines.  */
-enum { NARROW_ADDRESSES = IDX_MAX >> 31 >> 31 == 0 };
-
 #ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT
 # define DOUBLE_SLASH_IS_DISTINCT_ROOT false
 #endif
@@ -343,7 +339,7 @@ realpath_stk (const char *name, char *resolved,
               if (end_in_extra_buffer)
                 end_idx = end - extra_buf;
               size_t len = strlen (end);
-              if (NARROW_ADDRESSES && INT_ADD_OVERFLOW (len, n))
+              if (INT_ADD_OVERFLOW (len, n))
                 {
                   __set_errno (ENOMEM);
                   goto error_nomem;
index cc32260a895811ea18fc396992ae2e1e0582d56e..3a1c8098baab488b349b8f4728df3f13cd4d40b8 100644 (file)
 # define IF_LINT(Code) /* empty */
 #endif
 
-/* True if adding two valid object sizes might overflow idx_t.
-   As a practical matter, this cannot happen on 64-bit machines.  */
-enum { NARROW_ADDRESSES = IDX_MAX >> 31 >> 31 == 0 };
-
 #ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT
 # define DOUBLE_SLASH_IS_DISTINCT_ROOT false
 #endif
@@ -393,7 +389,7 @@ canonicalize_filename_mode_stk (const char *name, canonicalize_mode_t can_mode,
               if (end_in_extra_buffer)
                 end_idx = end - extra_buf;
               size_t len = strlen (end);
-              if (NARROW_ADDRESSES && INT_ADD_OVERFLOW (len, n))
+              if (INT_ADD_OVERFLOW (len, n))
                 xalloc_die ();
               while (extra_buffer.length <= len + n)
                 {