summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2000-07-22 23:56:07 (GMT)
committerThomas Wouters <thomas@python.org>2000-07-22 23:56:07 (GMT)
commit3b6448fbae16564484a40efa7f418fba02755625 (patch)
treed414081b88baa5185f06af63b65fcfe93b5a4f44
parent2c46eaf8e948607f7551f2075044d27d27c43775 (diff)
downloadcpython-3b6448fbae16564484a40efa7f418fba02755625.zip
cpython-3b6448fbae16564484a40efa7f418fba02755625.tar.gz
cpython-3b6448fbae16564484a40efa7f418fba02755625.tar.bz2
ANSIfication: add proper prototypes to function-pointers and declarations.
Also, fix a bug found by said declarations, where a string was defined as unsigned char*, but used as signed.
-rw-r--r--Modules/cPickle.c37
1 files changed, 13 insertions, 24 deletions
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index 52b3a1f..40da49c 100644
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -310,7 +310,7 @@ Pdata_popList(Pdata *self, int start) {
} \
}
-typedef struct {
+typedef struct Picklerobject {
PyObject_HEAD
FILE *fp;
PyObject *write;
@@ -321,7 +321,7 @@ typedef struct {
PyObject *inst_pers_func;
int bin;
int fast; /* Fast mode doesn't save in memo, don't use if circ ref */
- int (*write_func)();
+ int (*write_func)(struct Picklerobject *, char *, int);
char *write_buf;
int buf_size;
PyObject *dispatch_table;
@@ -329,7 +329,7 @@ typedef struct {
staticforward PyTypeObject Picklertype;
-typedef struct {
+typedef struct Unpicklerobject {
PyObject_HEAD
FILE *fp;
PyObject *file;
@@ -344,8 +344,8 @@ typedef struct {
int *marks;
int num_marks;
int marks_size;
- int (*read_func)();
- int (*readline_func)();
+ int (*read_func)(struct Unpicklerobject *, char **, int);
+ int (*readline_func)(struct Unpicklerobject *, char **);
int buf_size;
char *buf;
PyObject *safe_constructors;
@@ -369,25 +369,11 @@ cPickle_PyMapping_HasKey(PyObject *o, PyObject *key) {
static
PyObject *
-#ifdef HAVE_STDARG_PROTOTYPES
-/* VARARGS 2 */
-cPickle_ErrFormat(PyObject *ErrType, char *stringformat, char *format, ...) {
-#else
-/* VARARGS */
-cPickle_ErrFormat(va_alist) va_dcl {
-#endif
+cPickle_ErrFormat(PyObject *ErrType, char *stringformat, char *format, ...)
+{
va_list va;
PyObject *args=0, *retval=0;
-#ifdef HAVE_STDARG_PROTOTYPES
va_start(va, format);
-#else
- PyObject *ErrType;
- char *stringformat, *format;
- va_start(va);
- ErrType = va_arg(va, PyObject *);
- stringformat = va_arg(va, char *);
- format = va_arg(va, char *);
-#endif
if (format) args = Py_VaBuildValue(format, va);
va_end(va);
@@ -3203,7 +3189,8 @@ load_binget(Unpicklerobject *self) {
static int
load_long_binget(Unpicklerobject *self) {
PyObject *py_key = 0, *value = 0;
- unsigned char c, *s;
+ unsigned char c;
+ char *s;
long key;
int rc;
@@ -3254,7 +3241,8 @@ load_put(Unpicklerobject *self) {
static int
load_binput(Unpicklerobject *self) {
PyObject *py_key = 0, *value = 0;
- unsigned char key, *s;
+ unsigned char key;
+ char *s;
int len;
if ((*self->read_func)(self, &s, 1) < 0) return -1;
@@ -3274,7 +3262,8 @@ static int
load_long_binput(Unpicklerobject *self) {
PyObject *py_key = 0, *value = 0;
long key;
- unsigned char c, *s;
+ unsigned char c;
+ char *s;
int len;
if ((*self->read_func)(self, &s, 4) < 0) return -1;