From af5a0989f2b168514e5ea152641684fc5e0a8f64 Mon Sep 17 00:00:00 2001 From: Peter Avalos Date: Fri, 17 Jun 2011 15:34:39 -1000 Subject: [PATCH] Patch the contrib sources for awk instead of having separate files. --- contrib/awk/run.c | 8 ++++---- contrib/awk/tran.c | 3 +-- usr.bin/awk/Makefile | 4 ---- usr.bin/awk/patches/run.c.patch | 22 ---------------------- usr.bin/awk/patches/tran.c.patch | 21 --------------------- 5 files changed, 5 insertions(+), 53 deletions(-) delete mode 100644 usr.bin/awk/patches/run.c.patch delete mode 100644 usr.bin/awk/patches/tran.c.patch diff --git a/contrib/awk/run.c b/contrib/awk/run.c index e96379bbd2..27bee9866f 100644 --- a/contrib/awk/run.c +++ b/contrib/awk/run.c @@ -1153,13 +1153,13 @@ Cell *cat(Node **a, int q) /* a[0] cat a[1] */ getsval(x); getsval(y); n1 = strlen(x->sval); - n2 = strlen(y->sval); - s = (char *) malloc(n1 + n2 + 1); + n2 = strlen(y->sval) + 1; + s = (char *) malloc(n1 + n2); if (s == NULL) FATAL("out of space concatenating %.15s... and %.15s...", x->sval, y->sval); - strcpy(s, x->sval); - strcpy(s+n1, y->sval); + memmove(s, x->sval, n1); + memmove(s+n1, y->sval, n2); tempfree(x); tempfree(y); z = gettemp(); diff --git a/contrib/awk/tran.c b/contrib/awk/tran.c index c19ce94302..134a2e5d0f 100644 --- a/contrib/awk/tran.c +++ b/contrib/awk/tran.c @@ -400,10 +400,9 @@ char *tostring(const char *s) /* make a copy of string s */ { char *p; - p = (char *) malloc(strlen(s)+1); + p = strdup(s); if (p == NULL) FATAL("out of space in tostring on %s", s); - strcpy(p, s); return(p); } diff --git a/usr.bin/awk/Makefile b/usr.bin/awk/Makefile index 777b4097d5..1dae848103 100644 --- a/usr.bin/awk/Makefile +++ b/usr.bin/awk/Makefile @@ -4,12 +4,8 @@ AWKSRC= ${.CURDIR}/../../contrib/awk .PATH: ${AWKSRC} -PATCHES!= echo ${.CURDIR}/patches/*.patch -CONTRIBDIR= ${AWKSRC} - PROG= awk SRCS= awkgram.y b.c lex.c lib.c main.c parse.c proctab.c run.c tran.c ytab.h -SRCS+= ${PATCHES} WARNS?= 2 CFLAGS+= -I. -I${AWKSRC} -DHAS_ISBLANK diff --git a/usr.bin/awk/patches/run.c.patch b/usr.bin/awk/patches/run.c.patch deleted file mode 100644 index 08d958fcf5..0000000000 --- a/usr.bin/awk/patches/run.c.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/contrib/awk20100523/run.c b/contrib/awk20100523/run.c -index 88e0f8f..8db0af3 100644 ---- a/contrib/awk20100523/run.c -+++ b/contrib/awk20100523/run.c -@@ -1152,13 +1152,13 @@ Cell *cat(Node **a, int q) /* a[0] cat a[1] */ - getsval(x); - getsval(y); - n1 = strlen(x->sval); -- n2 = strlen(y->sval); -- s = (char *) malloc(n1 + n2 + 1); -+ n2 = strlen(y->sval) + 1; -+ s = (char *) malloc(n1 + n2); - if (s == NULL) - FATAL("out of space concatenating %.15s... and %.15s...", - x->sval, y->sval); -- strcpy(s, x->sval); -- strcpy(s+n1, y->sval); -+ memmove(s, x->sval, n1); -+ memmove(s+n1, y->sval, n2); - tempfree(x); - tempfree(y); - z = gettemp(); diff --git a/usr.bin/awk/patches/tran.c.patch b/usr.bin/awk/patches/tran.c.patch deleted file mode 100644 index b969bf9875..0000000000 --- a/usr.bin/awk/patches/tran.c.patch +++ /dev/null @@ -1,21 +0,0 @@ -$DragonFly: src/usr.bin/awk/patches/tran.c.patch,v 1.1 2004/11/09 08:47:36 joerg Exp $ - -Index: /tran.c -=================================================================== -RCS file: /home/dcvs/src/contrib/awk20040207/tran.c,v -retrieving revision 1.1.1.1 -diff -u -p -r1.1.1.1 tran.c ---- tran.c 17 Apr 2004 19:41:31 -0000 1.1.1.1 -+++ tran.c 31 Oct 2004 03:18:48 -0000 -@@ -397,10 +397,9 @@ char *tostring(const char *s) /* make a - { - char *p; - -- p = (char *) malloc(strlen(s)+1); -+ p = strdup(s); - if (p == NULL) - FATAL("out of space in tostring on %s", s); -- strcpy(p, s); - return(p); - } - -- 2.41.0