svn commit: samba r15055 - in
branches/SAMBA_4_0/source/lib/messaging: .
metze at samba.org
metze at samba.org
Wed Apr 12 15:52:17 GMT 2006
Author: metze
Date: 2006-04-12 15:52:17 +0000 (Wed, 12 Apr 2006)
New Revision: 15055
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15055
Log:
this was my version for the crash bug in the messaging code...
it also makes the function a bit shorter and clearer,
as the tmp msg_types only have one handler and not a list
metze
Modified:
branches/SAMBA_4_0/source/lib/messaging/messaging.c
Changeset:
Modified: branches/SAMBA_4_0/source/lib/messaging/messaging.c
===================================================================
--- branches/SAMBA_4_0/source/lib/messaging/messaging.c 2006-04-12 14:11:51 UTC (rev 15054)
+++ branches/SAMBA_4_0/source/lib/messaging/messaging.c 2006-04-12 15:52:17 UTC (rev 15055)
@@ -299,8 +299,7 @@
msg->num_types = msg_type+1;
}
-
- d = talloc(msg->dispatch, struct dispatch_fn);
+ d = talloc_zero(msg->dispatch, struct dispatch_fn);
NT_STATUS_HAVE_NO_MEMORY(d);
d->msg_type = msg_type;
d->private = private;
@@ -343,37 +342,25 @@
*/
void messaging_deregister(struct messaging_context *msg, uint32_t msg_type, void *private)
{
- struct dispatch_fn *d, *list, *next;
+ struct dispatch_fn *d, *next;
if (msg_type >= msg->num_types) {
- list = idr_find(msg->dispatch_tree, msg_type);
- } else {
- list = msg->dispatch[msg_type];
- }
-
- if (list == NULL) {
+ d = idr_find(msg->dispatch_tree, msg_type);
+ if (!d) return;
+ idr_remove(msg->dispatch_tree, msg_type);
+ talloc_free(d);
return;
}
- for (d = list; d; d = next) {
+ for (d = msg->dispatch[msg_type]; d; d = next) {
next = d->next;
if (d->private == private) {
- DLIST_REMOVE(list, d);
+ DLIST_REMOVE(msg->dispatch[msg_type], d);
talloc_free(d);
}
- }
-
- /* the list base possibly changed */
- if (msg_type >= msg->num_types) {
- if (list == NULL) {
- idr_remove(msg->dispatch_tree, msg_type);
- }
- } else {
- msg->dispatch[msg_type] = list;
}
}
-
/*
Send a message to a particular server
*/
More information about the samba-cvs
mailing list