[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] tests/test-strstr.c: Add another self-test.
From: |
Simon Josefsson |
Subject: |
Re: [PATCH] tests/test-strstr.c: Add another self-test. |
Date: |
Tue, 26 May 2009 15:32:36 +0200 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.94 (gnu/linux) |
Eric Blake <address@hidden> writes:
> According to Simon Josefsson on 5/26/2009 6:15 AM:
>> +2009-05-26 Simon Josefsson <address@hidden>
>> +
>> + * tests/test-strstr.c: Add another self-test.
>> {
>> + /* See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 */
>> + char *input = strdup ("aBaaaaaaaaaaax");
>
> Did you take the proper precautions to ensure strdup is available? I'd
> almost feel better if you rewrote this to use malloc/strcpy, rather than
> dragging in dependencies just for the test.
Good point. Pushed.
/Simon
>From 5b63b76064a130bdaadb1fda7ab50e82896446e1 Mon Sep 17 00:00:00 2001
From: Simon Josefsson <address@hidden>
Date: Tue, 26 May 2009 15:31:53 +0200
Subject: [PATCH] tests/test-strstr.c: Rewrite to use malloc/strcpy instead of
strdup.
Suggested by Eric Blake <address@hidden>.
---
ChangeLog | 2 ++
tests/test-strstr.c | 8 ++++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 96d5f10..5b5348c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
2009-05-26 Simon Josefsson <address@hidden>
* tests/test-strstr.c: Add another self-test.
+ * tests/test-strstr.c: Rewrite to use malloc/strcpy instead of
+ strdup. Suggested by Eric Blake <address@hidden>.
2009-05-23 Bruno Haible <address@hidden>
diff --git a/tests/test-strstr.c b/tests/test-strstr.c
index d8bec15..600f7c7 100644
--- a/tests/test-strstr.c
+++ b/tests/test-strstr.c
@@ -62,8 +62,12 @@ main (int argc, char *argv[])
{
/* 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);
}
--
1.6.2.4
- required memchr behavior (was: [PATCH] tests/test-strstr.c: Add another self-test.), (continued)
- required memchr behavior (was: [PATCH] tests/test-strstr.c: Add another self-test.), Eric Blake, 2009/05/29
- Re: required memchr behavior, Matthew Woehlke, 2009/05/29
- Re: required memchr behavior, Eric Blake, 2009/05/29
- Re: required memchr behavior, Matthew Woehlke, 2009/05/29
- Re: required memchr behavior, Eric Blake, 2009/05/29
- Re: required memchr behavior, Jim Meyering, 2009/05/30
- Re: required memchr behavior (was: [PATCH] tests/test-strstr.c: Add another self-test.), Bruno Haible, 2009/05/31
- Re: required memchr behavior, Jim Meyering, 2009/05/31
- Re: [PATCH] tests/test-strstr.c: Add another self-test., Simon Josefsson, 2009/05/26
Re: [PATCH] tests/test-strstr.c: Add another self-test., Eric Blake, 2009/05/26
- Re: [PATCH] tests/test-strstr.c: Add another self-test.,
Simon Josefsson <=