gc: remove unused launchctl_get_uid() call

When the launchctl_boot_plist() function was added in a16eb6b1ff3 (maintenance: skip bootout/bootstrap when plist is registered, 2021-08-24), an unused call to launchctl_get_uid() was added along with it. That call appears to have been copy/pasted from launchctl_boot_plist(). Since we can remove that, we can also get rid of the "result" variable, whose only purpose was allow for the free() between its assignment and the return. That pattern also appears to have been copy/pasted from launchctl_boot_plist(). As the patch shows the returned value from launchctl_get_uid() wasn't used at all in this function. The launchctl_get_uid() function itself just calls xstrfmt() and getuid(), neither of which have any subtle global side-effects, so this removal is safe. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Sep 12, 2021 at 02:24 UTC 3218cb753f5a2a49808bf07f039051e7b79b8f44
1 file changed +1 -7
builtin/gc.c
+1 -7
@@ -1602,9 +1602,7 @@ static int launchctl_remove_plists(const char *cmd)
1602
1603 static int launchctl_list_contains_plist(const char *name, const char *cmd)
1604 {
1605 - int result;
1605 struct child_process child = CHILD_PROCESS_INIT;
1607 - char *uid = launchctl_get_uid();
1606
1607 strvec_split(&child.args, cmd);
1608 strvec_pushl(&child.args, "list", name, NULL);
@@ -1615,12 +1613,8 @@ static int launchctl_list_contains_plist(const char *name, const char *cmd)
1613 if (start_command(&child))
1614 die(_("failed to start launchctl"));
1615
1618 - result = finish_command(&child);
1619 -
1620 - free(uid);
1621 -
1616 /* Returns failure if 'name' doesn't exist. */
1623 - return !result;
1617 + return !finish_command(&child);
1618 }
1619
1620 static int launchctl_schedule_plist(const char *exec_path, enum schedule_priority schedule, const char *cmd)