diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-09-08 21:06:57 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 15:05:46 -0500 |
commit | e44d8bc87fbf4277fbd797f65de7842133fbe1e5 (patch) | |
tree | 242a558e03d56ca81d2be8bd8e8493f971804688 | |
parent | 46d16c0131f69f320f58a2e074d7623f23311e1e (diff) | |
download | samba-e44d8bc87fbf4277fbd797f65de7842133fbe1e5.tar.gz samba-e44d8bc87fbf4277fbd797f65de7842133fbe1e5.tar.bz2 samba-e44d8bc87fbf4277fbd797f65de7842133fbe1e5.zip |
r25042: Avoid direct references to global loadparm context.
(This used to be commit 256532ab4b772c5c38bc7ced21408f3ed42fe6b5)
-rw-r--r-- | source4/param/loadparm.c | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c index 6c3dee239b..2dbf7cd60a 100644 --- a/source4/param/loadparm.c +++ b/source4/param/loadparm.c @@ -2540,25 +2540,9 @@ struct loadparm_service *lp_servicebynum(int snum) struct loadparm_service *lp_service(const char *service_name) { - int snum = lp_servicenumber(service_name); - if (snum < 0) - return NULL; - return loadparm.ServicePtrs[snum]; -} - -/*************************************************************************** -Return the number of the service with the given name, or -1 if it doesn't -exist. Note that this is a DIFFERENT ANIMAL from the internal function -getservicebyname()! This works ONLY if all services have been loaded, and -does not copy the found service. -***************************************************************************/ - -int lp_servicenumber(const char *pszServiceName) -{ int iService; char *serviceName; - for (iService = loadparm.iNumServices - 1; iService >= 0; iService--) { if (loadparm.ServicePtrs[iService] && loadparm.ServicePtrs[iService]->szService) { @@ -2568,17 +2552,16 @@ int lp_servicenumber(const char *pszServiceName) */ serviceName = standard_sub_basic(loadparm.ServicePtrs[iService], loadparm.ServicePtrs[iService]->szService); - if (strequal(serviceName, pszServiceName)) - break; + if (strequal(serviceName, service_name)) + return loadparm.ServicePtrs[iService]; } } - if (iService < 0) - DEBUG(7,("lp_servicenumber: couldn't find %s\n", pszServiceName)); - - return iService; + DEBUG(7,("lp_servicenumber: couldn't find %s\n", service_name)); + return NULL; } + /******************************************************************* A useful volume label function. ********************************************************************/ |