coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] build: update gnulib submodule to latest


From: Paul Eggert
Subject: [PATCH] build: update gnulib submodule to latest
Date: Fri, 11 Jun 2021 18:07:22 -0700

Coreutils mistakenly did not list xstrndup as a module
that it depends on directly.  When the latest Gnulib removed
the dirname module's dependency on xstrndup, this mistake
caused coreutils to not build.  Since all of Coreutils's
uses of xstrndup know the string length, xmemdup0 is a better
match for what's needed.  Since the size args are typically
signed or derived from subtracting pointers, the new Gnulib
ximemdup0 function is a better match yet.
So, use ximemdup0 instead of xstrndup.
* src/cut.c, src/dircolors.c, src/expand-common.c, src/expand.c:
* src/numfmt.c, src/set-fields.c, src/unexpand.c:
Do not include xstrndup.h; no longer needed.
* src/dircolors.c (parse_line):
* src/expand-common.c (parse_tab_stops):
* src/numfmt.c (parse_format_string):
* src/set-fields.c (set_fields):
Use ximemdup0 instead of xstrndup.
---
 gnulib              | 2 +-
 src/cut.c           | 1 -
 src/dircolors.c     | 5 ++---
 src/expand-common.c | 3 +--
 src/expand.c        | 1 -
 src/numfmt.c        | 3 +--
 src/set-fields.c    | 3 +--
 src/unexpand.c      | 1 -
 8 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/gnulib b/gnulib
index 1a7295076..ff7c8b21e 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 1a72950760b1fce763ff834de0d545caab8a983c
+Subproject commit ff7c8b21e259fdc4bc721ed55519cfee06739efa
diff --git a/src/cut.c b/src/cut.c
index 4189dcfd0..78b82c80e 100644
--- a/src/cut.c
+++ b/src/cut.c
@@ -34,7 +34,6 @@
 #include "fadvise.h"
 #include "getndelim2.h"
 #include "hash.h"
-#include "xstrndup.h"
 
 #include "set-fields.h"
 
diff --git a/src/dircolors.c b/src/dircolors.c
index a1ab81bc8..fea0cdf01 100644
--- a/src/dircolors.c
+++ b/src/dircolors.c
@@ -29,7 +29,6 @@
 #include "obstack.h"
 #include "quote.h"
 #include "stdio--.h"
-#include "xstrndup.h"
 
 /* The official name of this program (e.g., no 'g' prefix).  */
 #define PROGRAM_NAME "dircolors"
@@ -163,7 +162,7 @@ parse_line (char const *line, char **keyword, char **arg)
       ++p;
     }
 
-  *keyword = xstrndup (keyword_start, p - keyword_start);
+  *keyword = ximemdup0 (keyword_start, p - keyword_start);
   if (*p  == '\0')
     return;
 
@@ -185,7 +184,7 @@ parse_line (char const *line, char **keyword, char **arg)
     continue;
   ++p;
 
-  *arg = xstrndup (arg_start, p - arg_start);
+  *arg = ximemdup0 (arg_start, p - arg_start);
 }
 
 /* FIXME: Write a string to standard out, while watching for "dangerous"
diff --git a/src/expand-common.c b/src/expand-common.c
index 82fce3b78..55df8dc0f 100644
--- a/src/expand-common.c
+++ b/src/expand-common.c
@@ -24,7 +24,6 @@
 #include "error.h"
 #include "fadvise.h"
 #include "quote.h"
-#include "xstrndup.h"
 
 #include "expand-common.h"
 
@@ -200,7 +199,7 @@ parse_tab_stops (char const *stops)
           if (!DECIMAL_DIGIT_ACCUMULATE (tabval, *stops - '0', uintmax_t))
             {
               size_t len = strspn (num_start, "0123456789");
-              char *bad_num = xstrndup (num_start, len);
+              char *bad_num = ximemdup0 (num_start, len);
               error (0, 0, _("tab stop is too large %s"), quote (bad_num));
               free (bad_num);
               ok = false;
diff --git a/src/expand.c b/src/expand.c
index 56fe27a53..dd9d2981a 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -39,7 +39,6 @@
 #include <sys/types.h>
 #include "system.h"
 #include "die.h"
-#include "xstrndup.h"
 
 #include "expand-common.h"
 
diff --git a/src/numfmt.c b/src/numfmt.c
index c54f96d27..fda03b4dd 100644
--- a/src/numfmt.c
+++ b/src/numfmt.c
@@ -29,7 +29,6 @@
 #include "quote.h"
 #include "system.h"
 #include "xstrtol.h"
-#include "xstrndup.h"
 
 #include "set-fields.h"
 
@@ -1141,7 +1140,7 @@ parse_format_string (char const *fmt)
            quote (fmt));
 
   if (prefix_len)
-    format_str_prefix = xstrndup (fmt, prefix_len);
+    format_str_prefix = ximemdup0 (fmt, prefix_len);
   if (fmt[suffix_pos] != '\0')
     format_str_suffix = xstrdup (fmt + suffix_pos);
 
diff --git a/src/set-fields.c b/src/set-fields.c
index 320a16ba8..42f6c2189 100644
--- a/src/set-fields.c
+++ b/src/set-fields.c
@@ -21,7 +21,6 @@
 #include "system.h"
 #include "error.h"
 #include "quote.h"
-#include "xstrndup.h"
 #include "set-fields.h"
 
 /* Array of `struct field_range_pair' holding all the finite ranges. */
@@ -254,7 +253,7 @@ set_fields (char const *fieldstr, unsigned int options)
                  complain only about the first number.  */
               /* Determine the length of the offending number.  */
               size_t len = strspn (num_start, "0123456789");
-              char *bad_num = xstrndup (num_start, len);
+              char *bad_num = ximemdup0 (num_start, len);
               error (0, 0, (options & SETFLD_ERRMSG_USE_POS)
                            ?_("byte/character offset %s is too large")
                            :_("field number %s is too large"),
diff --git a/src/unexpand.c b/src/unexpand.c
index 697623080..db0b74f24 100644
--- a/src/unexpand.c
+++ b/src/unexpand.c
@@ -40,7 +40,6 @@
 #include <sys/types.h>
 #include "system.h"
 #include "die.h"
-#include "xstrndup.h"
 
 #include "expand-common.h"
 
-- 
2.30.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]