From 4c7e06e752b45344246bb912e80052b2c2743394 Mon Sep 17 00:00:00 2001 From: axel Date: Mon, 29 May 2006 23:12:17 +1000 Subject: [PATCH] Add missing event trigger when non-universal variable is erased darcs-hash:20060529131217-ac50b-feb2034230297d9edc120369d8f3c1cfff6acfcd.gz --- env.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/env.c b/env.c index ba7ec5d22..39cd5a4ba 100644 --- a/env.c +++ b/env.c @@ -797,6 +797,7 @@ int env_set( const wchar_t *key, al_init( &ev.arguments ); al_push( &ev.arguments, L"VARIABLE" ); + al_push( &ev.arguments, L"SET" ); al_push( &ev.arguments, key ); // debug( 1, L"env_set: fire events on variable %ls", key ); @@ -817,6 +818,8 @@ int env_set( const wchar_t *key, /** Attempt to remove/free the specified key/value pair from the specified hash table. + + \return zero if the variable was not found, non-zero otherwise */ static int try_remove( env_node_t *n, const wchar_t *key ) @@ -862,7 +865,22 @@ void env_remove( const wchar_t *key, int var_mode ) return; } - if( !try_remove( top, key ) ) + if( try_remove( top, key ) ) + { + event_t ev; + + ev.type=EVENT_VARIABLE; + ev.param1.variable=key; + ev.function_name=0; + + al_init( &ev.arguments ); + al_push( &ev.arguments, L"VARIABLE" ); + al_push( &ev.arguments, L"ERASE" ); + al_push( &ev.arguments, key ); + event_fire( &ev ); + al_destroy( &ev.arguments ); + } + else { env_universal_remove( key ); }