From 0b2395fb4aa76ce82c1923884c2344bdc20bdb0f Mon Sep 17 00:00:00 2001 From: obrien Date: Sun, 14 Apr 2002 04:15:34 +0000 Subject: Back out rev 1.17, it breaks dependencies. With rev 1.7 one cannot build src/bin/sh -- because make fails to create the buildtools before trying to use them. Actually it does compile the buildtools into .o's before trying to use them, but not all the way into binaries. --- usr.bin/make/str.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/make/str.c b/usr.bin/make/str.c index 03ff7a4a..4889ec9 100644 --- a/usr.bin/make/str.c +++ b/usr.bin/make/str.c @@ -94,30 +94,26 @@ str_concat(s1, s2, flags) char *result; /* get the length of both strings */ - len1 = s1 == NULL ? 0 : strlen(s1); - len2 = s2 == NULL ? 0 : strlen(s2); + len1 = strlen(s1); + len2 = strlen(s2); /* allocate length plus separator plus EOS */ result = emalloc((u_int)(len1 + len2 + 2)); /* copy first string into place */ - if (len1) - memcpy(result, s1, len1); + memcpy(result, s1, len1); /* add separator character */ - if (len1 && len2) { - if (flags & STR_ADDSPACE) - result[len1++] = ' '; - else if (flags & STR_ADDSLASH) - result[len1++] = '/'; + if (flags & STR_ADDSPACE) { + result[len1] = ' '; + ++len1; + } else if (flags & STR_ADDSLASH) { + result[len1] = '/'; + ++len1; } - /* copy second string into place */ - if (len2) - memcpy(result + len1, s2, len2); - - /* Terminate. */ - result[len1 + len2] = '\0'; + /* copy second string plus EOS into place */ + memcpy(result + len1, s2, len2 + 1); /* free original strings */ if (flags & STR_DOFREE) { -- cgit v1.1