diff options
author | Miles Bader <miles@gnu.org> | 1996-10-08 21:22:28 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1996-10-08 21:22:28 +0000 |
commit | 31d02bc7e518eb6df222c534e1b31f5eba4355f8 (patch) | |
tree | e40edb828831f77e0b823fc36e7887fdf4151d93 /libstore | |
parent | 5529fb929f609cade1f4f07923547cd4fcd6823d (diff) |
(store_set_child_flags, store_clear_child_flags):
New funcs.
Diffstat (limited to 'libstore')
-rw-r--r-- | libstore/kids.c | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/libstore/kids.c b/libstore/kids.c index a7e57cc9..a1c4d424 100644 --- a/libstore/kids.c +++ b/libstore/kids.c @@ -45,7 +45,7 @@ store_set_children (struct store *store, return 0; } - + /* Calls the allocate_encoding method in each child store of STORE, propagating any errors. If any child does not hae such a method, EOPNOTSUPP is returned. */ @@ -101,3 +101,51 @@ store_decode_children (struct store_enc *enc, int num_children, store_free (children[i]); return err; } + +/* Set FLAGS in all children of STORE, and if successfull, add FLAGS to + STORE's flags. */ +error_t +store_set_child_flags (struct store *store, int flags) +{ + int i; + error_t err = 0; + int old_child_flags[store->num_children]; + + for (i = 0; i < store->num_children && !err; i++) + { + old_child_flags[i] = store->children[i]->flags; + err = store_set_flags (store->children[i], flags); + } + + if (err) + while (i > 0) + store_clear_flags (store->children[--i], flags & ~old_child_flags[i]); + else + store->flags |= flags; + + return err; +} + +/* Clear FLAGS in all children of STORE, and if successfull, remove FLAGS from + STORE's flags. */ +error_t +store_clear_child_flags (struct store *store, int flags) +{ + int i; + error_t err = 0; + int old_child_flags[store->num_children]; + + for (i = 0; i < store->num_children && !err; i++) + { + old_child_flags[i] = store->children[i]->flags; + err = store_clear_flags (store->children[i], flags); + } + + if (err) + while (i > 0) + store_set_flags (store->children[--i], flags & ~old_child_flags[i]); + else + store->flags &= ~flags; + + return err; +} |