Message ID | 20190802154428.222151-33-sjg@chromium.org |
---|---|
State | Accepted |
Commit | 25e51e90feec10b7d534b123cd9c4ed7a3a2dc1a |
Delegated to: | Tom Rini |
Headers | show |
Series | env: common: Remove environment definitions from common.h | expand |
On Fri, Aug 2, 2019 at 10:46 AM Simon Glass <sjg@chromium.org> wrote: > > This typedef does not need to be defined in the search.h header since it > is only used in one file (hashtable.c). Remove it from the header and > change it to a struct. > > Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by :Joe Hershberger <joe.hershberger@ni.com>
On Fri, Aug 02, 2019 at 09:44:19AM -0600, Simon Glass wrote: > This typedef does not need to be defined in the search.h header since it > is only used in one file (hashtable.c). Remove it from the header and > change it to a struct. > > Signed-off-by: Simon Glass <sjg@chromium.org> Applied to u-boot/master, thanks!
diff --git a/include/search.h b/include/search.h index 81745a917d..c99648f80b 100644 --- a/include/search.h +++ b/include/search.h @@ -34,9 +34,6 @@ struct env_entry { int flags; }; -/* Opaque type for internal use. */ -struct _ENTRY; - /* * Family of hash table handling functions. The functions also * have reentrant counterparts ending with _r. The non-reentrant @@ -45,7 +42,7 @@ struct _ENTRY; /* Data type for reentrant functions. */ struct hsearch_data { - struct _ENTRY *table; + struct env_entry_node *table; unsigned int size; unsigned int filled; /* diff --git a/lib/hashtable.c b/lib/hashtable.c index c77b68f4e6..1093d8adaa 100644 --- a/lib/hashtable.c +++ b/lib/hashtable.c @@ -59,10 +59,10 @@ * which describes the current status. */ -typedef struct _ENTRY { +struct env_entry_node { int used; struct env_entry entry; -} _ENTRY; +}; static void _hdelete(const char *key, struct hsearch_data *htab, @@ -120,7 +120,8 @@ int hcreate_r(size_t nel, struct hsearch_data *htab) htab->filled = 0; /* allocate memory and zero out */ - htab->table = (_ENTRY *) calloc(htab->size + 1, sizeof(_ENTRY)); + htab->table = (struct env_entry_node *)calloc(htab->size + 1, + sizeof(struct env_entry_node)); if (htab->table == NULL) return 0;
This typedef does not need to be defined in the search.h header since it is only used in one file (hashtable.c). Remove it from the header and change it to a struct. Signed-off-by: Simon Glass <sjg@chromium.org> --- Changes in v3: - Move removal of _ENTRY to _'Drop ENTRY' patch Changes in v2: None include/search.h | 5 +---- lib/hashtable.c | 7 ++++--- 2 files changed, 5 insertions(+), 7 deletions(-)