[Python-checkins] cpython: remove dynamic initializer lists for c89 compliance (closes #20595)

benjamin.peterson python-checkins at python.org
Tue Feb 11 16:09:57 CET 2014


http://hg.python.org/cpython/rev/417a468ae755
changeset: 89150:417a468ae755
user: Benjamin Peterson <benjamin at python.org>
date: Tue Feb 11 10:09:27 2014 -0500
summary:
 remove dynamic initializer lists for c89 compliance (closes #20595)
files:
 Misc/NEWS | 2 ++
 Python/getargs.c | 14 +++++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,8 @@
 Core and Builtins
 -----------------
 
+- Issue #20595: Make getargs.c C89 compliant.
+
 Library
 -------
 
diff --git a/Python/getargs.c b/Python/getargs.c
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -200,8 +200,6 @@
 {
 char msgbuf[256];
 int levels[32];
- freelistentry_t static_entries[STATIC_FREELIST_ENTRIES];
- freelist_t freelist = {static_entries, 0, 0};
 const char *fname = NULL;
 const char *message = NULL;
 int min = -1;
@@ -212,6 +210,12 @@
 Py_ssize_t i, len;
 char *msg;
 int compat = flags & FLAG_COMPAT;
+ freelistentry_t static_entries[STATIC_FREELIST_ENTRIES];
+ freelist_t freelist;
+
+ freelist.entries = static_entries;
+ freelist.first_available = 0;
+ freelist.entries_malloced = 0;
 
 assert(compat || (args != (PyObject*)NULL));
 flags = flags & ~FLAG_COMPAT;
@@ -1439,7 +1443,11 @@
 Py_ssize_t nargs, nkeywords;
 PyObject *current_arg;
 freelistentry_t static_entries[STATIC_FREELIST_ENTRIES];
- freelist_t freelist = {static_entries, 0, 0};
+ freelist_t freelist;
+
+ freelist.entries = static_entries;
+ freelist.first_available = 0;
+ freelist.entries_malloced = 0;
 
 assert(args != NULL && PyTuple_Check(args));
 assert(keywords == NULL || PyDict_Check(keywords));
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /