Rev 12125: Avoid use of typedefs, in Samba 4 style. in file:///home/jelmer/bzr.samba/SAMBA_4_0/

Jelmer Vernooij jelmer at samba.org
Wed May 9 10:52:53 GMT 2007


At file:///home/jelmer/bzr.samba/SAMBA_4_0/

------------------------------------------------------------
revno: 12125
revision-id: jelmer at samba.org-20070509105243-c8umb0w5w1d1ogsj
parent: jelmer at samba.org-20070509104652-bkzgo0ludqq6ycj2
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: SAMBA_4_0
timestamp: Wed 2007-05-09 12:52:43 +0200
message:
  Avoid use of typedefs, in Samba 4 style.
modified:
  source/param/loadparm.c        svn-v2:2 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-trunk-source%2fparam%2floadparm.c
=== modified file 'source/param/loadparm.c'
--- a/source/param/loadparm.c	2007-05-09 10:46:52 +0000
+++ b/source/param/loadparm.c	2007-05-09 10:52:43 +0000
@@ -88,7 +88,7 @@
 /* 
  * This structure describes global (ie., server-wide) parameters.
  */
-typedef struct
+struct global
 {
 	int server_role;
 
@@ -189,15 +189,14 @@
 	int bDisableNetbios;
 	int bRpcBigEndian;
 	struct param_opt *param_opt;
-}
-global;
+};
 
-static global Globals;
+static struct global Globals;
 
 /* 
  * This structure describes a single service. 
  */
-typedef struct
+struct service
 {
 	int valid;
 	char *szService;
@@ -229,13 +228,12 @@
 	struct param_opt *param_opt;
 
 	char dummy[3];		/* for alignment */
-}
-service;
+};
 
 
 /* This is a default service used to prime a services structure */
