]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Use temporary variable
authorAlejandro Colomar <alx@kernel.org>
Sat, 27 May 2023 13:56:08 +0000 (15:56 +0200)
committerSerge Hallyn <serge@hallyn.com>
Thu, 8 Jun 2023 14:05:39 +0000 (09:05 -0500)
-  Use the temporary variable more, as it helps readability: it removes
   a derefecence, which itself allows removing some parentheses.

-  Use a shorter name, which is more common with temporaries, and so
   there's less to read.

-  Assign to *ranges at the end of the function.  It's the same, but
   with the other changes, I think this makes it slightly clearer.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/subordinateio.c

index 52d0e33d1ee705ab64526133efa7edeaee3e2e93..4139674f008ce75bc1649392c68540fec089b165 100644 (file)
@@ -315,15 +315,16 @@ static bool have_range(struct commonio_db *db,
 
 static bool append_range(struct subid_range **ranges, const struct subordinate_range *new, int n)
 {
-       struct subid_range  *alloced;
+       struct subid_range  *sr;
 
-       alloced = REALLOC(*ranges, n + 1, struct subid_range);
-       if (!alloced)
+       sr = REALLOC(*ranges, n + 1, struct subid_range);
+       if (!sr)
                return false;
-       *ranges = alloced;
 
-       (*ranges)[n].start = new->start;
-       (*ranges)[n].count = new->count;
+       sr[n].start = new->start;
+       sr[n].count = new->count;
+       *ranges = sr;
+
        return true;
 }