Constify filenames and scripts. Fixes #651362.

This commit is contained in:
Martin v. Löwis 2002-12-11 14:04:59 +00:00
parent 0e88c9f65d
commit 95292d6caa
12 changed files with 123 additions and 118 deletions

View file

@ -52,7 +52,7 @@ PyAPI_DATA(PyTypeObject) PyCode_Type;
/* Public interface */
struct _node; /* Declare the existence of this type */
PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, char *);
PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *);
PyAPI_FUNC(PyCodeObject *) PyCode_New(
int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *,
PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *);
@ -67,8 +67,8 @@ typedef struct {
int ff_features;
} PyFutureFeatures;
PyAPI_FUNC(PyFutureFeatures *) PyNode_Future(struct _node *, char *);
PyAPI_FUNC(PyCodeObject *) PyNode_CompileFlags(struct _node *, char *,
PyAPI_FUNC(PyFutureFeatures *) PyNode_Future(struct _node *, const char *);
PyAPI_FUNC(PyCodeObject *) PyNode_CompileFlags(struct _node *, const char *,
PyCompilerFlags *);
#define FUTURE_NESTED_SCOPES "nested_scopes"

View file

@ -9,7 +9,7 @@ extern "C" {
typedef struct {
int error;
char *filename;
const char *filename;
int lineno;
int offset;
char *text;
@ -21,19 +21,19 @@ typedef struct {
#define PyPARSE_YIELD_IS_KEYWORD 0x0001
#endif
PyAPI_FUNC(node *) PyParser_ParseString(char *, grammar *, int,
PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int,
perrdetail *);
PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, char *, grammar *, int,
PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, const char *, grammar *, int,
char *, char *, perrdetail *);
PyAPI_FUNC(node *) PyParser_ParseStringFlags(char *, grammar *, int,
PyAPI_FUNC(node *) PyParser_ParseStringFlags(const char *, grammar *, int,
perrdetail *, int);
PyAPI_FUNC(node *) PyParser_ParseFileFlags(FILE *, char *, grammar *,
PyAPI_FUNC(node *) PyParser_ParseFileFlags(FILE *, const char *, grammar *,
int, char *, char *,
perrdetail *, int);
PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilename(char *,
char *,
PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilename(const char *,
const char *,
grammar *, int,
perrdetail *, int);
#ifdef __cplusplus

View file

@ -130,16 +130,17 @@ PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *);
/* Issue a warning or exception */
PyAPI_FUNC(int) PyErr_Warn(PyObject *, char *);
PyAPI_FUNC(int) PyErr_WarnExplicit(PyObject *, char *,
char *, int, char *, PyObject *);
PyAPI_FUNC(int) PyErr_WarnExplicit(PyObject *, const char *,
const char *, int,
const char *, PyObject *);
/* In sigcheck.c or signalmodule.c */
PyAPI_FUNC(int) PyErr_CheckSignals(void);
PyAPI_FUNC(void) PyErr_SetInterrupt(void);
/* Support for adding program text to SyntaxErrors */
PyAPI_FUNC(void) PyErr_SyntaxLocation(char *, int);
PyAPI_FUNC(PyObject *) PyErr_ProgramText(char *, int);
PyAPI_FUNC(void) PyErr_SyntaxLocation(const char *, int);
PyAPI_FUNC(PyObject *) PyErr_ProgramText(const char *, int);
#ifdef Py_USING_UNICODE
/* The following functions are used to create and modify unicode

View file

@ -26,47 +26,47 @@ PyAPI_FUNC(int) Py_IsInitialized(void);
PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void);
PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *);
PyAPI_FUNC(int) PyRun_AnyFile(FILE *, char *);
PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *, char *, int);
PyAPI_FUNC(int) PyRun_AnyFile(FILE *, const char *);
PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *, const char *, int);
PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, char *, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_AnyFileExFlags(FILE *, char *, int, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_AnyFileExFlags(FILE *, const char *, int, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_SimpleString(char *);
PyAPI_FUNC(int) PyRun_SimpleStringFlags(char *, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_SimpleFile(FILE *, char *);
PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *, char *, int);
PyAPI_FUNC(int) PyRun_SimpleFileExFlags(FILE *, char *, int, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *, char *);
PyAPI_FUNC(int) PyRun_InteractiveOneFlags(FILE *, char *, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *, char *);
PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE *, char *, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_SimpleString(const char *);
PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_SimpleFile(FILE *, const char *);
PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *, const char *, int);
PyAPI_FUNC(int) PyRun_SimpleFileExFlags(FILE *, const char *, int, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *, const char *);
PyAPI_FUNC(int) PyRun_InteractiveOneFlags(FILE *, const char *, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *, const char *);
PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE *, const char *, PyCompilerFlags *);
PyAPI_FUNC(struct _node *) PyParser_SimpleParseString(char *, int);
PyAPI_FUNC(struct _node *) PyParser_SimpleParseFile(FILE *, char *, int);
PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(char *, int, int);
PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(char *,
char *,
PyAPI_FUNC(struct _node *) PyParser_SimpleParseString(const char *, int);
PyAPI_FUNC(struct _node *) PyParser_SimpleParseFile(FILE *, const char *, int);
PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int, int);
PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(const char *,
const char *,
int,
int);
PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, char *,
PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *,
int, int);
PyAPI_FUNC(PyObject *) PyRun_String(char *, int, PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyRun_File(FILE *, char *, int, PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *, char *, int,
PyAPI_FUNC(PyObject *) PyRun_String(const char *, int, PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyRun_File(FILE *, const char *, int, PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *, const char *, int,
PyObject *, PyObject *, int);
PyAPI_FUNC(PyObject *) PyRun_StringFlags(char *, int, PyObject *, PyObject *,
PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *, PyObject *,
PyCompilerFlags *);
PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *, char *, int, PyObject *,
PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *, const char *, int, PyObject *,
PyObject *, PyCompilerFlags *);
PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, char *, int, PyObject *,
PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, const char *, int, PyObject *,
PyObject *, int, PyCompilerFlags *);
PyAPI_FUNC(PyObject *) Py_CompileString(char *, char *, int);
PyAPI_FUNC(PyObject *) Py_CompileStringFlags(char *, char *, int,
PyAPI_FUNC(PyObject *) Py_CompileString(const char *, const char *, int);
PyAPI_FUNC(PyObject *) Py_CompileStringFlags(const char *, const char *, int,
PyCompilerFlags *);
PyAPI_FUNC(struct symtable *) Py_SymtableString(char *, char *, int);
PyAPI_FUNC(struct symtable *) Py_SymtableString(const char *, const char *, int);
PyAPI_FUNC(void) PyErr_Print(void);
PyAPI_FUNC(void) PyErr_PrintEx(int);
@ -76,7 +76,7 @@ PyAPI_FUNC(int) Py_AtExit(void (*func)(void));
PyAPI_FUNC(void) Py_Exit(int);
PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, char *);
PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
/* Bootstrap */
PyAPI_FUNC(int) Py_Main(int argc, char **argv);

View file

@ -20,7 +20,7 @@ struct _symtable_entry;
struct symtable {
int st_pass; /* pass == 1 or 2 */
char *st_filename; /* name of file being compiled */
const char *st_filename; /* name of file being compiled */
struct _symtable_entry *st_cur; /* current symbol table entry */
PyObject *st_symbols; /* dictionary of symbol table entries */
PyObject *st_stack; /* stack of namespace info */
@ -57,7 +57,7 @@ PyAPI_DATA(PyTypeObject) PySymtableEntry_Type;
PyAPI_FUNC(PyObject *) PySymtableEntry_New(struct symtable *,
char *, int, int);
PyAPI_FUNC(struct symtable *) PyNode_CompileSymtable(struct _node *, char *);
PyAPI_FUNC(struct symtable *) PyNode_CompileSymtable(struct _node *, const char *);
PyAPI_FUNC(void) PySymtable_Free(struct symtable *);