+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
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
*/
#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;
}
}
-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;
}
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;
+}
+
* 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