From 89b6477a052f167416c383f58f8b3d741c36f54f Mon Sep 17 00:00:00 2001 From: Tadashi Saito Date: Sun, 27 Oct 2024 01:17:57 +0900 Subject: [PATCH] Add (dirty) getter/setter for parent table. --- table.c | 11 +++++++++++ table.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/table.c b/table.c index 526e484..b6d5dda 100644 --- a/table.c +++ b/table.c @@ -286,3 +286,14 @@ Table *table_merge(Table *dst, const Table *src) } return dst; } + +const Table *table_get_parent(const Table *t) +{ + return t->parent; +} + +Table *table_set_parent(Table *t, const Table *parent) +{ + t->parent = parent; + return t; +} diff --git a/table.h b/table.h index fdf9935..5755f7d 100644 --- a/table.h +++ b/table.h @@ -19,5 +19,7 @@ uint64_t table_get(const Table *t, uint64_t key); bool table_set_or_put(Table *t, uint64_t key, uint64_t val); bool table_set(Table *t, uint64_t key, uint64_t val); // set only if found Table *table_merge(Table *dst, const Table *src); +const Table *table_get_parent(const Table *t); +Table *table_set_parent(Table *t, const Table *parent); #endif