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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user