X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fdata%2Fdictionary.c;h=3e16831b14ca430a1999268f94fdca04fe1fac44;hb=8a7f5c28b68af3cd03a524329c1d6e7eba355158;hp=e312d2e9abd2d5fce35f4b49b4ddc478c93926b9;hpb=3e393e4601620af7583ca2b748def2ed08b468ec;p=pspp-builds.git diff --git a/src/data/dictionary.c b/src/data/dictionary.c index e312d2e9..3e16831b 100644 --- a/src/data/dictionary.c +++ b/src/data/dictionary.c @@ -463,6 +463,20 @@ dict_delete_vars (struct dictionary *d, dict_delete_var (d, *vars++); } +/* Deletes the COUNT variables in D starting at index IDX. This + is unsafe; see the comment on dict_delete_var() for + details. */ +void +dict_delete_consecutive_vars (struct dictionary *d, size_t idx, size_t count) +{ + /* FIXME: this can be done in O(count) time, but this algorithm + is O(count**2). */ + assert (idx + count <= d->var_cnt); + + while (count-- > 0) + dict_delete_var (d, d->var[idx]); +} + /* Deletes scratch variables from dictionary D. */ void dict_delete_scratch_vars (struct dictionary *d)