From 6244194265f7f1027c16664b2701ce114435a59b Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 15 Dec 2008 14:20:16 +0100 Subject: s3:loadparm: add lp_local_ptr() that operates on a service struct and use this in lp_local_ptr_by_snum(). Michael --- source3/param/loadparm.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'source3/param') diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 3600266310..43fd9d9d3a 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -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); } /*************************************************************************** -- cgit