version 1.81 | | version 1.82 |
---|
| | |
/* | | /* |
* static char *rcsid_object_c = | | * static char *rcsid_object_c = |
* "$Id: object.c,v 1.81 2004/02/09 05:36:12 mwedel Exp $"; | | * "$Id: object.c,v 1.82 2004/02/11 07:40:17 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
event *evt; | | event *evt; |
event *evt2; | | event *evt2; |
| | |
| | /* redo this to be simpler/more efficient. Was also seeing |
| | * crashes in the old code. Move this to the top - am |
| | * seeing periodic crashes in this code, and would like to have |
| | * as much info available as possible (eg, object name). |
| | */ |
| | for (evt = op->events; evt; evt=evt2) { |
| | evt2 = evt->next; |
| | |
| | if (evt->hook != NULL) FREE_AND_CLEAR_STR(evt->hook); |
| | if (evt->plugin != NULL) FREE_AND_CLEAR_STR(evt->plugin); |
| | if (evt->options != NULL) FREE_AND_CLEAR_STR(evt->options); |
| | |
| | free(evt); |
| | } |
| | op->events = NULL; |
| | |
| | |
/* the memset will clear all these values for us, but we need | | /* the memset will clear all these values for us, but we need |
* to reduce the refcount on them. | | * to reduce the refcount on them. |
*/ | | */ |
| | |
if (op->lore!=NULL) FREE_AND_CLEAR_STR(op->lore); | | if (op->lore!=NULL) FREE_AND_CLEAR_STR(op->lore); |
if (op->materialname!= NULL) FREE_AND_CLEAR_STR(op->materialname); | | if (op->materialname!= NULL) FREE_AND_CLEAR_STR(op->materialname); |
| | |
/* Clean the events list */ | | |
while (op->events != NULL) | | |
{ | | |
evt2 = NULL; | | |
evt = op->events; | | |
while (evt->next != NULL) | | |
{ | | |
evt2 = evt; | | |
evt = evt->next; | | |
| | |
} | | |
| | |
if (evt->hook != NULL) FREE_AND_CLEAR_STR(evt->hook); | | |
if (evt->plugin != NULL) FREE_AND_CLEAR_STR(evt->plugin); | | |
if (evt->options != NULL) FREE_AND_CLEAR_STR(evt->options); | | |
| | |
FREE_AND_CLEAR(evt); | | |
| | |
if (evt2 != NULL) | | |
evt2->next = NULL; | | |
else | | |
op->events = NULL; | | |
} | | |
| | |
| | |
memset((void*)((char*)op + offsetof(object, name)), | | memset((void*)((char*)op + offsetof(object, name)), |
0, sizeof(object)-offsetof(object, name)); | | 0, sizeof(object)-offsetof(object, name)); |