[Zope-Checkins] CVS: Zope/lib/Components/ExtensionClass/src - ExtensionClass.c:1.56

Jeremy Hylton jeremy@zope.com
Tue, 18 Jun 2002 19:19:02 -0400


Update of /cvs-repository/Zope/lib/Components/ExtensionClass/src
In directory cvs.zope.org:/tmp/cvs-serv20265

Modified Files:
	ExtensionClass.c 
Log Message:
Tim reports that snprintf is called _snprintf on Windows.

Rather than trying to deal with the portability issues, just use
sprintf() with suitability limits on the strings.



=== Zope/lib/Components/ExtensionClass/src/ExtensionClass.c 1.55 => 1.56 ===
 	if (!repr)
 	    return NULL;
-	n = snprintf(buf, sizeof(buf),
-		     "<bound method %s.%s of %s>",
+	n = sprintf(buf,
+		     "<bound method %.1000s.%.1000s of %.1000s>",
 		     self->type->tp_name, func_name,
 		     PyString_AS_STRING(repr));
-	if (n == -1)
-	    n = sizeof(buf) - 1;
 	Py_DECREF(repr);
     }
     else {
-	n = snprintf(buf, sizeof(buf),
-		     "<unbound method %s.%s>",
+	n = sprintf(buf, 
+		     "<unbound method %.1000s.%.1000s>",
 		     self->type->tp_name, func_name);
-	if (n == -1)
-	    n = sizeof(buf) - 1;
     }
     return PyString_FromStringAndSize(buf, n);
 }