projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
crypto/gc-des: Fix recent regression.
[gnulib.git]
/
tests
/
test-hash.c
diff --git
a/tests/test-hash.c
b/tests/test-hash.c
index
2e7c550
..
4a8a3be
100644
(file)
--- a/
tests/test-hash.c
+++ b/
tests/test-hash.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (C) 2009
Free Software Foundation
+ * Copyright (C) 2009
-2011 Free Software Foundation, Inc.
* Written by Jim Meyering
*
* This program is free software: you can redistribute it and/or modify
* Written by Jim Meyering
*
* This program is free software: you can redistribute it and/or modify
@@
-20,7
+20,6
@@
#include "hash.h"
#include "hash-pjw.h"
#include "inttostr.h"
#include "hash.h"
#include "hash-pjw.h"
#include "inttostr.h"
-#include "xalloc.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
@@
-28,21
+27,11
@@
#include <string.h>
#include <unistd.h>
#include <string.h>
#include <unistd.h>
+#include "macros.h"
+
#define STREQ(a, b) (strcmp (a, b) == 0)
#define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
#define STREQ(a, b) (strcmp (a, b) == 0)
#define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
-
static bool
hash_compare_strings (void const *x, void const *y)
{
static bool
hash_compare_strings (void const *x, void const *y)
{
@@
-124,8
+113,10
@@
main (int argc, char **argv)
ASSERT (ht);
insert_new (ht, "a");
{
ASSERT (ht);
insert_new (ht, "a");
{
- char *str1 = xstrdup ("a");
- char *str2 = hash_insert (ht, str1);
+ char *str1 = strdup ("a");
+ char *str2;
+ ASSERT (str1);
+ str2 = hash_insert (ht, str1);
ASSERT (str1 != str2);
ASSERT (STREQ (str1, str2));
free (str1);
ASSERT (str1 != str2);
ASSERT (STREQ (str1, str2));
free (str1);
@@
-171,7
+162,8
@@
main (int argc, char **argv)
ht = hash_initialize (sz, NULL, NULL, NULL, NULL);
ASSERT (ht);
{
ht = hash_initialize (sz, NULL, NULL, NULL, NULL);
ASSERT (ht);
{
- char *str = xstrdup ("a");
+ char *str = strdup ("a");
+ ASSERT (str);
insert_new (ht, "a");
insert_new (ht, str);
ASSERT (hash_lookup (ht, str) == str);
insert_new (ht, "a");
insert_new (ht, str);
ASSERT (hash_lookup (ht, str) == str);
@@
-216,7
+208,9
@@
main (int argc, char **argv)
{
char buf[50];
char const *p = uinttostr (i, buf);
{
char buf[50];
char const *p = uinttostr (i, buf);
- insert_new (ht, xstrdup (p));
+ char *p_dup = strdup (p);
+ ASSERT (p_dup);
+ insert_new (ht, p_dup);
}
break;
}
break;