diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-12-03 00:43:33 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-12-03 00:43:33 (GMT) |
commit | faad5ad59005d16080aa79b593fede25c6a7457c (patch) | |
tree | a65ad8b3d7ec365c2bd363763eae7a1a9955b843 /Include/pyerrors.h | |
parent | 17d015409765d29e199d4828cb136acd3196efe6 (diff) | |
download | cpython-faad5ad59005d16080aa79b593fede25c6a7457c.zip cpython-faad5ad59005d16080aa79b593fede25c6a7457c.tar.gz cpython-faad5ad59005d16080aa79b593fede25c6a7457c.tar.bz2 |
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.
Diffstat (limited to 'Include/pyerrors.h')
-rw-r--r-- | Include/pyerrors.h | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/Include/pyerrors.h b/Include/pyerrors.h index a1dce1c..e2e2629 100644 --- a/Include/pyerrors.h +++ b/Include/pyerrors.h @@ -123,16 +123,11 @@ extern DL_IMPORT(PyObject *) PyErr_ProgramText(char *, int); # define vsnprintf _vsnprintf #endif -#ifndef HAVE_SNPRINTF #include <stdarg.h> extern DL_IMPORT(int) PyOS_snprintf(char *str, size_t size, const char *format, ...) __attribute__((format(printf, 3, 4))); 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 } |