summaryrefslogtreecommitdiffstats
path: root/usr.bin/patch/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/patch/util.c')
-rw-r--r--usr.bin/patch/util.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/usr.bin/patch/util.c b/usr.bin/patch/util.c
index 6b9bef8..27ee1ae 100644
--- a/usr.bin/patch/util.c
+++ b/usr.bin/patch/util.c
@@ -202,6 +202,22 @@ savestr(const char *s)
}
/*
+ * Allocate a unique area for a string. Call fatal if out of memory.
+ */
+char *
+xstrdup(const char *s)
+{
+ char *rv;
+
+ if (!s)
+ s = "Oops";
+ rv = strdup(s);
+ if (rv == NULL)
+ fatal("out of memory\n");
+ return rv;
+}
+
+/*
* Vanilla terminal output (buffered).
*/
void
OpenPOWER on IntegriCloud