summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfcolin2009-11-09 10:25:50 +0000
committerfcolin2009-11-09 10:25:50 +0000
commitf33cc936d56a5a004f9c9a40a6ff73a7635aca45 (patch)
treeede0747155b1931b10b61a1b3dea008c2715af65 /src
parent39a17f46065f26c1056a9cb4e3f9a6fdf18bba41 (diff)
downloadivy-c-f33cc936d56a5a004f9c9a40a6ff73a7635aca45.zip
ivy-c-f33cc936d56a5a004f9c9a40a6ff73a7635aca45.tar.gz
ivy-c-f33cc936d56a5a004f9c9a40a6ff73a7635aca45.tar.bz2
ivy-c-f33cc936d56a5a004f9c9a40a6ff73a7635aca45.tar.xz
coorection plantage si erreur de compile exp reguliere
Diffstat (limited to 'src')
-rw-r--r--src/ivy.c6
-rw-r--r--src/ivybind.c3
2 files changed, 7 insertions, 2 deletions
diff --git a/src/ivy.c b/src/ivy.c
index 07e84a4..a702420 100644
--- a/src/ivy.c
+++ b/src/ivy.c
@@ -1560,6 +1560,7 @@ static void addRegexpToDictionary (const char* regexp, IvyClientPtr client)
{
MsgSndDictPtr msgSendDict = NULL;
RWIvyClientPtr newClient = NULL;
+ static char errorbuffer[1024];
/* on cherche si une entrée existe deja pour cette regexp source */
HASH_FIND_STR(messSndByRegexp, regexp, msgSendDict);
/* l'entree n'existe pas dans le dictionnaire : on la cree */
@@ -1572,8 +1573,9 @@ static void addRegexpToDictionary (const char* regexp, IvyClientPtr client)
msgSendDict->binding = IvyBindingCompile(regexp, & erroffset, & errbuf );
if (msgSendDict->binding == NULL ) {
- printf("Error compiling '%s', %s\n", regexp, errbuf);
- MsgSendTo(client, Error, erroffset, errbuf );
+ sprintf( errorbuffer, "Error compiling '%s', %s", regexp, errbuf);
+ printf("%s\n", errorbuffer);
+ MsgSendTo(client, Error, erroffset, errorbuffer );
}
msgSendDict->clientList = NULL;
diff --git a/src/ivybind.c b/src/ivybind.c
index 1886d03..d433d1a 100644
--- a/src/ivybind.c
+++ b/src/ivybind.c
@@ -140,6 +140,7 @@ void IvyBindingFree( IvyBinding bind )
/* if ((called %1000) == 0) { */
/* printf ("DBG> IvyBindingFree called =%d\n", called); */
/* } */
+ if( bind == NULL ) return;
#ifdef USE_PCRE_REGEX
if ( bind->ovector != NULL )
free( bind->ovector );
@@ -157,6 +158,7 @@ void IvyBindingFree( IvyBinding bind )
int IvyBindingExec( IvyBinding bind, const char * message )
{
int nb_match = 0;
+ if( bind == NULL ) return nb_match;
#ifdef USE_PCRE_REGEX
nb_match = pcre_exec(
@@ -189,6 +191,7 @@ int IvyBindingExec( IvyBinding bind, const char * message )
void IvyBindingMatch( IvyBinding bind, const char *message, int argnum, int *arglen, const char **arg)
{
+ if( bind == NULL ) return;
#ifdef USE_PCRE_REGEX
*arglen = bind->ovector[2*argnum+1]- bind->ovector[2*argnum];