From 459a2e4ccf9aadfba9819facba1c9be5297c1625 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 1 Apr 2018 09:33:13 -0600 Subject: Change streq to return bool I wanted to use streq with std::unique in another (upcoming) patch in this seres, so I changed it to return bool. To my surprise, this lead to regressions. The cause turned out to be that streq was used as an htab callback -- by casting it to the correct function type. This sort of cast is invalid, so this patch adds a variant which is directly suitable for use by htab. (Note that I did not add an overload, as I could not get that to work with template deduction in the other patch.) ChangeLog 2018-04-05 Tom Tromey * 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. --- gdb/utils.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'gdb/utils.h') diff --git a/gdb/utils.h b/gdb/utils.h index 0de0fe2..d3b8871 100644 --- a/gdb/utils.h +++ b/gdb/utils.h @@ -89,7 +89,14 @@ extern int strcmp_iw (const char *string1, const char *string2); 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 *); -- cgit v1.1