[U-Boot] [PATCH 31/39] env: Drop _ENTRY
Joe Hershberger
joe.hershberger at ni.com
Tue Jul 30 21:35:04 UTC 2019
On Sun, Jul 28, 2019 at 9:28 AM Simon Glass <sjg at 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 at chromium.org>
> ---
>
> include/search.h | 2 +-
> lib/hashtable.c | 7 ++++---
> 2 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/include/search.h b/include/search.h
> index efa8bcbef6..c99648f80b 100644
> --- a/include/search.h
> +++ b/include/search.h
> @@ -42,7 +42,7 @@ struct env_entry {
>
> /* Data type for reentrant functions. */
> struct hsearch_data {
> - struct _ENTRY *table;
> + struct env_entry_node *table;
Don't you need an opaque definition of this?
Also, there is an opaque definition of _ENTRY in this file that needs
to go away.
> 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;
>
> --
> 2.22.0.709.g102302147b-goog
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot
More information about the U-Boot
mailing list