You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
1.7 KiB

Index: Makefile.in
--- Makefile.in.orig 2009-11-02 20:09:57 +0100
+++ Makefile.in 2009-12-03 08:44:32 +0100
@@ -45,9 +45,7 @@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
STDBOOL_H = @STDBOOL_H@
-ifneq (@GETOPT_H@,)
GETOPT_H = gl/lib/@GETOPT_H@
-endif
HAVE__BOOL = @HAVE__BOOL@
ENABLE_MERGE = @ENABLE_MERGE@
@@ -107,9 +105,7 @@
src/util.c \
src/version.c
-ifeq ($(ENABLE_MERGE),1)
MERGEOBJ = src/merge.$(OBJEXT)
-endif
OBJS = $(LIBOBJS) $(MERGEOBJ) \
src/inp.$(OBJEXT) \
@@ -222,9 +218,7 @@
@echo "[$@]"
@srcdir=$(srcdir)/tests $(TEST_SHELL) $@
-ifeq ($(ENABLE_MERGE),1)
DEFINE_ENABLE_MERGE = -DENABLE_MERGE
-endif
COMPILE = $(CC) -c $(CPPFLAGS) $(DEFS) -Ded_PROGRAM=\"$(ed_PROGRAM)\" \
$(DEFINE_ENABLE_MERGE) -I. -I$(srcdir)/src -I$(srcdir)/gl/lib $(CFLAGS)
Index: gl/lib/xstrndup.c
--- gl/lib/xstrndup.c.orig 2009-11-02 20:09:57 +0100
+++ gl/lib/xstrndup.c 2009-12-03 08:42:53 +0100
@@ -23,13 +23,37 @@
#include <string.h>
#include "xalloc.h"
+static size_t
+my_strnlen(const char *s, size_t maxlen)
+{
+ size_t len;
+ for (len = 0; len < maxlen; len++, s++) {
+ if (!*s)
+ break;
+ }
+ return (len);
+}
+
+static char *
+my_strndup (char const *s, size_t n)
+{
+ size_t len = my_strnlen (s, n);
+ char *new = malloc (len + 1);
+
+ if (new == NULL)
+ return NULL;
+
+ new[len] = '\0';
+ return memcpy (new, s, len);
+}
+
/* Return a newly allocated copy of at most N bytes of STRING.
In other words, return a copy of the initial segment of length N of
STRING. */
char *
xstrndup (const char *string, size_t n)
{
- char *s = strndup (string, n);
+ char *s = my_strndup (string, n);
if (! s)
xalloc_die ();
return s;