summaryrefslogtreecommitdiffstats
path: root/usr.bin/grep/grep.c
diff options
context:
space:
mode:
authorgabor <gabor@FreeBSD.org>2013-01-20 11:58:49 +0000
committergabor <gabor@FreeBSD.org>2013-01-20 11:58:49 +0000
commite072d47ed32f3fa80eb1c091148c6dcbcc4bac1c (patch)
tree8e8fa34581614d1697f828ed1eef7bc3df2e53ea /usr.bin/grep/grep.c
parentb6b819cf7d78035b7034e05cf0c370c6bdb9b3b9 (diff)
downloadFreeBSD-src-e072d47ed32f3fa80eb1c091148c6dcbcc4bac1c.zip
FreeBSD-src-e072d47ed32f3fa80eb1c091148c6dcbcc4bac1c.tar.gz
- Avoid unnecessary strdup()
Submitted by: ache MFC after: 5 days
Diffstat (limited to 'usr.bin/grep/grep.c')
-rw-r--r--usr.bin/grep/grep.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/grep/grep.c b/usr.bin/grep/grep.c
index 70fd9bd..117a5a9 100644
--- a/usr.bin/grep/grep.c
+++ b/usr.bin/grep/grep.c
@@ -481,7 +481,7 @@ main(int argc, char *argv[])
case 'e':
{
char *token;
- char *string = strdup(optarg);
+ char *string = optarg;
while ((token = strsep(&string, "\n")) != NULL)
add_pattern(token, strlen(token));
@@ -675,7 +675,7 @@ main(int argc, char *argv[])
/* Process patterns from command line */
if (aargc != 0 && needpattern) {
char *token;
- char *string = strdup(*aargv);
+ char *string = *aargv;
while ((token = strsep(&string, "\n")) != NULL)
add_pattern(token, strlen(token));
OpenPOWER on IntegriCloud