[Zodb-checkins] CVS: Zope2/lib/python/ZODB - TimeStamp.c:1.7

jeremy@digicool.com jeremy@digicool.com
Tue, 27 Mar 2001 19:28:28 -0500 (EST)


Update of /cvs-repository/Zope2/lib/python/ZODB
In directory korak:/tmp/cvs-serv20454

Modified Files:
	TimeStamp.c 
Log Message:
Changes to satisfy gcc -Wall:
   - remove %lf printf format; l can't modify %f
   - remove unused functions and macros
   - make sure decls of prototype-less functions are also valid prototypes

Add the $Id:$ to the doc string




--- Updated File TimeStamp.c in package Zope2/lib/python/ZODB --
--- TimeStamp.c	2000/03/06 21:09:14	1.6
+++ TimeStamp.c	2001/03/28 00:28:27	1.7
@@ -84,9 +84,9 @@
  ****************************************************************************/
 
 static char TimeStamp_module_documentation[] = 
-""
-"\n$Id$"
-;
+"Defines 64-bit TimeStamp objects used as ZODB serial numbers.\n"
+"\n"
+"\n$Id$\n";
 
 #include <stdlib.h>
 #include <time.h>
@@ -100,10 +100,7 @@
 
 /* ----------------------------------------------------- */
 
-static void PyVar_Assign(PyObject **v, PyObject *e) { Py_XDECREF(*v); *v=e;}
-#define ASSIGN(V,E) PyVar_Assign(&(V),(E))
 #define UNLESS(E) if(!(E))
-#define UNLESS_ASSIGN(V,E) ASSIGN(V,E); UNLESS(V)
 #define OBJECT(O) ((PyObject*)(O))
 
 /* Declarations for objects of type TimeStamp */
@@ -156,7 +153,7 @@
 static double gmoff=0, sconv=0;
 
 static int
-TimeStamp_init_gmoff()
+TimeStamp_init_gmoff(void)
 {
   struct tm *t;
   time_t z=0;
@@ -409,7 +406,7 @@
   int l;
 
   TimeStamp_parts(self);
-  l=sprintf(buf, "%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%lf",
+  l=sprintf(buf, "%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%f",
 	    TimeStamp_y, TimeStamp_m, TimeStamp_d, 
 	    TimeStamp_mi/60, TimeStamp_mi%60, TimeStamp_sec(self));
 
@@ -485,9 +482,9 @@
 };
 
 void
-initTimeStamp()
+initTimeStamp(void)
 {
-  PyObject *m, *d;
+  PyObject *m, *d, *s;
   char *rev="$Revision$";
 
   if (TimeStamp_init_gmoff() < 0) return;
@@ -495,7 +492,7 @@
 
   /* Create the module and add the functions */
   m = Py_InitModule4("TimeStamp", Module_Level__methods,
-		     "Simple time stamps",
+		     TimeStamp_module_documentation,
 		     (PyObject*)NULL,PYTHON_API_VERSION);
 
   /* Add some symbolic constants to the module */
@@ -509,13 +506,13 @@
 
   PyDict_SetItemString(d,"TimeStampType", OBJECT(&TimeStampType));
 
-  ErrorObject = PyString_FromString("TimeStamp.error");
-  PyDict_SetItemString(d, "error", ErrorObject);
+  s = PyString_FromString("TimeStamp.error");
+  if (s == NULL)
+      return;
+  PyDict_SetItemString(d, "error", s);
+  Py_DECREF(s);
 
   PyDict_SetItemString(d, "__version__",
-		       PyString_FromStringAndSize(rev+11,strlen(rev+11)-2));
-  
-  /* Check for errors */
-  if (PyErr_Occurred())
-    Py_FatalError("can't initialize module TimeStamp");
+		       PyString_FromStringAndSize(rev + 11, 
+						  strlen(rev + 11) - 2));
 }