diff options
author | bpc2003 <wpesfriendnva@gmail.com> | 2025-03-14 09:29:38 -0400 |
---|---|---|
committer | bpc2003 <wpesfriendnva@gmail.com> | 2025-03-14 09:29:38 -0400 |
commit | aa9bb5d3f1f7059bd9dd69d6b5f99acd68d439c2 (patch) | |
tree | b812fae4b000f4d86e4234c6f8cd917888cc2bc3 /src/lib/keytab.c | |
parent | 94f4db56744883e8d02f178ee61c533cadee81ad (diff) |
Added some documentation
Diffstat (limited to 'src/lib/keytab.c')
-rw-r--r-- | src/lib/keytab.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/keytab.c b/src/lib/keytab.c index 5d0c7dd..74dc47f 100644 --- a/src/lib/keytab.c +++ b/src/lib/keytab.c @@ -5,10 +5,9 @@ #include "mdb.h" -static const struct keytablist empty; - static int hash(char *key); +// getkeys - gets every single key in a key table int *getkeys(struct keytablist *list, int id) { int len = 2; @@ -24,6 +23,8 @@ int *getkeys(struct keytablist *list, int id) return indexes; } +// getkey - gets a single key from a keytable +// if it can't find the key it will return an empty table index struct keytab getkey(struct keytablist *list, int id, char *key) { int idx = hash(key); @@ -37,6 +38,8 @@ struct keytab getkey(struct keytablist *list, int id, char *key) return list[id].tab[idx]; } +// setkey - adds the given pair to the given key table +// if setkey fails it will return 1 otherwise 0 int setkey(struct keytablist **list, int id, char *pair) { if (id >= (*list)[0].len) { @@ -87,6 +90,7 @@ int setkey(struct keytablist **list, int id, char *pair) return 0; } +// delkey - removes the given key from the given key table void delkey(struct keytablist *list, int id, char *key) { int idx = hash(key); |