* lib/hash.h (hash_remove): Renamed from hash_delete.
(hash_delete): New declaration.
* lib/hash.c (hash_remove): Renamed from hash_delete.
(hash_delete): New function.
* tests/test-hash.c (main): Update.
* lib/fts-cycle.c (leave_dir): Likewise.
* NEWS: Mention the change.
+2020-10-16 Bruno Haible <bruno@clisp.org>
+
+ hash: Rename hash_delete to hash_remove.
+ * lib/hash.h (hash_remove): Renamed from hash_delete.
+ (hash_delete): New declaration.
+ * lib/hash.c (hash_remove): Renamed from hash_delete.
+ (hash_delete): New function.
+ * tests/test-hash.c (main): Update.
+ * lib/fts-cycle.c (leave_dir): Likewise.
+ * NEWS: Mention the change.
+
2020-10-16 Bruno Haible <bruno@clisp.org>
hash, xhash: Make usable from C++.
Date Modules Changes
+2020-10-16 hash This module deprecates the 'hash_delete' function
+ using gcc's "deprecated" attribute. Use the better-
+ named 'hash_remove' equivalent.
+
2020-08-24 diffseq If you do not define NOTE_ORDERED to true,
the NOTE_DELETE and NOTE_INSERT actions might
not be done in order, to help cut down worst-case
void *found;
obj.dev = st->st_dev;
obj.ino = st->st_ino;
- found = hash_delete (fts->fts_cycle.ht, &obj);
+ found = hash_remove (fts->fts_cycle.ht, &obj);
if (!found)
abort ();
free (found);
}
void *
-hash_delete (Hash_table *table, const void *entry)
+hash_remove (Hash_table *table, const void *entry)
{
void *data;
struct hash_entry *bucket;
return data;
}
+void *
+hash_delete (Hash_table *table, const void *entry)
+{
+ return hash_remove (table, entry);
+}
+
/* Testing. */
#if TESTING
/* If ENTRY is already in the table, remove it and return the just-deleted
data (the user may want to deallocate its storage). If ENTRY is not in the
table, don't modify the table and return NULL. */
-extern void *hash_delete (Hash_table *table, const void *entry);
+extern void *hash_remove (Hash_table *table, const void *entry);
+
+/* Same as hash_remove. This interface is deprecated.
+ FIXME: Remove in 2022. */
+extern void *hash_delete (Hash_table *table, const void *entry)
+ _GL_ATTRIBUTE_DEPRECATED;
# ifdef __cplusplus
}
ASSERT (hash_get_entries (ht, buf, 5) == 3);
ASSERT (STREQ (buf[0], "a") || STREQ (buf[0], "b") || STREQ (buf[0], "c"));
}
- ASSERT (hash_delete (ht, "a"));
- ASSERT (hash_delete (ht, "a") == NULL);
- ASSERT (hash_delete (ht, "b"));
- ASSERT (hash_delete (ht, "c"));
+ ASSERT (hash_remove (ht, "a"));
+ ASSERT (hash_remove (ht, "a") == NULL);
+ ASSERT (hash_remove (ht, "b"));
+ ASSERT (hash_remove (ht, "c"));
ASSERT (hash_rehash (ht, 47));
ASSERT (hash_rehash (ht, 467));
/* empty */
}
ASSERT (p);
- v = hash_delete (ht, p);
+ v = hash_remove (ht, p);
ASSERT (v);
free (v);
}