grep-commit
[Top][All Lists]
Advanced

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

Changes to grep/src/search.c


From: Stepan Kasal
Subject: Changes to grep/src/search.c
Date: Wed, 09 Mar 2005 08:11:30 -0500

Index: grep/src/search.c
diff -u grep/src/search.c:1.33 grep/src/search.c:1.34
--- grep/src/search.c:1.33      Sat Feb 26 15:25:57 2005
+++ grep/src/search.c   Wed Mar  9 13:11:28 2005
@@ -359,7 +359,7 @@
     {
       if (match_icase)
         {
-          char *case_buf = malloc(size);
+          char *case_buf = xmalloc(size);
           memcpy(case_buf, buf, size);
           buf = case_buf;
         }
@@ -379,17 +379,7 @@
              /* Find a possible match using the KWset matcher. */
              size_t offset = kwsexec (kwset, beg, buflim - beg, &kwsm);
              if (offset == (size_t) -1)
-               {
-#ifdef MBS_SUPPORT
-                 if (MB_CUR_MAX > 1)
-                    {
-                      if (match_icase)
-                        free ((char*)buf);
-                      free(mb_properties);
-                    }
-#endif /* MBS_SUPPORT */
-                 return (size_t)-1;
-               }
+               goto failure;
              beg += offset;
              /* Narrow down to the line containing the candidate, and
                 run it through DFA. */
@@ -484,6 +474,8 @@
            }
        } /* for Regex patterns.  */
     } /* for (beg = end ..) */
+
+ failure:
 #ifdef MBS_SUPPORT
   if (MB_CUR_MAX > 1)
     {
@@ -547,7 +539,7 @@
     {
       if (match_icase)
         {
-          char *case_buf = malloc(size);
+          char *case_buf = xmalloc(size);
           memcpy(case_buf, buf, size);
           buf = case_buf;
         }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]