Hopefully fix building when HAVE_REGCOMP is not defined.

Add debug message when trying to parse an error regex when
HAVE_REGCOMP is undefined.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2992 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2008-09-25 10:30:46 +00:00
parent bee27a12d1
commit 80538bb116
2 changed files with 14 additions and 0 deletions

View File

@ -1,3 +1,11 @@
2008-09-25 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/filetypes.c:
Hopefully fix building when HAVE_REGCOMP is not defined.
Add debug message when trying to parse an error regex when
HAVE_REGCOMP is undefined.
2008-09-24 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> 2008-09-24 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/main.h, src/about.c, src/main.c, src/socket.c: * src/main.h, src/about.c, src/main.c, src/socket.c:

View File

@ -55,8 +55,10 @@ typedef struct GeanyFiletypePrivate
{ {
GtkWidget *menu_item; /* holds a pointer to the menu item for this filetype */ GtkWidget *menu_item; /* holds a pointer to the menu item for this filetype */
gboolean keyfile_loaded; gboolean keyfile_loaded;
#ifdef HAVE_REGCOMP
regex_t error_regex; regex_t error_regex;
gboolean error_regex_compiled; gboolean error_regex_compiled;
#endif
} }
GeanyFiletypePrivate; GeanyFiletypePrivate;
@ -852,11 +854,13 @@ static void set_error_regex(GeanyFiletype *ft, gchar *string)
{ {
setptr(ft->error_regex_string, string); setptr(ft->error_regex_string, string);
#ifdef HAVE_REGCOMP
if (ft->priv->error_regex_compiled) if (ft->priv->error_regex_compiled)
regfree(&ft->priv->error_regex); regfree(&ft->priv->error_regex);
ft->priv->error_regex_compiled = FALSE; ft->priv->error_regex_compiled = FALSE;
/* regex will be compiled when needed */ /* regex will be compiled when needed */
#endif
} }
@ -1208,6 +1212,8 @@ gboolean filetypes_parse_error_message(GeanyFiletype *ft, const gchar *message,
gchar **filename, gint *line) gchar **filename, gint *line)
{ {
#ifndef HAVE_REGCOMP #ifndef HAVE_REGCOMP
if (!NZV(ft->error_regex_string))
geany_debug("No regex support - maybe you should configure with --enable-gnu-regex!");
return FALSE; return FALSE;
#else #else
regex_t *regex = &ft->priv->error_regex; regex_t *regex = &ft->priv->error_regex;