svn commit: samba r25042 - in branches/SAMBA_4_0: . source/param

jelmer at samba.org jelmer at samba.org
Sat Sep 8 21:06:59 GMT 2007


Author: jelmer
Date: 2007-09-08 21:06:57 +0000 (Sat, 08 Sep 2007)
New Revision: 25042

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

Log:
Avoid direct references to global loadparm context.
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/param/loadparm.c


Changeset:

Property changes on: branches/SAMBA_4_0
___________________________________________________________________
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/param/loadparm.c
===================================================================
--- branches/SAMBA_4_0/source/param/loadparm.c	2007-09-08 20:49:43 UTC (rev 25041)
+++ branches/SAMBA_4_0/source/param/loadparm.c	2007-09-08 21:06:57 UTC (rev 25042)
@@ -2540,25 +2540,9 @@
 
 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 @@
 			 */
 			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. 
 ********************************************************************/



More information about the samba-cvs mailing list