pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/lang/nawk Properly implement the equivalent of strdup ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/b5a853cfc0a2
branches:  trunk
changeset: 546852:b5a853cfc0a2
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Mon Sep 08 13:47:55 2008 +0000

description:
Properly implement the equivalent of strdup again as the portable
version and the src version of nawk differ in that. Complained about by
Joachim Koenig, blame on me. Bump revision.

diffstat:

 lang/nawk/Makefile     |  4 ++--
 lang/nawk/files/tran.c |  7 +++++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r 8109378967c3 -r b5a853cfc0a2 lang/nawk/Makefile
--- a/lang/nawk/Makefile        Mon Sep 08 13:37:33 2008 +0000
+++ b/lang/nawk/Makefile        Mon Sep 08 13:47:55 2008 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.34 2008/08/26 20:26:25 joerg Exp $
+# $NetBSD: Makefile,v 1.35 2008/09/08 13:47:55 joerg Exp $
 
 DISTNAME=      nawk-20050424
-PKGREVISION=   2
+PKGREVISION=   3
 CATEGORIES=    lang
 MASTER_SITES=  # empty
 DISTFILES=     # empty
diff -r 8109378967c3 -r b5a853cfc0a2 lang/nawk/files/tran.c
--- a/lang/nawk/files/tran.c    Mon Sep 08 13:37:33 2008 +0000
+++ b/lang/nawk/files/tran.c    Mon Sep 08 13:47:55 2008 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tran.c,v 1.2 2008/08/26 14:46:21 joerg Exp $ */
+/* $NetBSD: tran.c,v 1.3 2008/09/08 13:47:55 joerg Exp $ */
 
 /****************************************************************
 Copyright (C) Lucent Technologies 1997
@@ -400,11 +400,14 @@
 
 char *tostring(const char *s)  /* make a copy of string s */
 {
+       size_t len;
        char *p;
 
-       p = (char *) malloc(strlen(s)+1);
+       len = strlen(s) + 1;
+       p = (char *) malloc(len);
        if (p == NULL)
                FATAL("out of space in tostring on %s", s);
+       memcpy(p, s, len); 
        return(p);
 }
 



Home | Main Index | Thread Index | Old Index