aboutsummaryrefslogtreecommitdiff
path: root/libctf/ctf-inlines.h
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2020-06-02 21:31:45 +0100
committerNick Alcock <nick.alcock@oracle.com>2020-07-22 17:57:41 +0100
commit809f6eb3321edb91fcc96b1f8353dbfe2f762fa7 (patch)
tree0dfd5c1aac3b5580c483d03984ce49bbb01282f2 /libctf/ctf-inlines.h
parent469e75b621f6ee0b235d5dbe7566483d356d178d (diff)
downloadgdb-809f6eb3321edb91fcc96b1f8353dbfe2f762fa7.zip
gdb-809f6eb3321edb91fcc96b1f8353dbfe2f762fa7.tar.gz
gdb-809f6eb3321edb91fcc96b1f8353dbfe2f762fa7.tar.bz2
libctf: add new dynhash functions
Future commits will use these. ctf_dynhash_elements: count elements in a dynhash ctf_dynhash_lookup_kv: look up and return pointers to the original key and value in a dynhash (the only way of getting a reference to the original key) ctf_dynhash_iter_find: iterate until an item is found, then return its key ctf_dynhash_cinsert: insert a const key / value into a dynhash (a thim wrapper in a new header dedicated to inline functions). As with the rest of ctf_dynhash, this is not public API. No impact on existing callers is expected. libctf/ * ctf-inlines.h: New file. * ctf-impl.h: Include it. (ctf_hash_iter_find_f): New typedef. (ctf_dynhash_elements): New. (ctf_dynhash_lookup_kv): New. (ctf_dynhash_iter_find): New. * ctf-hash.c (ctf_dynhash_lookup_kv): New. (ctf_traverse_find_cb_arg_t): New. (ctf_hashtab_traverse_find): New. (ctf_dynhash_iter_find): New. (ctf_dynhash_elements): New.
Diffstat (limited to 'libctf/ctf-inlines.h')
-rw-r--r--libctf/ctf-inlines.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/libctf/ctf-inlines.h b/libctf/ctf-inlines.h
new file mode 100644
index 0000000..ad74b39
--- /dev/null
+++ b/libctf/ctf-inlines.h
@@ -0,0 +1,45 @@
+/* Inline functions.
+ Copyright (C) 2020 Free Software Foundation, Inc.
+
+ This file is part of libctf.
+
+ libctf 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 3, 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
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING. If not see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _CTF_INLINES_H
+#define _CTF_INLINES_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include "config.h"
+
+#ifndef _libctf_malloc_
+#error "ctf-inlines.h" should not be included directly: include "ctf-impl.h".
+#endif
+
+
+static inline int
+ctf_dynhash_cinsert (ctf_dynhash_t *h, const void *k, const void *v)
+{
+ return ctf_dynhash_insert (h, (void *) k, (void *) v);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CTF_INLINES_H */