aboutsummaryrefslogtreecommitdiff
path: root/include/search.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-08-02 09:44:18 -0600
committerTom Rini <trini@konsulko.com>2019-08-11 16:43:41 -0400
commitdd2408cac1ea0f5e9ab4b07539c6edaee57918cb (patch)
tree1f797fce88be656b6bafe0feac4bd183402f80dd /include/search.h
parent02cf9334280046e6b07ba304e7da2a273e445d5b (diff)
downloadu-boot-dd2408cac1ea0f5e9ab4b07539c6edaee57918cb.zip
u-boot-dd2408cac1ea0f5e9ab4b07539c6edaee57918cb.tar.gz
u-boot-dd2408cac1ea0f5e9ab4b07539c6edaee57918cb.tar.bz2
env: Drop the ENTRY typedef
U-Boot is not supposed to use typedef for structs anymore. Also this name is the same as the ENTRY() macro used in assembler files, and 'entry' itself is widely used in U-Boot (>8k matches). Drop the typedef and rename the struct to env_entry to reduce confusion. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'include/search.h')
-rw-r--r--include/search.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/include/search.h b/include/search.h
index f9fb29f..81745a9 100644
--- a/include/search.h
+++ b/include/search.h
@@ -25,13 +25,14 @@ typedef enum {
ENTER
} ACTION;
-typedef struct entry {
+/** struct env_entry - An entry in the environment hashtable */
+struct env_entry {
const char *key;
char *data;
int (*callback)(const char *name, const char *value, enum env_op op,
int flags);
int flags;
-} ENTRY;
+};
/* Opaque type for internal use. */
struct _ENTRY;
@@ -54,8 +55,8 @@ struct hsearch_data {
* shall force overwriting of write-once variables.
* Must return 0 for approval, 1 for denial.
*/
- int (*change_ok)(const ENTRY *__item, const char *newval, enum env_op,
- int flag);
+ int (*change_ok)(const struct env_entry *__item, const char *newval,
+ enum env_op, int flag);
};
/* Create a new hash table which will contain at most "__nel" elements. */
@@ -70,15 +71,16 @@ extern void hdestroy_r(struct hsearch_data *__htab);
* NULL. If ACTION is `ENTER' replace existing data (if any) with
* __item.data.
* */
-extern int hsearch_r(ENTRY __item, ACTION __action, ENTRY ** __retval,
- struct hsearch_data *__htab, int __flag);
+extern int hsearch_r(struct env_entry __item, ACTION __action,
+ struct env_entry **__retval, struct hsearch_data *__htab,
+ int __flag);
/*
* Search for an entry matching "__match". Otherwise, Same semantics
* as hsearch_r().
*/
-extern int hmatch_r(const char *__match, int __last_idx, ENTRY ** __retval,
- struct hsearch_data *__htab);
+extern int hmatch_r(const char *__match, int __last_idx,
+ struct env_entry **__retval, struct hsearch_data *__htab);
/* Search and delete entry matching "__key" in internal hash table. */
extern int hdelete_r(const char *__key, struct hsearch_data *__htab,
@@ -98,7 +100,8 @@ extern int himport_r(struct hsearch_data *__htab,
char * const vars[]);
/* Walk the whole table calling the callback on each element */
-extern int hwalk_r(struct hsearch_data *__htab, int (*callback)(ENTRY *));
+extern int hwalk_r(struct hsearch_data *__htab,
+ int (*callback)(struct env_entry *entry));
/* Flags for himport_r(), hexport_r(), hdelete_r(), and hsearch_r() */
#define H_NOCLEAR (1 << 0) /* do not clear hash table before importing */