Module Name:    src
Committed By:   joerg
Date:           Mon Feb 15 15:55:51 UTC 2021

Modified Files:
        src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
Simplify to avoid copy based on the size of the source.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/tests/lib/libcurses/director/testlang_parse.y

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

Modified files:

Index: src/tests/lib/libcurses/director/testlang_parse.y
diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.48 src/tests/lib/libcurses/director/testlang_parse.y:1.49
--- src/tests/lib/libcurses/director/testlang_parse.y:1.48	Mon Feb 15 07:06:27 2021
+++ src/tests/lib/libcurses/director/testlang_parse.y	Mon Feb 15 15:55:50 2021
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_parse.y,v 1.48 2021/02/15 07:06:27 rillig Exp $	*/
+/*	$NetBSD: testlang_parse.y,v 1.49 2021/02/15 15:55:50 joerg Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn <bl...@netbsd.org>
@@ -1388,10 +1388,8 @@ do_input(const char *s)
 		free(input_str);
 	}
 
-	if ((input_str = malloc(strlen(s) + 1)) == NULL)
+	if ((input_str = strdup(s)) == NULL)
 		err(2, "Cannot allocate memory for input string");
-
-	strlcpy(input_str, s, strlen(s) + 1);
 }
 
 static void

Reply via email to