nss/libsubid: simplify the ranges variable for list_owner_ranges

Following alexey-tikhonov's suggestion.

Since we've dropped the 'owner' field in the data returned for
get_subid_ranges, we can just return a single allocated array of
simple structs.  This means we can return a ** instead of ***, and
we can get rid of the subid_free_ranges() helper, since the caller
can just free() the returned data.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
This commit is contained in:
Serge Hallyn
2021-05-22 12:16:50 -05:00
parent 322db32971
commit 3d670ba7ed
8 changed files with 39 additions and 74 deletions

View File

@@ -17,7 +17,7 @@ void usage(void)
int main(int argc, char *argv[])
{
int i, count=0;
struct subid_range **ranges;
struct subid_range *ranges;
const char *owner;
Prog = Basename (argv[0]);
@@ -39,8 +39,7 @@ int main(int argc, char *argv[])
}
for (i = 0; i < count; i++) {
printf("%d: %s %lu %lu\n", i, owner,
ranges[i]->start, ranges[i]->count);
ranges[i].start, ranges[i].count);
}
subid_free_ranges(ranges, count);
return 0;
}