[Python-checkins] cpython: Splitted the WFILE structure to WFILE and RFILE.

serhiy.storchaka python-checkins at python.org
Wed Feb 11 15:20:54 CET 2015


https://hg.python.org/cpython/rev/c9c6b5bcdb1f
changeset:   94588:c9c6b5bcdb1f
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Wed Feb 11 16:18:09 2015 +0200
summary:
  Splitted the WFILE structure to WFILE and RFILE.

files:
  Python/marshal.c |  17 +++++++++++------
  1 files changed, 11 insertions(+), 6 deletions(-)


diff --git a/Python/marshal.c b/Python/marshal.c
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -65,15 +65,10 @@
     FILE *fp;
     int error;  /* see WFERR_* values */
     int depth;
-    /* If fp == NULL, the following are valid: */
-    PyObject *readable;    /* Stream-like object being read from */
     PyObject *str;
-    PyObject *current_filename;
     char *ptr;
     char *end;
     char *buf;
-    Py_ssize_t buf_size;
-    PyObject *refs; /* dict on marshal, list on unmarshal */
     _Py_hashtable_t *hashtable;
     int version;
 } WFILE;
@@ -636,7 +631,17 @@
     w_flush(&wf);
 }
 
-typedef WFILE RFILE; /* Same struct with different invariants */
+typedef struct {
+    FILE *fp;
+    int depth;
+    PyObject *readable;  /* Stream-like object being read from */
+    PyObject *current_filename;
+    char *ptr;
+    char *end;
+    char *buf;
+    Py_ssize_t buf_size;
+    PyObject *refs;  /* a list */
+} RFILE;
 
 static char *
 r_string(Py_ssize_t n, RFILE *p)

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list