-static service sDefault = {
-	True,			/* valid */
+static struct service sDefault = {
+	true,			/* valid */
 	NULL,			/* szService */
 	NULL,			/* szPath */
 	NULL,			/* szCopy */
@@ -250,14 +248,14 @@
 	1000,			/* iMaxPrintJobs */
 	0,			/* iMaxConnections */
 	0,			/* iCSCPolicy */
-	True,			/* bAvailable */
-	True,			/* bBrowseable */
-	True,			/* bRead_only */
+	true,			/* bAvailable */
+	true,			/* bBrowseable */
+	true,			/* bRead_only */
 	false,			/* bPrint_ok */
 	false,			/* bMap_system */
 	false,			/* bMap_hidden */
-	True,			/* bMap_archive */
-	True,			/* bStrictLocking */
+	true,			/* bMap_archive */
+	true,			/* bStrictLocking */
 	NULL,			/* copymap */
 	false,			/* bMSDfsRoot */
 	false,			/* bStrictSync */
@@ -273,7 +271,7 @@
 
 struct loadparm_context {
 	int iNumServices;
-	service **ServicePtrs;
+	struct service **ServicePtrs;
 	
 	/* Files used by this loadparm context */
 	struct file_lists {
@@ -955,13 +953,13 @@
 static int map_parameter(const char *pszParmName);
 static int getservicebyname(struct loadparm_context *ctx, 
 							const char *pszServiceName,
-							service * pserviceDest);
-static void copy_service(service * pserviceDest,
-			 service * pserviceSource, int *pcopymapDest);
+							struct service * pserviceDest);
+static void copy_service(struct service * pserviceDest,
+			 struct service * pserviceSource, int *pcopymapDest);
 static BOOL service_ok(struct loadparm_context *ctx, int iService);
 static BOOL parse_section(const char *pszSectionName, void *);
 static BOOL parse_parameter(const char *, const char *, void *);
-static void init_copymap(service * pservice);
+static void init_copymap(struct service * pservice);
 
 /* This is a helper function for parametrical options support. */
 /* It returns a pointer to parametrical option value if it exists or NULL otherwise */
@@ -1157,9 +1155,9 @@
  Initialise a service to the defaults.
 ***************************************************************************/
 
-static void init_service(service * pservice)
+static void init_service(struct service * pservice)
 {
-	memset((char *)pservice, '\0', sizeof(service));
+	ZERO_STRUCTP(pservice);
 	copy_service(pservice, &sDefault, NULL);
 }
 
@@ -1167,7 +1165,7 @@
  Free the dynamically allocated parts of a service struct.
 ***************************************************************************/
 
-static void free_service(service *pservice)
+static void free_service(struct service *pservice)
 {
 	int i;
         struct param_opt *data, *pdata;
@@ -1217,10 +1215,10 @@
 ***************************************************************************/
 
 static int add_a_service(struct loadparm_context *ctx, 
-						 const service *pservice, const char *name)
+						 const struct service *pservice, const char *name)
 {
 	int i;
-	service tservice;
+	struct service tservice;
 	int num_to_alloc = ctx->iNumServices + 1;
 	struct param_opt *data, *pdata;
 
@@ -1252,9 +1250,9 @@
 
 	/* if not, then create one */
 	if (i == ctx->iNumServices) {
-		service **tsp;
+		struct service **tsp;
 		
-		tsp = realloc_p(ctx->ServicePtrs, service *,	num_to_alloc);
+		tsp = realloc_p(ctx->ServicePtrs, struct service *,	num_to_alloc);
 					   
 		if (!tsp) {
 			DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
@@ -1262,7 +1260,7 @@
 		}
 		else {
 			ctx->ServicePtrs = tsp;
-			ctx->ServicePtrs[ctx->iNumServices] = malloc_p(service);
+			ctx->ServicePtrs[ctx->iNumServices] = malloc_p(struct service);
 		}
 		if (!ctx->ServicePtrs[ctx->iNumServices]) {
 			DEBUG(0,("add_a_service: out of memory!\n"));
@@ -1453,7 +1451,8 @@
 ***************************************************************************/
 
 static int getservicebyname(struct loadparm_context *ctx, 
-							const char *pszServiceName, service * pserviceDest)
+							const char *pszServiceName, 
+							struct service * pserviceDest)
 {
 	int iService;
 
@@ -1473,7 +1472,8 @@
  If pcopymapDest is NULL then copy all fields
 ***************************************************************************/
 
-static void copy_service(service * pserviceDest, service * pserviceSource, int *pcopymapDest)
+static void copy_service(struct service * pserviceDest, 
+						 struct service * pserviceSource, int *pcopymapDest)
 {
 	int i;
 	BOOL bcopyall = (pcopymapDest == NULL);
@@ -1699,7 +1699,7 @@
 {
 	BOOL bRetval;
 	int iTemp;
-	service serviceTemp;
+	struct service serviceTemp;
 
 	string_set(ptr, pszParmValue);
 
@@ -1731,7 +1731,7 @@
  Initialise a copymap.
 ***************************************************************************/
 
-static void init_copymap(service *pservice)
+static void init_copymap(struct service *pservice)
 {
 	int i;
 	SAFE_FREE(pservice->copymap);
@@ -2262,7 +2262,7 @@
  Display the contents of a single services record.
 ***************************************************************************/
 
-static void dump_a_service(service * pService, FILE * f)
+static void dump_a_service(struct service * pService, FILE * f)
 {
 	int i;
 	struct param_opt *data;
@@ -2306,7 +2306,7 @@
 BOOL lp_dump_a_parameter(struct loadparm_context *ctx, 
 						 int snum, char *parm_name, FILE * f, BOOL isGlobal)
 {
-	service * pService = ctx->ServicePtrs[snum];
+	struct service * pService = ctx->ServicePtrs[snum];
 	struct parm_struct *parm;
 	void *ptr;
 	
@@ -2353,7 +2353,7 @@
 			return &parm_table[(*i)++];
 		}
 	} else {
-		service *pService = ctx->ServicePtrs[snum];
+		struct service *pService = ctx->ServicePtrs[snum];
 
 		for (; parm_table[*i].label; (*i)++) {
 			if (parm_table[*i].class == P_SEPARATOR)



More information about the samba-cvs mailing list