From 462863e747da49d4feefb08f8fb81292a9ab722e Mon Sep 17 00:00:00 2001
From: Ron Yorston <rmy@pobox.com>
Date: Sun, 5 Sep 2021 16:22:45 +0100
Subject: ash: code shrink

Tweak the code to handle /etc/profile.

Looks tidier and saves 8 bytes.
---
 shell/ash.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/shell/ash.c b/shell/ash.c
index ff2a54fbe..faf861583 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -15542,9 +15542,8 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
 	struct jmploc jmploc;
 	struct stackmark smark;
 	int login_sh;
-#if ENABLE_PLATFORM_MINGW32
-	const char *sd;
 
+#if ENABLE_PLATFORM_MINGW32
 	INIT_G_memstack();
 
 	/* from init() */
@@ -15660,15 +15659,12 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
 
 		state = 1;
 #if ENABLE_PLATFORM_MINGW32
-		sd = get_system_drive();
-		if (sd) {
-			char *path = xasprintf("%s/etc/profile", sd);
-			read_profile(path);
-			free(path);
-		}
-		else
-#endif
+		hp = xasprintf("%s/etc/profile", get_system_drive() ?: "");
+		read_profile(hp);
+		free((void *)hp);
+#else
 		read_profile("/etc/profile");
+#endif
  state1:
 		state = 2;
 		hp = lookupvar("HOME");
-- 
cgit v1.2.3-55-g6feb