[NeoStats-Devel] [Commits] r2657 - trunk/src
[email protected] Fri, 8 Jul 2005 23:23:49 +1000
Newsgroups
gmane.comp.neostats.devel
Message-ID
<[email protected] >
Author: Fish
Date: Fri Jul 8 21:23:41 2005
New Revision: 2657
Modified:
trunk/src/NeoStats.pm
trunk/src/confuse.c
trunk/src/perl.c
Log:
unhook events
Modified: trunk/src/NeoStats.pm
==============================================================================
--- trunk/src/NeoStats.pm (original)
+++ trunk/src/NeoStats.pm Fri Jul 8 21:23:41 2005
@@ -535,7 +535,7 @@
if( exists $pkg_info->{hooks} ) {
for my $hook ( @{$pkg_info->{hooks}} ) {
- NeoStats::unhook( $hook, $package );
+ NeoStats::Internal::unhook_event( $hook );
}
}
Modified: trunk/src/confuse.c
==============================================================================
--- trunk/src/confuse.c (original)
+++ trunk/src/confuse.c Fri Jul 8 21:23:41 2005
@@ -22,7 +22,6 @@
#include "neostats.h"
#ifdef HAVE_STRING_H
-#define _GNU_SOURCE /* FIXME! */
#include <string.h>
#endif
#ifdef HAVE_PWD_H
Modified: trunk/src/perl.c
==============================================================================
--- trunk/src/perl.c (original)
+++ trunk/src/perl.c Fri Jul 8 21:23:41 2005
@@ -116,7 +116,6 @@
int
perl_event_cb(Event evt, CmdParams *cmdparams, Module *mod_ptr) {
int ret = NS_FAILURE;
-printf("Event %d Module %s\n", evt, mod_ptr->info->name);
switch (evt) {
case EVENT_NULL:
nlog(LOG_WARNING, "Ehhh, PerlModule got callback for EVENT_NULL?");
@@ -573,6 +572,27 @@
}
}
+static
+XS (XS_NeoStats_unhook_event)
+{
+ Module *mod;
+ Event evt = -1;
+ dXSARGS;
+ mod = GET_CUR_MODULE();
+ if (items != 1) {
+ nlog(LOG_WARNING, "Usage: NeoStats:Internal:unhook_event(hook)");
+ } else {
+ evt = (int) SvIV (ST(0));
+ if (mod->event_list && mod->event_list[evt]->pe) {
+ SvREFCNT_dec(mod->event_list[evt]->pe->callback);
+ SvREFCNT_dec(mod->event_list[evt]->pe->userdata);
+ ns_free(mod->event_list[evt]->pe);
+ ns_free(mod->event_list[evt]);
+ }
+ DeleteEvent(evt);
+ }
+ XSRETURN_EMPTY;
+}
@@ -897,6 +917,7 @@
newXS ("NeoStats::Internal::debug", XS_NeoStats_debug, __FILE__);
newXS ("NeoStats::Internal::register", XS_NeoStats_register, __FILE__);
newXS ("NeoStats::Internal::hook_event", XS_NeoStats_hook_event, __FILE__);
+ newXS ("NeoStats::Internal::unhook_event", XS_NeoStats_unhook_event, __FILE__);
stash = get_hv ("NeoStats::", TRUE);
if (stash == NULL) {
exit (1);