summaryrefslogtreecommitdiff
path: root/src/ivybind.c
diff options
context:
space:
mode:
authorfcolin2008-06-23 12:57:35 +0000
committerfcolin2008-06-23 12:57:35 +0000
commitf4c5e0df26399eb354fb909aef19045645007715 (patch)
tree8a179e8780051e84f82169765502fdd50b0bb95c /src/ivybind.c
parentc8fa99ae894adf2643c9cf44b570a39931d5d1ee (diff)
downloadivy-c-f4c5e0df26399eb354fb909aef19045645007715.zip
ivy-c-f4c5e0df26399eb354fb909aef19045645007715.tar.gz
ivy-c-f4c5e0df26399eb354fb909aef19045645007715.tar.bz2
ivy-c-f4c5e0df26399eb354fb909aef19045645007715.tar.xz
Mise a jour pour compilation MinGW
Diffstat (limited to 'src/ivybind.c')
-rw-r--r--src/ivybind.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/ivybind.c b/src/ivybind.c
index 60be1ba..d9bebb2 100644
--- a/src/ivybind.c
+++ b/src/ivybind.c
@@ -24,8 +24,10 @@
#include <stdarg.h>
#ifdef WIN32
+#ifndef __MINGW32__
#include <crtdbg.h>
#endif
+#endif
#ifdef USE_PCRE_REGEX
@@ -105,9 +107,13 @@ IvyBinding IvyBindingCompile( const char * expression, int *erroffset, const ch
if ( reg == 0 )
{
bind = (IvyBinding)malloc( sizeof( struct _binding ));
+ if ( ! bind )
+ {
+ perror( "IvyBindingCompile malloc error: ");
+ exit(-1);
+ }
memset( bind, 0, sizeof(*bind ) );
bind->regexp = regexp;
- bind->next = NULL;
}
else
{
@@ -132,7 +138,7 @@ void IvyBindingFree( IvyBinding bind )
pcre_free(bind->inspect);
pcre_free(bind->regexp);
#else /* we don't USE_PCRE_REGEX */
- free( bind->regexp );
+ regfree( &bind->regexp );
#endif /* USE_PCRE_REGEX */
free ( bind );
}
@@ -155,15 +161,18 @@ int IvyBindingExec( IvyBinding bind, const char * message )
if (nb_match<1) return 0; /* no match */
bind->nb_match = nb_match;
#else /* we don't USE_PCRE_REGEX */
+ {
+ int index;
memset( bind->match, -1, sizeof(bind->match )); /* work around bug !!!*/
- nb_match = regexec (&bind->regexp, message, MAX_MSG_FIELDS, bind->match, 0)
+ nb_match = regexec (&bind->regexp, message, MAX_MSG_FIELDS, bind->match, 0);
if (nb_match == REG_NOMATCH)
return 0;
- for ( index = 1; index < MAX_MSG_FIELDS; index++ )
+ for (index = 1; index < MAX_MSG_FIELDS; index++ )
{
- if ( bind->match[i].rm_so != -1 )
+ if ( bind->match[index].rm_so != -1 )
nb_match++;
}
+ }
#endif /* USE_PCRE_REGEX */
return nb_match;
}