+2018-04-05 Tom Tromey <tom@tromey.com>
+
+ * completer.c (completion_tracker::completion_tracker): Remove
+ cast.
+ (completion_tracker::discard_completions): Likewise.
+ * breakpoint.c (ambiguous_names_p): Remove cast.
+ * ada-lang.c (_initialize_ada_language): Remove cast.
+ * utils.h (streq): Update.
+ (streq_hash): Add new declaration.
+ * utils.c (streq): Return bool.
+ (streq_hash): New function.
+
2018-04-05 Tom Tromey <tom@tromey.com>
* linespec.c (event_location_to_sals) <case ADDRESS_LOCATION>:
DWARF attribute."),
NULL, NULL, &maint_set_ada_cmdlist, &maint_show_ada_cmdlist);
- decoded_names_store = htab_create_alloc
- (256, htab_hash_string, (int (*)(const void *, const void *)) streq,
- NULL, xcalloc, xfree);
+ decoded_names_store = htab_create_alloc (256, htab_hash_string, streq_hash,
+ NULL, xcalloc, xfree);
/* The ada-lang observers. */
gdb::observers::new_objfile.attach (ada_new_objfile_observer);
ambiguous_names_p (struct bp_location *loc)
{
struct bp_location *l;
- htab_t htab = htab_create_alloc (13, htab_hash_string,
- (int (*) (const void *,
- const void *)) streq,
- NULL, xcalloc, xfree);
+ htab_t htab = htab_create_alloc (13, htab_hash_string, streq_hash, NULL,
+ xcalloc, xfree);
for (l = loc; l != NULL; l = l->next)
{
completion_tracker::completion_tracker ()
{
m_entries_hash = htab_create_alloc (INITIAL_COMPLETION_HTAB_SIZE,
- htab_hash_string, (htab_eq) streq,
+ htab_hash_string, streq_hash,
NULL, xcalloc, xfree);
}
htab_delete (m_entries_hash);
m_entries_hash = htab_create_alloc (INITIAL_COMPLETION_HTAB_SIZE,
- htab_hash_string, (htab_eq) streq,
+ htab_hash_string, streq_hash,
NULL, xcalloc, xfree);
}
}
}
-/* A simple comparison function with opposite semantics to strcmp. */
+/* See utils.h. */
-int
+bool
streq (const char *lhs, const char *rhs)
{
return !strcmp (lhs, rhs);
}
+
+/* See utils.h. */
+
+int
+streq_hash (const void *lhs, const void *rhs)
+{
+ return streq ((const char *) lhs, (const char *) rhs);
+}
+
\f
/*
extern int strcmp_iw_ordered (const char *, const char *);
-extern int streq (const char *, const char *);
+/* Return true if the strings are equal. */
+
+extern bool streq (const char *, const char *);
+
+/* A variant of streq that is suitable for use as an htab
+ callback. */
+
+extern int streq_hash (const void *, const void *);
extern int subset_compare (const char *, const char *);