s3:loadparm: add lp_local_ptr() that operates on a service struct
authorMichael Adam <obnox@samba.org>
Mon, 15 Dec 2008 13:20:16 +0000 (14:20 +0100)
committerMichael Adam <obnox@samba.org>
Mon, 15 Dec 2008 13:20:16 +0000 (14:20 +0100)
and use this in lp_local_ptr_by_snum().

Michael

source3/param/loadparm.c

index 3600266310aae3d7dda3e9c11f064ad3764207d7..43fd9d9d3a3cc065b1246863339052be25d35e0a 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"},
@@ -7166,6 +7168,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 +7185,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);
 }
 
 /***************************************************************************