File U_26-Reclaim-a-second-tab-stop.patch of Package slurm.32313

From: Tim Wickberg <tim@schedmd.com>
Date: Wed Nov 29 15:52:37 2023 -0700
Subject: [PATCH 26/28]Reclaim a second tab stop.
Patch-mainline: Upstream
Git-repo: https://github.com/SchedMD/slurm
Git-commit: 83ebbf36289e18f6b6b365d0d090c9f58b77c9f4
References: bsc#1218046, bsc#1218050, bsc#1218051, bsc#1218053
Signed-off-by: Egbert Eich <eich@suse.de>

---
 src/common/pack.c | 29 +++++++++++++----------------
 1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/src/common/pack.c b/src/common/pack.c
index fb11446f60..97f6e26c84 100644
--- a/src/common/pack.c
+++ b/src/common/pack.c
@@ -978,6 +978,7 @@ unpack_error:
 int unpackstr_xmalloc_escaped(char **valp, uint32_t *size_valp, Buf buffer)
 {
 	uint32_t cnt;
+	char *copy = NULL, *str, tmp;
 
 	*valp = NULL;
 	safe_unpack32(size_valp, buffer);
@@ -998,26 +999,22 @@ int unpackstr_xmalloc_escaped(char **valp, uint32_t *size_valp, Buf buffer)
 
 	/* make a buffer 2 times the size just to be safe */
 	*valp = xmalloc_nz((cnt * 2) + 1);
-	if (*valp) {
-		char *copy = NULL, *str, tmp;
-		uint32_t i;
-		copy = *valp;
-		str = &buffer->head[buffer->processed];
-
-		for (i = 0; i < cnt && *str; i++) {
-			tmp = *str++;
-			if ((tmp == '\\') || (tmp == '\'')) {
-				*copy++ = '\\';
-				(*size_valp)++;
-			}
-
-			*copy++ = tmp;
+	copy = *valp;
+	str = &buffer->head[buffer->processed];
+
+	for (uint32_t i = 0; i < cnt && *str; i++) {
+		tmp = *str++;
+		if ((tmp == '\\') || (tmp == '\'')) {
+			*copy++ = '\\';
+			(*size_valp)++;
 		}
 
-		/* Since we used xmalloc_nz, terminate the string. */
-		*copy++ = '\0';
+		*copy++ = tmp;
 	}
 
+	/* Since we used xmalloc_nz, terminate the string. */
+	*copy++ = '\0';
+
 	/* add the original value since that is what we processed */
 	buffer->processed += cnt;
 
openSUSE Build Service is sponsored by