[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[augeas-devel] augeas: master - * src/fa.c (fa_ambig_example): getting a NULL example is not an error



Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=e370e1afa8a7f66a1819f06d941c57daa68cce59
Commit:        e370e1afa8a7f66a1819f06d941c57daa68cce59
Parent:        566cd261b9e5f08b919d916b809082bdc59e8a0e
Author:        David Lutterkort <lutter redhat com>
AuthorDate:    Thu Jan 14 12:23:28 2010 -0800
Committer:     David Lutterkort <lutter redhat com>
CommitterDate: Thu Jan 14 14:48:38 2010 -0800

* src/fa.c (fa_ambig_example): getting a NULL example is not an error

---
 src/fa.c |   42 ++++++++++++++++++++----------------------
 1 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/src/fa.c b/src/fa.c
index 84c15af..b3f56d0 100644
--- a/src/fa.c
+++ b/src/fa.c
@@ -2842,28 +2842,26 @@ int fa_ambig_example(struct fa *fa1, struct fa *fa2,
     if (r < 0)
         goto error;
 
-    if (s == NULL)
-        goto error;
-
-    char *t;
-    _F(ALLOC_N(result, (strlen(s)-1)/2 + 1));
-    t = result;
-    int i = 0;
-    for (i=0; s[2*i] == X; i++)
-        *t++ = s[2*i + 1];
-    if (pv != NULL)
-        *pv = t;
-    i += 1;
-
-    for ( ;s[2*i] == X; i++)
-        *t++ = s[2*i + 1];
-    if (v != NULL)
-        *v = t;
-    i += 1;
-
-    for (; 2*i+1 < strlen(s); i++)
-        *t++ = s[2*i + 1];
-
+    if (s != NULL) {
+        char *t;
+        _F(ALLOC_N(result, (strlen(s)-1)/2 + 1));
+        t = result;
+        int i = 0;
+        for (i=0; s[2*i] == X; i++)
+            *t++ = s[2*i + 1];
+        if (pv != NULL)
+            *pv = t;
+        i += 1;
+
+        for ( ;s[2*i] == X; i++)
+            *t++ = s[2*i + 1];
+        if (v != NULL)
+            *v = t;
+        i += 1;
+
+        for (; 2*i+1 < strlen(s); i++)
+            *t++ = s[2*i + 1];
+    }
     ret = 0;
 
  done:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]