Author: mimir
Date: 2005-11-20 21:33:30 +0000 (Sun, 20 Nov 2005)
New Revision: 11813

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

Log:
Const-ify name resolution method list and use string list
utilities to set the context field.


rafal


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


Changeset:
Modified: branches/SAMBA_4_0/source/libnet/libnet.c
===================================================================
--- branches/SAMBA_4_0/source/libnet/libnet.c   2005-11-20 17:34:56 UTC (rev 
11812)
+++ branches/SAMBA_4_0/source/libnet/libnet.c   2005-11-20 21:33:30 UTC (rev 
11813)
@@ -26,7 +26,6 @@
 {
        /* default name resolution methods */
        const char *nr_methods[] = { "lmhosts", "wins", "host", "bcast", NULL };
-       int nr_count = 0, nr_i;
 
        struct libnet_context *ctx;
 
@@ -46,15 +45,7 @@
        }
        ctx->event_ctx = ev;
 
-       /* count name resolution methods */
-       while (nr_methods[nr_count]) nr_count++;
-
-       /* assign name resolution methods */
-       ctx->name_res_methods = talloc_array(ctx, char*, nr_count+1);
-       for (nr_i = 0; nr_i < nr_count; nr_i++) {
-               ctx->name_res_methods[nr_i] = talloc_strdup(ctx, 
nr_methods[nr_i]);
-       }
-       ctx->name_res_methods[nr_i] = NULL;
+       ctx->name_res_methods = str_list_copy(ctx, nr_methods);
        
        return ctx;
 }

Modified: branches/SAMBA_4_0/source/libnet/libnet.h
===================================================================
--- branches/SAMBA_4_0/source/libnet/libnet.h   2005-11-20 17:34:56 UTC (rev 
11812)
+++ branches/SAMBA_4_0/source/libnet/libnet.h   2005-11-20 21:33:30 UTC (rev 
11813)
@@ -33,7 +33,7 @@
        struct policy_handle user_handle;
 
        /* name resolution methods */
-       char **name_res_methods;
+       const char **name_res_methods;
 
        struct event_context *event_ctx;
 };

Reply via email to