gmime r1521 - in trunk: . gmime



Author: fejj
Date: Tue Mar 31 01:14:59 2009
New Revision: 1521
URL: http://svn.gnome.org/viewvc/gmime?rev=1521&view=rev

Log:
2009-03-30  Jeffrey Stedfast  <fejj novell com>

	* configure.in: Check for regex.h

	* gmime/gmime-parser.c: #ifdef out the regex functionality if the
	system does not have regex.h



Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/gmime/gmime-parser.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Tue Mar 31 01:14:59 2009
@@ -91,6 +91,7 @@
 AC_CHECK_HEADERS(string.h)
 AC_CHECK_HEADERS(stdlib.h)
 AC_CHECK_HEADERS(netdb.h)
+AC_CHECK_HEADERS(regex.h)
 AC_CHECK_HEADERS(ctype.h)
 AC_CHECK_HEADERS(time.h)
 AC_CHECK_HEADERS(poll.h)

Modified: trunk/gmime/gmime-parser.c
==============================================================================
--- trunk/gmime/gmime-parser.c	(original)
+++ trunk/gmime/gmime-parser.c	Tue Mar 31 01:14:59 2009
@@ -26,7 +26,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
+#ifdef HAVE_REGEX_H
 #include <regex.h>
+#endif
 
 #include "gmime-parser.h"
 
@@ -127,9 +129,11 @@
 	gint64 from_offset;
 	GByteArray *from_line;
 	
+#ifdef HAVE_REGEX_H
 	regex_t header_regex;
 	GMimeParserHeaderRegexFunc header_cb;
 	gpointer user_data;
+#endif
 	
 	/* header buffer */
 	char *headerbuf;
@@ -302,8 +306,10 @@
 	
 	parser_close (parser);
 	
+#ifdef HAVE_REGEX_H
 	if (parser->priv->have_regex)
 		regfree (&parser->priv->header_regex);
+#endif
 	
 	g_free (parser->priv);
 	
@@ -576,6 +582,7 @@
 g_mime_parser_set_header_regex (GMimeParser *parser, const char *regex,
 				GMimeParserHeaderRegexFunc header_cb, gpointer user_data)
 {
+#if HAVE_REGEX_H
 	struct _GMimeParserPrivate *priv;
 	
 	g_return_if_fail (GMIME_IS_PARSER (parser));
@@ -594,6 +601,7 @@
 	priv->user_data = user_data;
 	
 	priv->have_regex = !regcomp (&priv->header_regex, regex, REG_EXTENDED | REG_ICASE | REG_NOSUB);
+#endif
 }
 
 
@@ -893,10 +901,12 @@
 	priv->headerleft += priv->headerptr - priv->headerbuf;
 	priv->headerptr = priv->headerbuf;
 	
+#ifdef HAVE_REGEX_H
 	if (priv->have_regex &&
 	    !regexec (&priv->header_regex, header->name, 0, NULL, 0))
 		priv->header_cb (parser, header->name, header->value,
 				 header->offset, priv->user_data);
+#endif
 }
 
 static int



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