Subject: [PATCH] dfa: return NULL as can't find any predicates

From: Norihiro Tanaka <[email-masked]>
Date: Sun, 05 Oct 2014 12:33:45 +0900

find_pred function is return an address to NULL pointer, but I think we
don't hope it.  So fix it.

BTW, it could never happen, as the syntax is checked in regex prior to it.
From ff7e6f5994b8f90aaeb85da6b31569f01f97f2f4 Mon Sep 17 00:00:00 2001
From: Norihiro Tanaka <[email-masked]>
Date: Sun, 5 Oct 2014 12:09:24 +0900
Subject: [PATCH] dfa: return NULL as can't find any predicates

* src/dfa.c (find_pred): Return NULL as can't find any predicates.
---
 src/dfa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/dfa.c b/src/dfa.c
index 4f45fff..d2515fc 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -965,9 +965,9 @@ find_pred (const char *str)
   unsigned int i;
   for (i = 0; prednames[i].name; ++i)
     if (STREQ (str, prednames[i].name))
-      break;
+      return &prednames[i];
 
-  return &prednames[i];
+  return NULL;
 }
 
 /* Multibyte character handling sub-routine for lex.
-- 
2.1.1