From e8e85ac139d2a91d6198fa3422c27b47b949b565 Mon Sep 17 00:00:00 2001 From: Max Okumoto Date: Mon, 24 Jan 2005 05:09:30 +0000 Subject: [PATCH] - Removed unnessisary append of '\0' to Buffer object. Buffer already maintains a terminating null byte. --- usr.bin/make/cond.c | 6 +----- usr.bin/make/for.c | 3 +-- usr.bin/make/parse.c | 4 +--- usr.bin/make/var.c | 14 +------------- 4 files changed, 4 insertions(+), 23 deletions(-) diff --git a/usr.bin/make/cond.c b/usr.bin/make/cond.c index fd3cf58134..675bebf7e4 100644 --- a/usr.bin/make/cond.c +++ b/usr.bin/make/cond.c @@ -38,7 +38,7 @@ * * @(#)cond.c 8.2 (Berkeley) 1/2/94 * $FreeBSD: src/usr.bin/make/cond.c,v 1.12.2.1 2003/07/22 08:03:13 ru Exp $ - * $DragonFly: src/usr.bin/make/cond.c,v 1.22 2005/01/09 23:14:42 okumoto Exp $ + * $DragonFly: src/usr.bin/make/cond.c,v 1.23 2005/01/24 05:09:30 okumoto Exp $ */ /*- @@ -250,7 +250,6 @@ CondGetArg(char **linePtr, char **argPtr, const char *func, Boolean parens) } } - Buf_AddByte(buf, (Byte)'\0'); *argPtr = (char *)Buf_GetAll(buf, &argLen); Buf_Destroy(buf, FALSE); @@ -554,7 +553,6 @@ CondToken(Boolean doEval) condExpr++) Buf_AddByte(buf, (Byte)*condExpr); - Buf_AddByte(buf, (Byte)'\0'); lhs = (char *)Buf_GetAll(buf, &varSpecLen); Buf_Destroy(buf, FALSE); @@ -650,8 +648,6 @@ do_string_compare: } } - Buf_AddByte(buf, (Byte)0); - string = (char *)Buf_GetAll(buf, (size_t *)NULL); Buf_Destroy(buf, FALSE); diff --git a/usr.bin/make/for.c b/usr.bin/make/for.c index 9325f5f520..3b45d27d64 100644 --- a/usr.bin/make/for.c +++ b/usr.bin/make/for.c @@ -35,7 +35,7 @@ * * @(#)for.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.bin/make/for.c,v 1.10 1999/09/11 13:08:01 hoek Exp $ - * $DragonFly: src/usr.bin/make/for.c,v 1.19 2005/01/11 05:13:33 okumoto Exp $ + * $DragonFly: src/usr.bin/make/for.c,v 1.20 2005/01/24 05:09:30 okumoto Exp $ */ /*- @@ -181,7 +181,6 @@ For_Eval(char *line) #define ADDWORD() \ Buf_AddBytes(buf, ptr - wrd, (Byte *)wrd), \ - Buf_AddByte(buf, (Byte)'\0'), \ Lst_AtFront(&forLst, Buf_GetAll(buf, &varlen)), \ Buf_Destroy(buf, FALSE) diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index 8bc1e5589b..a72cd2c765 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -37,7 +37,7 @@ * * @(#)parse.c 8.3 (Berkeley) 3/19/94 * $FreeBSD: src/usr.bin/make/parse.c,v 1.22.2.2 2004/07/10 08:14:42 eik Exp $ - * $DragonFly: src/usr.bin/make/parse.c,v 1.37 2005/01/11 05:13:33 okumoto Exp $ + * $DragonFly: src/usr.bin/make/parse.c,v 1.38 2005/01/24 05:09:30 okumoto Exp $ */ /*- @@ -2053,7 +2053,6 @@ ParseSkipLine(int skip, int keep_newline) } curFile.lineno++; - Buf_AddByte(buf, (Byte)'\0'); line = (char *)Buf_GetAll(buf, NULL); } while (skip == 1 && line[0] != '.'); @@ -2249,7 +2248,6 @@ test_char: if (lastc != '\0') { Buf_AddByte(buf, (Byte)lastc); } - Buf_AddByte(buf, (Byte)'\0'); line = (char *)Buf_GetAll(buf, NULL); Buf_Destroy(buf, FALSE); diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c index 6e27da1c43..1674a49b44 100644 --- a/usr.bin/make/var.c +++ b/usr.bin/make/var.c @@ -37,7 +37,7 @@ * * @(#)var.c 8.3 (Berkeley) 3/19/94 * $FreeBSD: src/usr.bin/make/var.c,v 1.16.2.3 2002/02/27 14:18:57 cjc Exp $ - * $DragonFly: src/usr.bin/make/var.c,v 1.40 2005/01/10 12:36:06 okumoto Exp $ + * $DragonFly: src/usr.bin/make/var.c,v 1.41 2005/01/24 05:09:30 okumoto Exp $ */ /*- @@ -617,7 +617,6 @@ VarModify(char *str, Boolean (*modProc)(const char *, Boolean, Buffer *, void *) for (i = 1; i < ac; i++) addSpace = (*modProc)(av[i], addSpace, buf, datum); - Buf_AddByte(buf, '\0'); str = (char *)Buf_GetAll(buf, (size_t *)NULL); Buf_Destroy(buf, FALSE); return (str); @@ -772,8 +771,6 @@ VarGetPattern(GNode *ctxt, int err, char **tstr, int delim, int *flags, Buf_AddByte(buf, (Byte)*cp); } - Buf_AddByte(buf, (Byte)'\0'); - if (*cp != delim) { *tstr = cp; *length = 0; @@ -814,7 +811,6 @@ Var_Quote(const char *str) Buf_AddByte(buf, (Byte)'\\'); Buf_AddByte(buf, (Byte)*str); } - Buf_AddByte(buf, (Byte)'\0'); ret = Buf_GetAll(buf, NULL); Buf_Destroy(buf, FALSE); return (ret); @@ -986,7 +982,6 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, size_t *lengthPtr, Boolean *freeP haveModifier = (*tstr == ':'); *tstr = '\0'; - Buf_AddByte(buf, (Byte)'\0'); str = Buf_GetAll(buf, (size_t *)NULL); vlen = strlen(str); @@ -1290,8 +1285,6 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, size_t *lengthPtr, Boolean *freeP } } - Buf_AddByte(buf, (Byte)'\0'); - /* * If lhs didn't end with the delimiter, complain and * exit. @@ -1350,8 +1343,6 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, size_t *lengthPtr, Boolean *freeP } } - Buf_AddByte(buf, (Byte)'\0'); - /* * If didn't end in delimiter character, complain */ @@ -1479,7 +1470,6 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, size_t *lengthPtr, Boolean *freeP for (cp = str; *cp ; cp++) Buf_AddByte(buf, (Byte)tolower(*cp)); - Buf_AddByte(buf, (Byte)'\0'); newStr = (char *)Buf_GetAll(buf, (size_t *)NULL); Buf_Destroy(buf, FALSE); @@ -1519,7 +1509,6 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, size_t *lengthPtr, Boolean *freeP for (cp = str; *cp ; cp++) Buf_AddByte(buf, (Byte)toupper(*cp)); - Buf_AddByte(buf, (Byte)'\0'); newStr = (char *)Buf_GetAll(buf, (size_t *)NULL); Buf_Destroy(buf, FALSE); @@ -1878,7 +1867,6 @@ Var_Subst(const char *var, const char *str, GNode *ctxt, Boolean undefErr) } } - Buf_AddByte(buf, '\0'); result = (char *)Buf_GetAll(buf, (size_t *)NULL); Buf_Destroy(buf, FALSE); return (result); -- 2.41.0