Don't have a branch for when the old pointer is NULL. realloc(3) can
handle that case just fine.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
static bool append_range(struct subid_range **ranges, const struct subordinate_range *new, int n)
{
- if (!*ranges) {
- *ranges = MALLOC(1, struct subid_range);
- if (!*ranges)
- return false;
- } else {
- struct subid_range *alloced;
- alloced = REALLOC(*ranges, n + 1, struct subid_range);
- if (!alloced)
- return false;
- *ranges = alloced;
- }
+ struct subid_range *alloced;
+
+ alloced = REALLOC(*ranges, n + 1, struct subid_range);
+ if (!alloced)
+ return false;
+ *ranges = alloced;
+
(*ranges)[n].start = new->start;
(*ranges)[n].count = new->count;
return true;