[augeas-devel] augeas: master - * src/regexp.c (regexp_escape): treat NULL regexps as the empty regexp

David Lutterkort lutter at fedoraproject.org
Fri Nov 13 19:26:54 UTC 2009


Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=a2666e3fb5b0c976735d98f696ca5aeb13edd763
Commit:        a2666e3fb5b0c976735d98f696ca5aeb13edd763
Parent:        f6568ba916e08707e6bb6050eb7c643958fb1c4b
Author:        David Lutterkort <lutter at redhat.com>
AuthorDate:    Wed Nov 11 16:08:12 2009 -0800
Committer:     David Lutterkort <lutter at redhat.com>
CommitterDate: Fri Nov 13 10:45:05 2009 -0800

* src/regexp.c (regexp_escape): treat NULL regexps as the empty regexp

---
 src/regexp.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/regexp.c b/src/regexp.c
index 15a73af..caecce4 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -36,6 +36,9 @@ static const struct string *const empty_pattern = &empty_pattern_string;
 char *regexp_escape(const struct regexp *r) {
     char *pat = NULL;
 
+    if (r == NULL)
+        return strdup("");
+
 #if !HAVE_USELOCALE
     char *nre = NULL;
     int ret;




More information about the augeas-devel mailing list