[Python-checkins] CVS: python/dist/src/Include pyerrors.h,2.52,2.53

Tim Peters tim_one@users.sourceforge.net
Sun, 02 Dec 2001 16:43:35 -0800


Update of /cvsroot/python/python/dist/src/Include
In directory usw-pr-cvs1:/tmp/cvs-serv19336/python/Include

Modified Files:
	pyerrors.h 
Log Message:
mysnprintf.c:  Massive rewrite of PyOS_snprintf and PyOS_vsnprintf, to
use wrappers on all platforms, to make this as consistent as possible x-
platform (in particular, make sure there's at least one \0 byte in
the output buffer).  Also document more of the truth about what these do.

getargs.c, seterror():  Three computations of remaining buffer size were
backwards, thus telling PyOS_snprintf the buffer is larger than it
actually is.  This matters a lot now that PyOS_snprintf ensures there's a
trailing \0 byte (because it didn't get the truth about the buffer size,
it was storing \0 beyond the true end of the buffer).

sysmodule.c, mywrite():  Simplify, now that PyOS_vsnprintf guarantees to
produce a \0 byte.


Index: pyerrors.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/pyerrors.h,v
retrieving revision 2.52
retrieving revision 2.53
diff -C2 -d -r2.52 -r2.53
*** pyerrors.h	2001/11/28 16:51:49	2.52
--- pyerrors.h	2001/12/03 00:43:33	2.53
***************
*** 124,128 ****
  #endif
  
- #ifndef HAVE_SNPRINTF
  #include <stdarg.h>
  extern DL_IMPORT(int) PyOS_snprintf(char *str, size_t size, const char  *format, ...)
--- 124,127 ----
***************
*** 130,137 ****
  extern DL_IMPORT(int) PyOS_vsnprintf(char *str, size_t size, const char  *format, va_list va)
  			__attribute__((format(printf, 3, 0)));
- #else
- # define PyOS_vsnprintf	vsnprintf
- # define PyOS_snprintf	snprintf
- #endif
  
  #ifdef __cplusplus
--- 129,132 ----