[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 5/6] Clean: Remove unnecessary xmalloc()/strcpy()
From: |
Michael Witten |
Subject: |
[PATCH 5/6] Clean: Remove unnecessary xmalloc()/strcpy() |
Date: |
Sun, 27 Feb 2011 17:58:43 -0600 |
Signed-off-by: Michael Witten <mfwitten@gmail.com>
---
parse.y | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/parse.y b/parse.y
index a12c4d0..b61c4d0 100644
--- a/parse.y
+++ b/parse.y
@@ -4538,17 +4538,13 @@ read_token_word (character)
shell's single-character parameter expansions, and set flags.*/
else if MBTEST(character == '$' && peek_char == '$')
{
- ttok = (char *)xmalloc (3);
- ttok[0] = ttok[1] = '$';
- ttok[2] = '\0';
RESIZE_MALLOCED_BUFFER (token, token_index, 2,
token_buffer_size,
TOKEN_DEFAULT_GROW_SIZE);
- strcpy (token + token_index, ttok);
- token_index += 2;
+ token[token_index++] = '$';
+ token[token_index++] = '$';
dollar_present = 1;
all_digit_token = 0;
- FREE (ttok);
goto next_character;
}
else
--
1.7.4.22.g14b16.dirty
- [PATCH 0/6] Off-by-one bug fix and clean up, Michael Witten, 2011/02/28
- [PATCH 1/6] Bug: extglob: Fix off-by-one assignment in read_token_word(), Michael Witten, 2011/02/28
- [PATCH 2/6] Bug: shellexp: Fix off-by-one assignment in read_token_word(), Michael Witten, 2011/02/28
- [PATCH 3/6] Clean: parse_token_word(): relax memory requirements (off by one), Michael Witten, 2011/02/28
- [PATCH 4/6] Clean: More direct coupling between assignment and allocation, Michael Witten, 2011/02/28
- [PATCH 5/6] Clean: Remove unnecessary xmalloc()/strcpy(),
Michael Witten <=
- [PATCH 6/6] Clean: Remove unnecessary backslashes (line continuation), Michael Witten, 2011/02/28