Module Name:    src
Committed By:   maya
Date:           Fri Jan  4 19:13:58 UTC 2019

Modified Files:
        src/bin/ed: README ed.h glbl.c undo.c

Log Message:
Unifdef compatibility for broken realloc.

No binary change


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/bin/ed/README src/bin/ed/glbl.c
cvs rdiff -u -r1.37 -r1.38 src/bin/ed/ed.h
cvs rdiff -u -r1.6 -r1.7 src/bin/ed/undo.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ed/README
diff -u src/bin/ed/README:1.9 src/bin/ed/README:1.10
--- src/bin/ed/README:1.9	Tue Mar 21 09:04:33 1995
+++ src/bin/ed/README	Fri Jan  4 19:13:58 2019
@@ -1,4 +1,4 @@
-$NetBSD: README,v 1.9 1995/03/21 09:04:33 cgd Exp $
+$NetBSD: README,v 1.10 2019/01/04 19:13:58 maya Exp $
 
 ed is an 8-bit-clean, POSIX-compliant line editor.  It should work with
 any regular expression package that conforms to the POSIX interface
@@ -10,7 +10,6 @@ should be redefined to disable interrupt
 
 The following compiler directives are recognized:
 DES		- to add encryption support (requires crypt(3))
-NO_REALLOC_NULL	- if realloc(3) does not accept a NULL pointer
 BACKWARDS	- for backwards compatibility
 NEED_INSQUE	- if insque(3) is missing
 
Index: src/bin/ed/glbl.c
diff -u src/bin/ed/glbl.c:1.9 src/bin/ed/glbl.c:1.10
--- src/bin/ed/glbl.c:1.9	Fri Aug 28 11:29:48 2015
+++ src/bin/ed/glbl.c	Fri Jan  4 19:13:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: glbl.c,v 1.9 2015/08/28 11:29:48 joerg Exp $	*/
+/*	$NetBSD: glbl.c,v 1.10 2019/01/04 19:13:58 maya Exp $	*/
 
 /* glob.c: This file contains the global command routines for the ed line
    editor */
@@ -33,7 +33,7 @@
 #if 0
 static char *rcsid = "@(#)glob.c,v 1.1 1994/02/01 00:34:40 alm Exp";
 #else
-__RCSID("$NetBSD: glbl.c,v 1.9 2015/08/28 11:29:48 joerg Exp $");
+__RCSID("$NetBSD: glbl.c,v 1.10 2019/01/04 19:13:58 maya Exp $");
 #endif
 #endif /* not lint */
 
@@ -158,27 +158,13 @@ set_active_node(line_t *lp)
 		int ti = active_size;
 		line_t **ts;
 		SPL1();
