bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH 12/13] trim: use xwalloc rather than xalloc


From: Paul Eggert
Subject: [PATCH 12/13] trim: use xwalloc rather than xalloc
Date: Sun, 4 Jun 2017 23:46:02 -0700

* lib/trim.c: Include xwalloc.h instead of xalloc.h.
(trim2): Use xwstrdup rather than strdup and xalloc_die.
* modules/trim (Depends-on): Remove xalloc, add xwalloc.
---
 ChangeLog    | 5 +++++
 lib/trim.c   | 9 ++-------
 modules/trim | 2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 460a383..4b34cb9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2017-06-04  Paul Eggert  <address@hidden>
 
+       trim: use xwalloc rather than xalloc
+       * lib/trim.c: Include xwalloc.h instead of xalloc.h.
+       (trim2): Use xwstrdup rather than strdup and xalloc_die.
+       * modules/trim (Depends-on): Remove xalloc, add xwalloc.
+
        quotearg: use xwalloc rather than xalloc
        * lib/quotearg.c: Include xwalloc.h instead of xalloc.h.
        (clone_quoting_options, quotearg_alloc_mem, nslots)
diff --git a/lib/trim.c b/lib/trim.c
index a4dca9f..e06cba8 100644
--- a/lib/trim.c
+++ b/lib/trim.c
@@ -28,7 +28,7 @@
 
 #include "mbchar.h"
 #include "mbiter.h"
-#include "xalloc.h"
+#include "xwalloc.h"
 
 /* Use this to suppress gcc's "...may be used before initialized" warnings. */
 #if defined GCC_LINT || defined lint
@@ -40,12 +40,7 @@
 char *
 trim2 (const char *s, int how)
 {
-  char *d;
-
-  d = strdup (s);
-
-  if (!d)
-    xalloc_die ();
+  char *d = xwstrdup (s);
 
   if (MB_CUR_MAX > 1)
     {
diff --git a/modules/trim b/modules/trim
index c954509..2822a92 100644
--- a/modules/trim
+++ b/modules/trim
@@ -6,7 +6,7 @@ lib/trim.h
 lib/trim.c
 
 Depends-on:
-xalloc
+xwalloc
 mbchar
 mbiter
 memmove
-- 
2.9.4




reply via email to

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