[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] grep: avoid useless allocations for empty GREP_OPTIONS
From: |
Jim Meyering |
Subject: |
[PATCH] grep: avoid useless allocations for empty GREP_OPTIONS |
Date: |
Thu, 11 Mar 2010 12:30:44 +0100 |
FYI,
>From b9de803c28eabb2245d28865ea3fd0591f5d050b Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 8 Mar 2010 17:44:43 +0100
Subject: [PATCH] grep: avoid useless allocations for empty GREP_OPTIONS
* src/grep.c (prepend_default_options): Ignore GREP_OPTIONS
when it's empty, not just when it's undefined.
There are still relatively harmless leaks when GREP_OPTIONS
is set and non-empty. We'll address those, eventually.
---
src/grep.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/grep.c b/src/grep.c
index a7f0f7c..27a1516 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -1627,7 +1627,7 @@ prepend_args (char const *options, char *buf, char **argv)
static void
prepend_default_options (char const *options, int *pargc, char ***pargv)
{
- if (options)
+ if (options && *options)
{
char *buf = xmalloc (strlen (options) + 1);
int prepended = prepend_args (options, buf, (char **) NULL);
--
1.7.0.2.393.gfb6b
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] grep: avoid useless allocations for empty GREP_OPTIONS,
Jim Meyering <=