Mercurial > hg > octave-nkf > gnulib-hg
changeset 11591:8864003db422
tests/test-strstr.c: Rewrite to use malloc/strcpy instead of strdup.
Suggested by Eric Blake <ebb9@byu.net>.
author | Simon Josefsson <simon@josefsson.org> |
---|---|
date | Tue, 26 May 2009 15:31:53 +0200 |
parents | 3a0825087a5c |
children | 345504ca672e |
files | ChangeLog tests/test-strstr.c |
diffstat | 2 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2009-05-26 Simon Josefsson <simon@josefsson.org> * tests/test-strstr.c: Add another self-test. + * tests/test-strstr.c: Rewrite to use malloc/strcpy instead of + strdup. Suggested by Eric Blake <ebb9@byu.net>. 2009-05-23 Bruno Haible <bruno@clisp.org>
--- a/tests/test-strstr.c +++ b/tests/test-strstr.c @@ -62,8 +62,12 @@ { /* See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 */ - char *input = strdup ("aBaaaaaaaaaaax"); - const char *result = strstr (input, "B1x"); + const char *fix = "aBaaaaaaaaaaax"; + char *input = malloc (strlen (fix) + 1); + const char *result; + + strcpy (input, fix); + result = strstr (input, "B1x"); ASSERT (result == NULL); free (input); }