Author: mimir
Date: 2007-05-08 22:08:26 +0000 (Tue, 08 May 2007)
New Revision: 22764

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=22764

Log:
- replace talloc_zero with composite_create
- use event context provided with libnet context instead of creating
  a new one


rafal


Modified:
   branches/SAMBA_4_0/source/libnet/libnet_lookup.c


Changeset:
Modified: branches/SAMBA_4_0/source/libnet/libnet_lookup.c
===================================================================
--- branches/SAMBA_4_0/source/libnet/libnet_lookup.c    2007-05-08 22:04:28 UTC 
(rev 22763)
+++ branches/SAMBA_4_0/source/libnet/libnet_lookup.c    2007-05-08 22:08:26 UTC 
(rev 22764)
@@ -59,22 +59,14 @@
        const char** methods;
 
        /* allocate context and state structures */
-       c = talloc_zero(NULL, struct composite_context);
+       c = composite_create(ctx, ctx->event_ctx);
        if (c == NULL) return NULL;
 
        s = talloc_zero(c, struct lookup_state);
-       if (s == NULL) {
-               composite_error(c, NT_STATUS_NO_MEMORY);
-               return c;
-       }
-       
-       /* prepare event context */
-       c->event_ctx = event_context_find(c);
-       if (c->event_ctx == NULL) {
-               composite_error(c, NT_STATUS_NO_MEMORY);
-               return c;
-       }
+       if (composite_nomem(s, c)) return c;
 
+       c->private_data = s;
+
        if (io == NULL || io->in.hostname == NULL) {
                composite_error(c, NT_STATUS_INVALID_PARAMETER);
                return c;
@@ -92,14 +84,11 @@
                methods = ctx->name_res_methods;
        }
 
-       c->private_data = s;
-       c->state        = COMPOSITE_STATE_IN_PROGRESS;
-
        /* send resolve request */
        cresolve_req = resolve_name_send(&s->hostname, c->event_ctx, methods);
+       if (composite_nomem(cresolve_req, c)) return c;
 
        composite_continue(c, cresolve_req, continue_name_resolved, c);
-
        return c;
 }
 

Reply via email to