s3:loadparm: rename free_parameter() to free_one_parameter_by_snum()
[ira/wip.git] / source3 / param / loadparm.c
index 3600266310aae3d7dda3e9c11f064ad3764207d7..580136446ba68a4a7e3225ec4fa8f38689233a6e 100644 (file)
@@ -671,6 +671,8 @@ static void set_server_role(void);
 static void set_default_server_announce_type(void);
 static void set_allowed_client_auth(void);
 
+static void *lp_local_ptr(struct service *service, void *ptr);
+
 static const struct enum_list enum_protocol[] = {
        {PROTOCOL_NT1, "NT1"},
        {PROTOCOL_LANMAN2, "LANMAN2"},
@@ -4583,10 +4585,12 @@ static void init_printer_values(struct service *pService)
        }
 }
 
+
 /**
- * Free the allocated data for one parameter for a given share.
+ * Free the allocated data for one parameter for a given share
+ * specified by an snum.
  */
-static void free_parameter(int snum, struct parm_struct parm)
+static void free_one_parameter_by_snum(int snum, struct parm_struct parm)
 {
        void *parm_ptr;
 
@@ -4619,7 +4623,7 @@ static void free_parameters(int snum)
        uint32_t i;
 
        for (i=0; parm_table[i].label; i++) {
-               free_parameter(snum, parm_table[i]);
+               free_one_parameter_by_snum(snum, parm_table[i]);
        }
 }
 
@@ -7166,6 +7170,16 @@ static void init_copymap(struct service *pservice)
                        bitmap_set(pservice->copymap, i);
 }
 
+/***************************************************************************
+ Return the local pointer to a parameter given a service struct and the
+ pointer into the default structure.
+***************************************************************************/
+
+static void *lp_local_ptr(struct service *service, void *ptr)
+{
+       return (void *)(((char *)service) + PTR_DIFF(ptr, &sDefault));
+}
+
 /***************************************************************************
  Return the local pointer to a parameter given the service number and the 
  pointer into the default structure.
@@ -7173,7 +7187,7 @@ static void init_copymap(struct service *pservice)
 
 void *lp_local_ptr_by_snum(int snum, void *ptr)
 {
-       return (void *)(((char *)ServicePtrs[snum]) + PTR_DIFF(ptr, &sDefault));
+       return lp_local_ptr(ServicePtrs[snum], ptr);
 }
 
 /***************************************************************************