X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-striconveh.c;h=2557baa48ea2200186bf69da69c3e568c9a2a7c3;hb=a0bdb062d720c5d3092e4974d0d31a71df302fb4;hp=31b7b721d12d6188af2061039c4aca180590f4c7;hpb=6d6f8a5cd56ca54a9e9d49516cd2e849f8a6b1c6;p=gnulib.git
diff --git a/tests/test-striconveh.c b/tests/test-striconveh.c
index 31b7b721d..2557baa48 100644
--- a/tests/test-striconveh.c
+++ b/tests/test-striconveh.c
@@ -1,10 +1,10 @@
/* Test of character set conversion with error handling.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008 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
- 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
@@ -12,14 +12,11 @@
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 . */
/* Written by Bruno Haible , 2007. */
-#ifdef HAVE_CONFIG_H
-# include
-#endif
+#include
#include "striconveh.h"
@@ -28,11 +25,22 @@
#endif
#include
+#include
#include
#include
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ fflush (stderr); \
+ abort (); \
+ } \
+ } \
+ while (0)
/* Magic number for detecting bounds violations. */
#define MAGIC 0x1983EFF1
@@ -64,8 +72,6 @@ main ()
iconv_t cd_88592_to_utf8 = iconv_open ("UTF-8", "ISO-8859-2");
iconv_t cd_utf8_to_88592 = iconv_open ("ISO-8859-2", "UTF-8");
- ASSERT (cd_88591_to_88592 != (iconv_t)(-1));
- ASSERT (cd_88592_to_88591 != (iconv_t)(-1));
ASSERT (cd_88591_to_utf8 != (iconv_t)(-1));
ASSERT (cd_utf8_to_88591 != (iconv_t)(-1));
ASSERT (cd_88592_to_utf8 != (iconv_t)(-1));
@@ -325,8 +331,7 @@ main ()
ASSERT (offsets[1] == MAGIC);
free (offsets);
}
- if (result != NULL)
- free (result);
+ free (result);
}
}
@@ -457,8 +462,10 @@ main ()
free (result);
}
- iconv_close (cd_88591_to_88592);
- iconv_close (cd_88592_to_88591);
+ if (cd_88591_to_88592 != (iconv_t)(-1))
+ iconv_close (cd_88591_to_88592);
+ if (cd_88592_to_88591 != (iconv_t)(-1))
+ iconv_close (cd_88592_to_88591);
iconv_close (cd_88591_to_utf8);
iconv_close (cd_utf8_to_88591);
iconv_close (cd_88592_to_utf8);
@@ -712,8 +719,7 @@ main ()
ASSERT (offsets[1] == MAGIC);
free (offsets);
}
- if (result != NULL)
- free (result);
+ free (result);
}
}