cleanup namespace and put <sys/types.h> where it belongs so the stuff should compile...
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Fri, 28 Dec 2001 19:22:46 +0000 (19:22 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Fri, 28 Dec 2001 19:22:46 +0000 (19:22 +0000)
ChangeLog.claws
configure.in
src/string_match.c
src/string_match.h

index d83f894af8d8cb312c95bb2d022ea1640e99d9d5..5165891fb37da7e40793911a017ffceea1542af6 100644 (file)
@@ -1,3 +1,9 @@
+2001-12-28 [alfons]    0.6.6claws29
+
+       * src/string_match.[ch]
+               clean up name space
+               allow compilation *BSD
+
 2001-12-27 [alfons]    0.6.6claws28
 
        * src/filter.c
index 227083e6c1784493114056ee981e487f020cf7be..909692a8e280f40100fb1ae9aa5eda7e5e55852a 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=6
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws28
+EXTRA_VERSION=claws29
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index 114fb593c414b5621ec237a831f981d6c285e9f1..a70366606369a15faaa9daa825502d69a60b7805 100644 (file)
  */
 
 #include <glib.h>
+#include <sys/types.h>
+#include <regex.h>
 #include "string_match.h"
 
+/* the size used for regexec in string_remove_match */
+#define STRING_MATCH_MR_SIZE 30
 
-int string_match_regexp(char * txt, char * rexp,
-                       int size, regmatch_t matches[],
-                       int cflags, int eflags)
-{
-       regex_t re;
-       int problem;
 
-       g_return_val_if_fail(txt, 0);
-       g_return_val_if_fail(rexp, 0);
+static int string_match_regexp (char * txt, char * rexp,
+                                int size, regmatch_t matches[],
+                                int cflags, int eflags);
 
-       problem = regcomp(&re, rexp, cflags);  
-       if (problem == 0) {
-               problem = regexec(&re, txt, size, matches, eflags);
-       }
-       regfree(&re);
-       return problem == 0;
-}
-
-int string_remove_match(char * txt, char * rexp, int cflags, int eflags)
+int string_remove_match(char *txt, char *rexp, int cflags, int eflags)
 {
        regmatch_t matches[STRING_MATCH_MR_SIZE];
        int foundp;
@@ -67,7 +58,7 @@ int string_remove_match(char * txt, char * rexp, int cflags, int eflags)
        }
 }
 
-int string_remove_all_matches(char * txt, char * rexp, int cflags, int eflags)
+int string_remove_all_matches(char *txt, char *rexp, int cflags, int eflags)
 {
        int pos = 0;
        int pos0 = pos;
@@ -84,3 +75,22 @@ int string_remove_all_matches(char * txt, char * rexp, int cflags, int eflags)
        }
        return pos;
 }
+
+static int string_match_regexp(char * txt, char * rexp,
+                              int size, regmatch_t matches[],
+                              int cflags, int eflags)
+{
+       regex_t re;
+       int problem;
+
+       g_return_val_if_fail(txt, 0);
+       g_return_val_if_fail(rexp, 0);
+
+       problem = regcomp(&re, rexp, cflags);  
+       if (problem == 0) {
+               problem = regexec(&re, txt, size, matches, eflags);
+       }
+       regfree(&re);
+       return problem == 0;
+}
+
index a338894b55c63c53e3f5f1d0298b620efff5716d..0bd5f78be338ad929aac1f895f13e9268b0b9255 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-
-#ifndef __STRING_MATCH_H__
-#define __STRING_MATCH_H__
-
-#include <stdio.h>
-#include <regex.h>
-
-
-/* the size used for regexec in string_remove_match */
-/* this is probably not the most clever way to define this here, though */
-#define STRING_MATCH_MR_SIZE 30
-
-
-/* match a REXP in TXT, return non-zero if found */
-/* for documentation of SIZE, MATCHES, CFLAGS, and EFLAGS see "man regex" */
-/* MATCHES will be updated by regexec */
-int string_match_regexp(char * txt, char * rexp, \
-                       int size, regmatch_t matches[], \
-                       int cflags, int eflags);
+#ifndef STRING_MATCH_H__
+#define STRING_MATCH_H__
 
 /* remove substring matching REXP from TXT. Destructive! */
 /* for documentation of CFLAGS and EFLAGS see "man regex" */
 /* returns -1 = not found; N = next find pos */
 /* if the match is an empty string (e.g. "x\?"), the find position will
    be increased by 1 */
-int string_remove_match(char * txt, char * rexp, int cflags, int eflags);
+int string_remove_match        (char *txt, char *rexp, int cflags, int eflags);
 
 /* remove all substrings matching REXP from TXT. Destructive! */
 /* for documentation of CFLAGS and EFLAGS see "man regex" */
 /* returns position of last replacement (i.e. TXT has been modified up
    to this position, use this as the starting point for further mangling) */
-int string_remove_all_matches(char * txt, char * rexp, int cflags, int eflags);
+int string_remove_all_matches  (char *txt, char *rexp, int cflags, int eflags);
+
 
+#endif /* STRING_MATCH_H__ */
 
-#endif