summaryrefslogtreecommitdiff
path: root/Parser/grammar.c
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2006-04-21 10:40:58 +0000
committerThomas Wouters <thomas@python.org>2006-04-21 10:40:58 +0000
commit49fd7fa4431da299196d74087df4a04f99f9c46f (patch)
tree35ace5fe78d3d52c7a9ab356ab9f6dbf8d4b71f4 /Parser/grammar.c
parent9ada3d6e29d5165dadacbe6be07bcd35cfbef59d (diff)
downloadcpython-git-49fd7fa4431da299196d74087df4a04f99f9c46f.tar.gz
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
number of tests, all because of the codecs/_multibytecodecs issue described here (it's not a Py3K issue, just something Py3K discovers): http://mail.python.org/pipermail/python-dev/2006-April/064051.html Hye-Shik Chang promised to look for a fix, so no need to fix it here. The tests that are expected to break are: test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecs test_multibytecodec This merge fixes an actual test failure (test_weakref) in this branch, though, so I believe merging is the right thing to do anyway.
Diffstat (limited to 'Parser/grammar.c')
-rw-r--r--Parser/grammar.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/Parser/grammar.c b/Parser/grammar.c
index d8e38973db..b0dafe7a6f 100644
--- a/Parser/grammar.c
+++ b/Parser/grammar.c
@@ -20,7 +20,7 @@ newgrammar(int start)
{
grammar *g;
- g = PyMem_NEW(grammar, 1);
+ g = (grammar *)PyObject_MALLOC(sizeof(grammar));
if (g == NULL)
Py_FatalError("no mem for new grammar");
g->g_ndfas = 0;
@@ -37,7 +37,8 @@ adddfa(grammar *g, int type, char *name)
{
dfa *d;
- PyMem_RESIZE(g->g_dfa, dfa, g->g_ndfas + 1);
+ g->g_dfa = (dfa *)PyObject_REALLOC(g->g_dfa,
+ sizeof(dfa) * (g->g_ndfas + 1));
if (g->g_dfa == NULL)
Py_FatalError("no mem to resize dfa in adddfa");
d = &g->g_dfa[g->g_ndfas++];
@@ -55,7 +56,8 @@ addstate(dfa *d)
{
state *s;
- PyMem_RESIZE(d->d_state, state, d->d_nstates + 1);
+ d->d_state = (state *)PyObject_REALLOC(d->d_state,
+ sizeof(state) * (d->d_nstates + 1));
if (d->d_state == NULL)
Py_FatalError("no mem to resize state in addstate");
s = &d->d_state[d->d_nstates++];
@@ -78,7 +80,7 @@ addarc(dfa *d, int from, int to, int lbl)
assert(0 <= to && to < d->d_nstates);
s = &d->d_state[from];
- PyMem_RESIZE(s->s_arc, arc, s->s_narcs + 1);
+ s->s_arc = (arc *)PyObject_REALLOC(s->s_arc, sizeof(arc) * (s->s_narcs + 1));
if (s->s_arc == NULL)
Py_FatalError("no mem to resize arc list in addarc");
a = &s->s_arc[s->s_narcs++];
@@ -97,7 +99,8 @@ addlabel(labellist *ll, int type, char *str)
strcmp(ll->ll_label[i].lb_str, str) == 0)
return i;
}
- PyMem_RESIZE(ll->ll_label, label, ll->ll_nlabels + 1);
+ ll->ll_label = (label *)PyObject_REALLOC(ll->ll_label,
+ sizeof(label) * (ll->ll_nlabels + 1));
if (ll->ll_label == NULL)
Py_FatalError("no mem to resize labellist in addlabel");
lb = &ll->ll_label[ll->ll_nlabels++];
@@ -195,7 +198,7 @@ translabel(grammar *g, label *lb)
name_len = p - src;
else
name_len = strlen(src);
- dest = malloc(name_len + 1);
+ dest = (char *)malloc(name_len + 1);
strncpy(dest, src, name_len);
dest[name_len] = '\0';
free(lb->lb_str);