Chris Browne cbbrowne at lists.slony.info
Wed Apr 18 14:20:24 PDT 2007
Update of /home/cvsd/slony1/slony1-engine/src/backend
In directory main.slony.info:/tmp/cvs-serv26983

Modified Files:
	Makefile slony1_funcs.c 
Log Message:
Typing changes based on recommendations by splint (splint.org)

- slon_quote_identifier() becomes a static function
- xcnt transforms from int to uint32
- added a number of annotations (C comments) to diminish # of warnings


Index: slony1_funcs.c
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -C2 -d -r1.58 -r1.59
*** slony1_funcs.c	18 Apr 2007 15:03:51 -0000	1.58
--- slony1_funcs.c	18 Apr 2007 21:20:22 -0000	1.59
***************
*** 36,39 ****
--- 36,42 ----
  #include <signal.h>
  #include <errno.h>
+ /*@+matchanyintegral@*/
+ /*@-compmempass@*/
+ /*@-immediatetrans@*/
  
  #ifdef PG_MODULE_MAGIC
***************
*** 73,77 ****
  Datum		_slon_quote_ident(PG_FUNCTION_ARGS);
  
- 
  #ifdef CYGWIN
  extern DLLIMPORT Node *newNodeMacroHolder;
--- 76,79 ----
***************
*** 122,131 ****
  }	Slony_I_ClusterStatus;
  
! 
! static Slony_I_ClusterStatus *clusterStatusList = NULL;
  static Slony_I_ClusterStatus *
  getClusterStatus(Name cluster_name,
  				 int need_plan_mask);
! const char *slon_quote_identifier(const char *ident);
  static char *slon_quote_literal(char *str);
  
--- 124,133 ----
  }	Slony_I_ClusterStatus;
  
! /*@null@*/
! static Slony_I_ClusterStatus *clusterStatusList = NULL;  
  static Slony_I_ClusterStatus *
  getClusterStatus(Name cluster_name,
  				 int need_plan_mask);
! static const char *slon_quote_identifier(const char *ident);
  static char *slon_quote_literal(char *str);
  
***************
*** 143,147 ****
  	size_t		buf_size;
  	int			rc;
! 	int			xcnt;
  	char	   *cp;
  	int			i;
--- 145,149 ----
  	size_t		buf_size;
  	int			rc;
! 	uint32			xcnt;
  	char	   *cp;
  	int			i;
***************
*** 173,179 ****
--- 175,183 ----
  		 * Once per transaction notify on the sl_event relation
  		 */
+ /*@-nullpass@*/
  		if ((rc = SPI_execp(cs->plan_notify_event, NULL, NULL, 0)) < 0)
  			elog(ERROR, "Slony-I: SPI_execp() failed for \"NOTIFY event\"");
  
+ /*@+nullpass@*/
  		cs->currentXid = newXid;
  	}
***************
*** 184,187 ****
--- 188,193 ----
  	 */
  	*(cp = buf) = '\0';
+ 	/*@-nullderef@*/
+ 	/*@-mustfreeonly@*/
  	for (xcnt = 0; xcnt < SerializableSnapshot->xcnt; xcnt++)
  	{
***************
*** 192,199 ****
--- 198,209 ----
  			cp = buf + strlen(buf);
  		}
+ /*@-bufferoverflowhigh@*/
  		sprintf(cp, "%s'%u'", (xcnt > 0) ? "," : "",
  				SerializableSnapshot->xip[xcnt]);
+ /*@+bufferoverflowhigh@*/
  		cp += strlen(cp);
  	}
+ 	/*@+nullderef@*/
+         /*@+mustfreeonly@*/
  	ev_xip = DatumGetTextP(DirectFunctionCall1(textin, PointerGetDatum(buf)));
  
***************
*** 201,206 ****
--- 211,218 ----
  	 * Call the saved INSERT plan
  	 */
+ 	/*@-nullderef@*/
  	argv[0] = TransactionIdGetDatum(SerializableSnapshot->xmin);
  	argv[1] = TransactionIdGetDatum(SerializableSnapshot->xmax);
+ 	/*@+nullderef@*/
  	argv[2] = PointerGetDatum(ev_xip);
  	nulls[0] = ' ';
***************
*** 245,257 ****
  			strcmp(ev_type_c, "ENABLE_SUBSCRIPTION") == 0)
  		{
  			if ((rc = SPI_execp(cs->plan_record_sequences, NULL, NULL, 0)) < 0)
  				elog(ERROR, "Slony-I: SPI_execp() failed for \"INSERT INTO sl_seqlog ...\"");
  		}
  	}
  
! 	SPI_finish();
! 
  	PG_RETURN_INT64(retval);
  }
  
  
--- 257,272 ----
  			strcmp(ev_type_c, "ENABLE_SUBSCRIPTION") == 0)
  		{
+ /*@-nullpass@*/
  			if ((rc = SPI_execp(cs->plan_record_sequences, NULL, NULL, 0)) < 0)
  				elog(ERROR, "Slony-I: SPI_execp() failed for \"INSERT INTO sl_seqlog ...\"");
+ /*@+nullpass@*/
  		}
  	}
  
! 	(void) SPI_finish();
! /*@-mustfreefresh@*/
  	PG_RETURN_INT64(retval);
  }
+ /*@+mustfreefresh@*/
  
  
***************
*** 1135,1139 ****
   * Version: pgsql/src/backend/utils/adt/ruleutils.c,v 1.188 2005/01/13 17:19:10
   */
! const char *
  slon_quote_identifier(const char *ident)
  {
--- 1150,1154 ----
   * Version: pgsql/src/backend/utils/adt/ruleutils.c,v 1.188 2005/01/13 17:19:10
   */
! static const char *
  slon_quote_identifier(const char *ident)
  {
***************
*** 1472,1475 ****
--- 1487,1491 ----
  			elog(ERROR, "Slony-I: SPI_prepare() failed");
  
+ 		/*@-nullderef@*/
  		/*
  		 * Also create the 3 rather static text values for the log_cmdtype
***************
*** 1500,1503 ****
--- 1516,1520 ----
  
  	return cs;
+ 	/*@+nullderef@*/
  }
  

Index: Makefile
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/Makefile,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** Makefile	8 Feb 2007 18:01:15 -0000	1.23
--- Makefile	18 Apr 2007 21:20:22 -0000	1.24
***************
*** 59,62 ****
--- 59,65 ----
  	rm -f $(SO_NAME) $(SO_OBJS)
  
+ splint:
+ 	splint -I $(pgincludedir) -I $(pgincludeserverdir) +unixlib -preproc +skip-sys-headers $(wildcard *.c)
+ 
  install: all installdirs
  	$(INSTALL_SCRIPT) $(SO_NAME) $(DESTDIR)$(pgpkglibdir)



More information about the Slony1-commit mailing list