diff options
author | Katharina Fey <kookie@spacekookie.de> | 2019-07-14 02:00:32 +0100 |
---|---|---|
committer | Katharina Fey <kookie@spacekookie.de> | 2019-07-14 18:47:18 +0100 |
commit | c312e74f95fcfe9bd1e91c092a2d987cb067a075 (patch) | |
tree | b068a2030ff8fdba31cddd505ddbee20d687571c /bowl.c | |
parent | 6c9c0502798681d7eaa91c81858d3c113e124676 (diff) |
Implementing HASH node `remove_key` function
Diffstat (limited to 'bowl.c')
-rw-r--r-- | bowl.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -106,7 +106,20 @@ err_t bowl_remove(struct bowl *self, struct bowl *child) } } -err_t bowl_remove_key(struct bowl *self, size_t idx, struct bowl **prev) +err_t bowl_remove_key(struct bowl *self, char *key, struct bowl **prev) +{ + CHECK(self, INVALID_PARAMS) + CHECK(key, INVALID_PARAMS) + + switch(self->type) { + case LEAF: return INVALID_PARAMS; + case HASH: return hash_remove_key(self, key, prev); + + default: return INVALID_STATE; + } +} + +err_t bowl_remove_idx(struct bowl *self, size_t idx, struct bowl **prev) { CHECK(self, INVALID_PARAMS) CHECK((idx >= 0), INVALID_PARAMS) |