-#if defined(sun) || defined(NO_REALLOC_NULL)
-		if (active_list != NULL) {
-#endif
-			if ((ts = (line_t **) realloc(active_list, 
-			    (ti += MINBUFSZ) * sizeof(line_t **))) == NULL) {
-				fprintf(stderr, "%s\n", strerror(errno));
-				seterrmsg("out of memory");
-				SPL0();
-				return ERR;
-			}
-#if defined(sun) || defined(NO_REALLOC_NULL)
-		} else {
-			if ((ts = (line_t **) malloc((ti += MINBUFSZ) * 
-			    sizeof(line_t **))) == NULL) {
-				fprintf(stderr, "%s\n", strerror(errno));
-				seterrmsg("out of memory");
-				SPL0();
-				return ERR;
-			}
+		if ((ts = (line_t **) realloc(active_list, 
+		    (ti += MINBUFSZ) * sizeof(line_t **))) == NULL) {
+			fprintf(stderr, "%s\n", strerror(errno));
+			seterrmsg("out of memory");
+			SPL0();
+			return ERR;
 		}
-#endif
 		active_size = ti;
 		active_list = ts;
 		SPL0();

Index: src/bin/ed/ed.h
diff -u src/bin/ed/ed.h:1.37 src/bin/ed/ed.h:1.38
--- src/bin/ed/ed.h:1.37	Tue Mar 25 17:23:37 2014
+++ src/bin/ed/ed.h	Fri Jan  4 19:13:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ed.h,v 1.37 2014/03/25 17:23:37 joerg Exp $	*/
+/*	$NetBSD: ed.h,v 1.38 2019/01/04 19:13:58 maya Exp $	*/
 
 /* ed.h: type and constant definitions for the ed editor. */
 /*
@@ -121,33 +121,6 @@ if (--mutex == 0) { \
 	} \
 }
 
-#if defined(sun) || defined(NO_REALLOC_NULL)
-/* REALLOC: assure at least a minimum size for buffer b */
-#define REALLOC(b,n,i,err) \
-if ((i) > (n)) { \
-	int ti = (n); \
-	char *ts; \
-	SPL1(); \
-	if ((b) != NULL) { \
-		if ((ts = (char *) realloc((b), ti += max((i), MINBUFSZ))) == NULL) { \
-			fprintf(stderr, "%s\n", strerror(errno)); \
-			seterrmsg("out of memory"); \
-			SPL0(); \
-			return err; \
-		} \
-	} else { \
-		if ((ts = (char *) malloc(ti += max((i), MINBUFSZ))) == NULL) { \
-			fprintf(stderr, "%s\n", strerror(errno)); \
-			seterrmsg("out of memory"); \
-			SPL0(); \
-			return err; \
-		} \
-	} \
-	(n) = ti; \
-	(b) = ts; \
-	SPL0(); \
-}
-#else /* NO_REALLOC_NULL */
 /* REALLOC: assure at least a minimum size for buffer b */
 #define REALLOC(b,n,i,err) \
 if ((i) > (n)) { \
@@ -164,7 +137,6 @@ if ((i) > (n)) { \
 	(b) = ts; \
 	SPL0(); \
 }
-#endif /* NO_REALLOC_NULL */
 
 /* REQUE: link pred before succ */
 #define REQUE(pred, succ) (pred)->q_forw = (succ), (succ)->q_back = (pred)

Index: src/bin/ed/undo.c
diff -u src/bin/ed/undo.c:1.6 src/bin/ed/undo.c:1.7
--- src/bin/ed/undo.c:1.6	Sun Mar 23 05:06:42 2014
+++ src/bin/ed/undo.c	Fri Jan  4 19:13:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: undo.c,v 1.6 2014/03/23 05:06:42 dholland Exp $	*/
+/*	$NetBSD: undo.c,v 1.7 2019/01/04 19:13:58 maya Exp $	*/
 
 /* undo.c: This file contains the undo routines for the ed line editor */
 /*-
@@ -32,7 +32,7 @@
 #if 0
 static char *rcsid = "@(#)undo.c,v 1.1 1994/02/01 00:34:44 alm Exp";
 #else
-__RCSID("$NetBSD: undo.c,v 1.6 2014/03/23 05:06:42 dholland Exp $");
+__RCSID("$NetBSD: undo.c,v 1.7 2019/01/04 19:13:58 maya Exp $");
 #endif
 #endif /* not lint */
 
@@ -50,14 +50,6 @@ push_undo_stack(int type, long from, lon
 {
 	undo_t *t;
 
-#if defined(sun) || defined(NO_REALLOC_NULL)
-	if (ustack == NULL &&
-	    (ustack = (undo_t *) malloc((usize = USIZE) * sizeof(undo_t))) == NULL) {
-		fprintf(stderr, "%s\n", strerror(errno));
-		seterrmsg("out of memory");
-		return NULL;
-	}
-#endif
 	t = ustack;
 	if (u_p < usize ||
 	    (t = (undo_t *) realloc(ustack, (usize += USIZE) * sizeof(undo_t))) != NULL) {

Reply via email to