summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-10-19 18:03:34 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-10-19 18:03:34 (GMT)
commitc679227e31245b0e8dec74a1f7cc77710541d985 (patch)
tree0ed52ac2bd85d0cad42e39aec5437a603750425b /Parser
parent80ab13067e9b8fbd02a05a4863e26b04938b77f5 (diff)
downloadcpython-c679227e31245b0e8dec74a1f7cc77710541d985.zip
cpython-c679227e31245b0e8dec74a1f7cc77710541d985.tar.gz
cpython-c679227e31245b0e8dec74a1f7cc77710541d985.tar.bz2
Issue #1772673: The type of `char*` arguments now changed to `const char*`.
Diffstat (limited to 'Parser')
-rw-r--r--Parser/grammar.c6
-rw-r--r--Parser/myreadline.c6
-rw-r--r--Parser/parser.c4
-rw-r--r--Parser/parsetok.c15
-rw-r--r--Parser/pgenmain.c2
-rw-r--r--Parser/tokenizer.c7
-rw-r--r--Parser/tokenizer.h6
7 files changed, 25 insertions, 21 deletions
diff --git a/Parser/grammar.c b/Parser/grammar.c
index f2a25ca..d4270de 100644
--- a/Parser/grammar.c
+++ b/Parser/grammar.c
@@ -29,7 +29,7 @@ newgrammar(int start)
}
dfa *
-adddfa(grammar *g, int type, char *name)
+adddfa(grammar *g, int type, const char *name)
{
dfa *d;
@@ -85,7 +85,7 @@ addarc(dfa *d, int from, int to, int lbl)
}
int
-addlabel(labellist *ll, int type, char *str)
+addlabel(labellist *ll, int type, const char *str)
{
int i;
label *lb;
@@ -111,7 +111,7 @@ addlabel(labellist *ll, int type, char *str)
/* Same, but rather dies than adds */
int
-findlabel(labellist *ll, int type, char *str)
+findlabel(labellist *ll, int type, const char *str)
{
int i;
diff --git a/Parser/myreadline.c b/Parser/myreadline.c
index 8bb35bd..a1c4b5c 100644
--- a/Parser/myreadline.c
+++ b/Parser/myreadline.c
@@ -109,7 +109,7 @@ my_fgets(char *buf, int len, FILE *fp)
/* Readline implementation using fgets() */
char *
-PyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
+PyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
{
size_t n;
char *p, *pr;
@@ -170,13 +170,13 @@ PyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
Note: Python expects in return a buffer allocated with PyMem_Malloc. */
-char *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *);
+char *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *);
/* Interface used by tokenizer.c and bltinmodule.c */
char *
-PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
+PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
{
char *rv, *res;
size_t len;
diff --git a/Parser/parser.c b/Parser/parser.c
index fc102f2..56ec514 100644
--- a/Parser/parser.c
+++ b/Parser/parser.c
@@ -134,13 +134,13 @@ push(stack *s, int type, dfa *d, int newstate, int lineno, int col_offset)
/* PARSER PROPER */
static int
-classify(parser_state *ps, int type, char *str)
+classify(parser_state *ps, int type, const char *str)
{
grammar *g = ps->p_grammar;
int n = g->g_ll.ll_nlabels;
if (type == NAME) {
- char *s = str;
+ const char *s = str;
label *l = g->g_ll.ll_label;
int i;
for (i = n; i > 0; i--, l++) {
diff --git a/Parser/parsetok.c b/Parser/parsetok.c
index 2df9159..b4957b8 100644
--- a/Parser/parsetok.c
+++ b/Parser/parsetok.c
@@ -94,7 +94,8 @@ PyParser_ParseStringFlagsFilenameEx(const char *s, const char *filename_str,
node *
PyParser_ParseFile(FILE *fp, const char *filename, grammar *g, int start,
- char *ps1, char *ps2, perrdetail *err_ret)
+ const char *ps1, const char *ps2,
+ perrdetail *err_ret)
{
return PyParser_ParseFileFlags(fp, filename, NULL,
g, start, ps1, ps2, err_ret, 0);
@@ -103,7 +104,8 @@ PyParser_ParseFile(FILE *fp, const char *filename, grammar *g, int start,
node *
PyParser_ParseFileFlags(FILE *fp, const char *filename, const char *enc,
grammar *g, int start,
- char *ps1, char *ps2, perrdetail *err_ret, int flags)
+ const char *ps1, const char *ps2,
+ perrdetail *err_ret, int flags)
{
int iflags = flags;
return PyParser_ParseFileFlagsEx(fp, filename, enc, g, start, ps1,
@@ -113,15 +115,15 @@ PyParser_ParseFileFlags(FILE *fp, const char *filename, const char *enc,
node *
PyParser_ParseFileObject(FILE *fp, PyObject *filename,
const char *enc, grammar *g, int start,
- char *ps1, char *ps2, perrdetail *err_ret,
- int *flags)
+ const char *ps1, const char *ps2,
+ perrdetail *err_ret, int *flags)
{
struct tok_state *tok;
if (initerr(err_ret, filename) < 0)
return NULL;
- if ((tok = PyTokenizer_FromFile(fp, (char *)enc, ps1, ps2)) == NULL) {
+ if ((tok = PyTokenizer_FromFile(fp, enc, ps1, ps2)) == NULL) {
err_ret->error = E_NOMEM;
return NULL;
}
@@ -135,7 +137,8 @@ PyParser_ParseFileObject(FILE *fp, PyObject *filename,
node *
PyParser_ParseFileFlagsEx(FILE *fp, const char *filename,
const char *enc, grammar *g, int start,
- char *ps1, char *ps2, perrdetail *err_ret, int *flags)
+ const char *ps1, const char *ps2,
+ perrdetail *err_ret, int *flags)
{
node *n;
PyObject *fileobj = NULL;
diff --git a/Parser/pgenmain.c b/Parser/pgenmain.c
index a624dd2..017a4f9 100644
--- a/Parser/pgenmain.c
+++ b/Parser/pgenmain.c
@@ -138,7 +138,7 @@ Py_FatalError(const char *msg)
/* No-nonsense my_readline() for tokenizer.c */
char *
-PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
+PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
{
size_t n = 1000;
char *p = (char *)PyMem_MALLOC(n);
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index dafb4bd..5bf7e84 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -31,7 +31,7 @@
|| c == '_'\
|| (c >= 128))
-extern char *PyOS_Readline(FILE *, FILE *, char *);
+extern char *PyOS_Readline(FILE *, FILE *, const char *);
/* Return malloc'ed string including trailing \n;
empty malloc'ed string for EOF;
NULL if interrupted */
@@ -780,7 +780,7 @@ PyTokenizer_FromString(const char *str, int exec_input)
struct tok_state *tok = tok_new();
if (tok == NULL)
return NULL;
- str = (char *)decode_str(str, exec_input, tok);
+ str = decode_str(str, exec_input, tok);
if (str == NULL) {
PyTokenizer_Free(tok);
return NULL;
@@ -823,7 +823,8 @@ PyTokenizer_FromUTF8(const char *str, int exec_input)
/* Set up tokenizer for file */
struct tok_state *
-PyTokenizer_FromFile(FILE *fp, char* enc, char *ps1, char *ps2)
+PyTokenizer_FromFile(FILE *fp, const char* enc,
+ const char *ps1, const char *ps2)
{
struct tok_state *tok = tok_new();
if (tok == NULL)
diff --git a/Parser/tokenizer.h b/Parser/tokenizer.h
index ed1f3aa..1ce6eeb 100644
--- a/Parser/tokenizer.h
+++ b/Parser/tokenizer.h
@@ -35,7 +35,7 @@ struct tok_state {
int indstack[MAXINDENT]; /* Stack of indents */
int atbol; /* Nonzero if at begin of new line */
int pendin; /* Pending indents (if > 0) or dedents (if < 0) */
- char *prompt, *nextprompt; /* For interactive prompting */
+ const char *prompt, *nextprompt; /* For interactive prompting */
int lineno; /* Current line number */
int level; /* () [] {} Parentheses nesting level */
/* Used to allow free continuations inside them */
@@ -69,8 +69,8 @@ struct tok_state {
extern struct tok_state *PyTokenizer_FromString(const char *, int);
extern struct tok_state *PyTokenizer_FromUTF8(const char *, int);
-extern struct tok_state *PyTokenizer_FromFile(FILE *, char*,
- char *, char *);
+extern struct tok_state *PyTokenizer_FromFile(FILE *, const char*,
+ const char *, const char *);
extern void PyTokenizer_Free(struct tok_state *);
extern int PyTokenizer_Get(struct tok_state *, char **, char **);
extern char * PyTokenizer_RestoreEncoding(struct tok_state* tok,