diff options
author | Miles Bader <miles@gnu.org> | 1996-05-10 21:08:52 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1996-05-10 21:08:52 +0000 |
commit | caca9913c9aaf8f557028ad177b24c516044f281 (patch) | |
tree | 042857e2a2cff1e902bbc1473bb4b0f427fcc031 | |
parent | f0ba3121a0672a9c7505538750fdb1c9b060fc9a (diff) |
(store_set_runs): Use store_run, not off_t, vectors; tweak accordingly.
(store_set_children): New function.
-rw-r--r-- | libstore/set.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/libstore/set.c b/libstore/set.c index d59538e1..8daba9dd 100644 --- a/libstore/set.c +++ b/libstore/set.c @@ -27,10 +27,10 @@ /* Set STORE's current runs list to (a copy of) RUNS and NUM_RUNS. */ error_t -store_set_runs (struct store *store, const off_t *runs, unsigned num_runs) +store_set_runs (struct store *store, const struct store_run *runs, unsigned num_runs) { - unsigned size = num_runs * sizeof (off_t); - off_t *copy = malloc (size); + unsigned size = num_runs * sizeof (struct store_run); + struct store_run *copy = malloc (size); if (!copy) return ENOMEM; @@ -48,6 +48,27 @@ store_set_runs (struct store *store, const off_t *runs, unsigned num_runs) return 0; } +/* Set STORE's current children list to (a copy of) CHILDREN and NUM_CHILDREN. */ +error_t +store_set_children (struct store *store, + struct store *const *children, unsigned num_children) +{ + unsigned size = num_children * sizeof (struct store_run); + struct store **copy = malloc (size); + + if (!copy) + return ENOMEM; + + if (store->children) + free (store->children); + + bcopy (children, copy, size); + store->children = copy; + store->num_children = num_children; + + return 0; +} + /* Sets the name associated with STORE to a copy of NAME. */ error_t store_set_name (struct store *store, const char *name) |