From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xenproject.org
Cc: Juergen Gross <jgross@suse.com>, Wei Liu <wl@xen.org>,
Julien Grall <julien@xen.org>,
Anthony PERARD <anthony.perard@citrix.com>
Subject: [PATCH 3/3] tools/xenstore: drop DEFINE_HASHTABLE_* macros and usage intro
Date: Thu, 20 Jan 2022 13:02:36 +0100 [thread overview]
Message-ID: <20220120120236.13826-4-jgross@suse.com> (raw)
In-Reply-To: <20220120120236.13826-1-jgross@suse.com>
The DEFINE_HASHTABLE_* macros are used nowhere, so drop them. The usage
intro isn't needed either with those macros dropped.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
tools/xenstore/hashtable.h | 76 --------------------------------------
1 file changed, 76 deletions(-)
diff --git a/tools/xenstore/hashtable.h b/tools/xenstore/hashtable.h
index b90781abd4..62fef6081a 100644
--- a/tools/xenstore/hashtable.h
+++ b/tools/xenstore/hashtable.h
@@ -5,62 +5,6 @@
struct hashtable;
-/* Example of use:
- *
- * struct hashtable *h;
- * struct some_key *k;
- * struct some_value *v;
- *
- * static unsigned int hash_from_key_fn( void *k );
- * static int keys_equal_fn ( void *key1, void *key2 );
- *
- * h = create_hashtable(16, hash_from_key_fn, keys_equal_fn);
- * k = (struct some_key *) malloc(sizeof(struct some_key));
- * v = (struct some_value *) malloc(sizeof(struct some_value));
- *
- * (initialise k and v to suitable values)
- *
- * if (! hashtable_insert(h,k,v) )
- * { exit(-1); }
- *
- * if (NULL == (found = hashtable_search(h,k) ))
- * { printf("not found!"); }
- *
- * if (NULL == (found = hashtable_remove(h,k) ))
- * { printf("Not found\n"); }
- *
- */
-
-/* Macros may be used to define type-safe(r) hashtable access functions, with
- * methods specialized to take known key and value types as parameters.
- *
- * Example:
- *
- * Insert this at the start of your file:
- *
- * DEFINE_HASHTABLE_INSERT(insert_some, struct some_key, struct some_value);
- * DEFINE_HASHTABLE_SEARCH(search_some, struct some_key, struct some_value);
- * DEFINE_HASHTABLE_REMOVE(remove_some, struct some_key, struct some_value);
- *
- * This defines the functions 'insert_some', 'search_some' and 'remove_some'.
- * These operate just like hashtable_insert etc., with the same parameters,
- * but their function signatures have 'struct some_key *' rather than
- * 'void *', and hence can generate compile time errors if your program is
- * supplying incorrect data as a key (and similarly for value).
- *
- * Note that the hash and key equality functions passed to create_hashtable
- * still take 'void *' parameters instead of 'some key *'. This shouldn't be
- * a difficult issue as they're only defined and passed once, and the other
- * functions will ensure that only valid keys are supplied to them.
- *
- * The cost for this checking is increased code size and runtime overhead
- * - if performance is important, it may be worth switching back to the
- * unsafe methods once your program has been debugged with the safe methods.
- * This just requires switching to some simple alternative defines - eg:
- * #define insert_some hashtable_insert
- *
- */
-
/*****************************************************************************
* create_hashtable
@@ -98,12 +42,6 @@ create_hashtable(unsigned int minsize,
int
hashtable_insert(struct hashtable *h, void *k, void *v);
-#define DEFINE_HASHTABLE_INSERT(fnname, keytype, valuetype) \
-int fnname (struct hashtable *h, keytype *k, valuetype *v) \
-{ \
- return hashtable_insert(h,k,v); \
-}
-
/*****************************************************************************
* hashtable_search
@@ -116,12 +54,6 @@ int fnname (struct hashtable *h, keytype *k, valuetype *v) \
void *
hashtable_search(struct hashtable *h, void *k);
-#define DEFINE_HASHTABLE_SEARCH(fnname, keytype, valuetype) \
-valuetype * fnname (struct hashtable *h, keytype *k) \
-{ \
- return (valuetype *) (hashtable_search(h,k)); \
-}
-
/*****************************************************************************
* hashtable_remove
@@ -134,13 +66,6 @@ valuetype * fnname (struct hashtable *h, keytype *k) \
void * /* returns value */
hashtable_remove(struct hashtable *h, void *k);
-#define DEFINE_HASHTABLE_REMOVE(fnname, keytype, valuetype) \
-valuetype * fnname (struct hashtable *h, keytype *k) \
-{ \
- return (valuetype *) (hashtable_remove(h,k)); \
-}
-
-
/*****************************************************************************
* hashtable_count
@@ -151,7 +76,6 @@ valuetype * fnname (struct hashtable *h, keytype *k) \
unsigned int
hashtable_count(struct hashtable *h);
-
/*****************************************************************************
* hashtable_destroy
--
2.31.1
next prev parent reply other threads:[~2022-01-20 12:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-20 12:02 [PATCH 0/3] tools/xenstore: simplify hashtable implementation Juergen Gross
2022-01-20 12:02 ` [PATCH 1/3] tools/xenstore: merge hashtable_private.h into hashtable.c Juergen Gross
2022-01-21 14:40 ` Anthony PERARD
2022-01-20 12:02 ` [PATCH 2/3] tools/xenstore: fix hashtable_expand() zeroing new area Juergen Gross
2022-01-21 14:55 ` Anthony PERARD
2022-01-20 12:02 ` Juergen Gross [this message]
2022-01-21 15:13 ` [PATCH 3/3] tools/xenstore: drop DEFINE_HASHTABLE_* macros and usage intro Anthony PERARD
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220120120236.13826-4-jgross@suse.com \
--to=jgross@suse.com \
--cc=anthony.perard@citrix.com \
--cc=julien@xen.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.