projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cleanup after gl_FUNC_READLINK, for gl_FUNC_SYMLINK test
[gnulib.git]
/
tests
/
test-mbscasestr2.c
diff --git
a/tests/test-mbscasestr2.c
b/tests/test-mbscasestr2.c
index
5488187
..
1a95393
100644
(file)
--- a/
tests/test-mbscasestr2.c
+++ b/
tests/test-mbscasestr2.c
@@
-1,10
+1,10
@@
/* Test of searching in a string.
/* Test of searching in a string.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007
-2010
Free Software Foundation, Inc.
- This program is free software
;
you can redistribute it and/or modify
+ This program is free software
:
you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version
2, or (at your option)
- any later version.
+ the Free Software Foundation; either version
3 of the License, or
+
(at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@
-12,31
+12,18
@@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
#include <string.h>
#include <locale.h>
#include <string.h>
#include <locale.h>
-#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
int
main ()
int
main ()
@@
-86,16
+73,16
@@
main ()
char *haystack = (char *) malloc (m + 1);
if (haystack != NULL)
{
char *haystack = (char *) malloc (m + 1);
if (haystack != NULL)
{
- memset (haystack, 'a', m);
- haystack[0] = '\303'; haystack[1] = '\204';
- haystack[m] = '\0';
+
memset (haystack, 'a', m);
+
haystack[0] = '\303'; haystack[1] = '\204';
+
haystack[m] = '\0';
- for (; repeat > 0; repeat--)
- {
- ASSERT (mbscasestr (haystack, needle) == haystack + 2);
- }
+
for (; repeat > 0; repeat--)
+
{
+
ASSERT (mbscasestr (haystack, needle) == haystack + 2);
+
}
- free (haystack);
+
free (haystack);
}
}
}
}
@@
-114,15
+101,15
@@
main ()
char *needle = (char *) malloc (m + 1);
if (needle != NULL)
{
char *needle = (char *) malloc (m + 1);
if (needle != NULL)
{
- memset (needle, 'A', m);
- needle[m] = '\0';
+
memset (needle, 'A', m);
+
needle[m] = '\0';
- for (; repeat > 0; repeat--)
- {
- ASSERT (mbscasestr (haystack, needle) == NULL);
- }
+
for (; repeat > 0; repeat--)
+
{
+
ASSERT (mbscasestr (haystack, needle) == NULL);
+
}
- free (needle);
+
free (needle);
}
}
}
}
@@
-133,23
+120,21
@@
main ()
char *needle = (char *) malloc (m + 3);
if (haystack != NULL && needle != NULL)
{
char *needle = (char *) malloc (m + 3);
if (haystack != NULL && needle != NULL)
{
- const char *result;
+
const char *result;
- memset (haystack, 'A', 2 * m);
- haystack[2 * m] = '\303'; haystack[2 * m + 1] = '\247';
- haystack[2 * m + 2] = '\0';
+
memset (haystack, 'A', 2 * m);
+
haystack[2 * m] = '\303'; haystack[2 * m + 1] = '\247';
+
haystack[2 * m + 2] = '\0';
- memset (needle, 'a', m);
- needle[m] = '\303'; needle[m + 1] = '\207';
- needle[m + 2] = '\0';
+
memset (needle, 'a', m);
+
needle[m] = '\303'; needle[m + 1] = '\207';
+
needle[m + 2] = '\0';
- result = mbscasestr (haystack, needle);
- ASSERT (result == haystack + m);
+
result = mbscasestr (haystack, needle);
+
ASSERT (result == haystack + m);
}
}
- if (needle != NULL)
- free (needle);
- if (haystack != NULL)
- free (haystack);
+ free (needle);
+ free (haystack);
}
return 0;
}
return 0;