diff options
author | Thomas Wouters <thomas@python.org> | 2000-07-22 18:47:25 (GMT) |
---|---|---|
committer | Thomas Wouters <thomas@python.org> | 2000-07-22 18:47:25 (GMT) |
commit | f70ef4f8606f99744252a804229d53a4d97601c1 (patch) | |
tree | be401f2f10b39f0603e4cc0ae091335890410b7f /Python/import.c | |
parent | 0452d1f316903f0553a0d92e0673ff37247cdfa5 (diff) | |
download | cpython-f70ef4f8606f99744252a804229d53a4d97601c1.zip cpython-f70ef4f8606f99744252a804229d53a4d97601c1.tar.gz cpython-f70ef4f8606f99744252a804229d53a4d97601c1.tar.bz2 |
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
declarations yet, those come later.
Diffstat (limited to 'Python/import.c')
-rw-r--r-- | Python/import.c | 248 |
1 files changed, 69 insertions, 179 deletions
diff --git a/Python/import.c b/Python/import.c index 99c811f..959474a 100644 --- a/Python/import.c +++ b/Python/import.c @@ -55,7 +55,8 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. #endif -extern time_t PyOS_GetLastModificationTime(); /* In getmtime.c */ +extern time_t PyOS_GetLastModificationTime(char *, FILE *); + /* In getmtime.c */ /* Magic word to reject .pyc files generated by other Python versions */ /* Change for each incompatible change */ @@ -65,7 +66,7 @@ extern time_t PyOS_GetLastModificationTime(); /* In getmtime.c */ /* XXX Perhaps the magic number should be frozen and a version field added to the .pyc file header? */ /* New way to come up with the magic number: (YEAR-1995), MONTH, DAY */ -#define MAGIC (50428 | ((long)'\r'<<16) | ((long)'\n'<<24)) +#define MAGIC (50715 | ((long)'\r'<<16) | ((long)'\n'<<24)) /* Magic word as global; note that _PyImport_Init() can change the value of this global to accommodate for alterations of how the @@ -91,7 +92,7 @@ static const struct filedescr _PyImport_StandardFiletab[] = { /* Initialize things */ void -_PyImport_Init() +_PyImport_Init(void) { const struct filedescr *scan; struct filedescr *filetab; @@ -131,7 +132,7 @@ _PyImport_Init() } void -_PyImport_Fini() +_PyImport_Fini(void) { Py_XDECREF(extensions); extensions = NULL; @@ -151,7 +152,7 @@ static long import_lock_thread = -1; static int import_lock_level = 0; static void -lock_import() +lock_import(void) { long me = PyThread_get_thread_ident(); if (me == -1) @@ -172,7 +173,7 @@ lock_import() } static void -unlock_import() +unlock_import(void) { long me = PyThread_get_thread_ident(); if (me == -1) @@ -196,7 +197,7 @@ unlock_import() /* Helper for sys */ PyObject * -PyImport_GetModuleDict() +PyImport_GetModuleDict(void) { PyInterpreterState *interp = PyThreadState_Get()->interp; if (interp->modules == NULL) @@ -224,7 +225,7 @@ static char* sys_files[] = { /* Un-initialize things, as good as we can */ void -PyImport_Cleanup() +PyImport_Cleanup(void) { int pos, ndone; char *name; @@ -357,7 +358,7 @@ PyImport_Cleanup() /* Helper for pythonrun.c -- return magic number */ long -PyImport_GetMagicNumber() +PyImport_GetMagicNumber(void) { return pyc_magic; } @@ -374,9 +375,7 @@ PyImport_GetMagicNumber() _PyImport_FindExtension(). */ PyObject * -_PyImport_FixupExtension(name, filename) - char *name; - char *filename; +_PyImport_FixupExtension(char *name, char *filename) { PyObject *modules, *mod, *dict, *copy; if (extensions == NULL) { @@ -403,9 +402,7 @@ _PyImport_FixupExtension(name, filename) } PyObject * -_PyImport_FindExtension(name, filename) - char *name; - char *filename; +_PyImport_FindExtension(char *name, char *filename) { PyObject *dict, *mod, *mdict, *result; if (extensions == NULL) @@ -437,8 +434,7 @@ _PyImport_FindExtension(name, filename) 'NEW' REFERENCE! */ PyObject * -PyImport_AddModule(name) - char *name; +PyImport_AddModule(char *name) { PyObject *modules = PyImport_GetModuleDict(); PyObject *m; @@ -463,18 +459,13 @@ PyImport_AddModule(name) WITH INCREMENTED REFERENCE COUNT */ PyObject * -PyImport_ExecCodeModule(name, co) - char *name; - PyObject *co; +PyImport_ExecCodeModule(char *name, PyObject *co) { return PyImport_ExecCodeModuleEx(name, co, (char *)NULL); } PyObject * -PyImport_ExecCodeModuleEx(name, co, pathname) - char *name; - PyObject *co; - char *pathname; +PyImport_ExecCodeModuleEx(char *name, PyObject *co, char *pathname) { PyObject *modules = PyImport_GetModuleDict(); PyObject *m, *d, *v; @@ -527,10 +518,7 @@ PyImport_ExecCodeModuleEx(name, co, pathname) Doesn't set an exception. */ static char * -make_compiled_pathname(pathname, buf, buflen) - char *pathname; - char *buf; - size_t buflen; +make_compiled_pathname(char *pathname, char *buf, size_t buflen) { size_t len; @@ -552,10 +540,7 @@ make_compiled_pathname(pathname, buf, buflen) Doesn't set an exception. */ static FILE * -check_compiled_module(pathname, mtime, cpathname) - char *pathname; - long mtime; - char *cpathname; +check_compiled_module(char *pathname, long mtime, char *cpathname) { FILE *fp; long magic; @@ -587,9 +572,7 @@ check_compiled_module(pathname, mtime, cpathname) /* Read a code object from a file and check it for validity */ static PyCodeObject * -read_compiled_module(cpathname, fp) - char *cpathname; - FILE *fp; +read_compiled_module(char *cpathname, FILE *fp) { PyObject *co; @@ -610,10 +593,7 @@ read_compiled_module(cpathname, fp) module object WITH INCREMENTED REFERENCE COUNT */ static PyObject * -load_compiled_module(name, cpathname, fp) - char *name; - char *cpathname; - FILE *fp; +load_compiled_module(char *name, char *cpathname, FILE *fp) { long magic; PyCodeObject *co; @@ -641,9 +621,7 @@ load_compiled_module(name, cpathname, fp) /* Parse a source file and return the corresponding code object */ static PyCodeObject * -parse_source_module(pathname, fp) - char *pathname; - FILE *fp; +parse_source_module(char *pathname, FILE *fp) { PyCodeObject *co; node *n; @@ -664,10 +642,7 @@ parse_source_module(pathname, fp) remove the file. */ static void -write_compiled_module(co, cpathname, mtime) - PyCodeObject *co; - char *cpathname; - long mtime; +write_compiled_module(PyCodeObject *co, char *cpathname, long mtime) { FILE *fp; @@ -708,10 +683,7 @@ write_compiled_module(co, cpathname, mtime) byte-compiled file, use that instead. */ static PyObject * -load_source_module(name, pathname, fp) - char *name; - char *pathname; - FILE *fp; +load_source_module(char *name, char *pathname, FILE *fp) { time_t mtime; FILE *fpc; @@ -772,9 +744,7 @@ static struct _frozen *find_frozen(char *name); REFERENCE COUNT */ static PyObject * -load_package(name, pathname) - char *name; - char *pathname; +load_package(char *name, char *pathname) { PyObject *m, *d, *file, *path; int err; @@ -827,8 +797,7 @@ load_package(name, pathname) /* Helper to test for built-in module */ static int -is_builtin(name) - char *name; +is_builtin(char *name) { int i; for (i = 0; PyImport_Inittab[i].name != NULL; i++) { @@ -858,13 +827,8 @@ static int check_case(char *, int, int, char *); static int find_init_module(char *); /* Forward */ static struct filedescr * -find_module(realname, path, buf, buflen, p_fp) - char *realname; - PyObject *path; - /* Output parameters: */ - char *buf; - size_t buflen; - FILE **p_fp; +find_module(char *realname, PyObject *path, char *buf, size_t buflen, + FILE **p_fp) { int i, npath; size_t len, namelen; @@ -1037,8 +1001,7 @@ find_module(realname, path, buf, buflen, p_fp) #include <ctype.h> static int -allcaps8x3(s) - char *s; +allcaps8x3(char *s) { /* Return 1 if s is an 8.3 filename in ALLCAPS */ char c; @@ -1176,8 +1139,7 @@ check_case(char *buf, int len, int namelen, char *name) #ifdef HAVE_STAT /* Helper to look for __init__.py or __init__.py[co] in potential package */ static int -find_init_module(buf) - char *buf; +find_init_module(char *buf) { size_t save_len = strlen(buf); size_t i = save_len; @@ -1212,11 +1174,7 @@ static int init_builtin(char *); /* Forward */ its module object WITH INCREMENTED REFERENCE COUNT */ static PyObject * -load_module(name, fp, buf, type) - char *name; - FILE *fp; - char *buf; - int type; +load_module(char *name, FILE *fp, char *buf, int type) { PyObject *modules; PyObject *m; @@ -1312,8 +1270,7 @@ load_module(name, fp, buf, type) an exception set if the initialization failed. */ static int -init_builtin(name) - char *name; +init_builtin(char *name) { struct _inittab *p; PyObject *mod; @@ -1346,8 +1303,7 @@ init_builtin(name) /* Frozen modules */ static struct _frozen * -find_frozen(name) - char *name; +find_frozen(char *name) { struct _frozen *p; @@ -1361,8 +1317,7 @@ find_frozen(name) } static PyObject * -get_frozen_object(name) - char *name; +get_frozen_object(char *name) { struct _frozen *p = find_frozen(name); int size; @@ -1385,8 +1340,7 @@ get_frozen_object(name) This function is also used from frozenmain.c */ int -PyImport_ImportFrozenModule(name) - char *name; +PyImport_ImportFrozenModule(char *name) { struct _frozen *p = find_frozen(name); PyObject *co; @@ -1442,8 +1396,7 @@ PyImport_ImportFrozenModule(name) its module object WITH INCREMENTED REFERENCE COUNT */ PyObject * -PyImport_ImportModule(name) - char *name; +PyImport_ImportModule(char *name) { static PyObject *fromlist = NULL; if (fromlist == NULL && strchr(name, '.') != NULL) { @@ -1466,11 +1419,8 @@ static PyObject * import_submodule(PyObject *mod, char *name, char *fullname); /* The Magnum Opus of dotted-name import :-) */ static PyObject * -import_module_ex(name, globals, locals, fromlist) - char *name; - PyObject *globals; - PyObject *locals; - PyObject *fromlist; +import_module_ex(char *name, PyObject *globals, PyObject *locals, + PyObject *fromlist) { char buf[MAXPATHLEN+1]; int buflen = 0; @@ -1516,11 +1466,8 @@ import_module_ex(name, globals, locals, fromlist) } PyObject * -PyImport_ImportModuleEx(name, globals, locals, fromlist) - char *name; - PyObject *globals; - PyObject *locals; - PyObject *fromlist; +PyImport_ImportModuleEx(char *name, PyObject *globals, PyObject *locals, + PyObject *fromlist) { PyObject *result; lock_import(); @@ -1530,10 +1477,7 @@ PyImport_ImportModuleEx(name, globals, locals, fromlist) } static PyObject * -get_parent(globals, buf, p_buflen) - PyObject *globals; - char *buf; - int *p_buflen; +get_parent(PyObject *globals, char *buf, int *p_buflen) { static PyObject *namestr = NULL; static PyObject *pathstr = NULL; @@ -1598,13 +1542,10 @@ get_parent(globals, buf, p_buflen) If this is violated... Who cares? */ } +/* altmod is either None or same as mod */ static PyObject * -load_next(mod, altmod, p_name, buf, p_buflen) - PyObject *mod; - PyObject *altmod; /* Either None or same as mod */ - char **p_name; - char *buf; - int *p_buflen; +load_next(PyObject *mod, PyObject *altmod, char **p_name, char *buf, + int *p_buflen) { char *name = *p_name; char *dot = strchr(name, '.'); @@ -1667,20 +1608,15 @@ load_next(mod, altmod, p_name, buf, p_buflen) } static int -mark_miss(name) - char *name; +mark_miss(char *name) { PyObject *modules = PyImport_GetModuleDict(); return PyDict_SetItemString(modules, name, Py_None); } static int -ensure_fromlist(mod, fromlist, buf, buflen, recursive) - PyObject *mod; - PyObject *fromlist; - char *buf; - int buflen; - int recursive; +ensure_fromlist(PyObject *mod, PyObject *fromlist, char *buf, int buflen, + int recursive) { int i; @@ -1747,10 +1683,7 @@ ensure_fromlist(mod, fromlist, buf, buflen, recursive) } static PyObject * -import_submodule(mod, subname, fullname) - PyObject *mod; /* May be None */ - char *subname; - char *fullname; +import_submodule(PyObject *mod, char *subname, char *fullname) { PyObject *modules = PyImport_GetModuleDict(); PyObject *m; @@ -1809,8 +1742,7 @@ import_submodule(mod, subname, fullname) INCREMENTED REFERENCE COUNT */ PyObject * -PyImport_ReloadModule(m) - PyObject *m; +PyImport_ReloadModule(PyObject *m) { PyObject *modules = PyImport_GetModuleDict(); PyObject *path = NULL; @@ -1876,8 +1808,7 @@ PyImport_ReloadModule(m) will return <module "gencache"> instead of <module "win32com">. */ PyObject * -PyImport_Import(module_name) - PyObject *module_name; +PyImport_Import(PyObject *module_name) { static PyObject *silly_list = NULL; static PyObject *builtins_str = NULL; @@ -1953,9 +1884,7 @@ PyImport_Import(module_name) */ static PyObject * -imp_get_magic(self, args) - PyObject *self; - PyObject *args; +imp_get_magic(PyObject *self, PyObject *args) { char buf[4]; @@ -1970,9 +1899,7 @@ imp_get_magic(self, args) } static PyObject * -imp_get_suffixes(self, args) - PyObject *self; - PyObject *args; +imp_get_suffixes(PyObject *self, PyObject *args) { PyObject *list; struct filedescr *fdp; @@ -2000,9 +1927,7 @@ imp_get_suffixes(self, args) } static PyObject * -call_find_module(name, path) - char *name; - PyObject *path; /* list or None or NULL */ +call_find_module(char *name, PyObject *path) { extern int fclose(FILE *); PyObject *fob, *ret; @@ -2034,9 +1959,7 @@ call_find_module(name, path) } static PyObject * -imp_find_module(self, args) - PyObject *self; - PyObject *args; +imp_find_module(PyObject *self, PyObject *args) { char *name; PyObject *path = NULL; @@ -2046,9 +1969,7 @@ imp_find_module(self, args) } static PyObject * -imp_init_builtin(self, args) - PyObject *self; - PyObject *args; +imp_init_builtin(PyObject *self, PyObject *args) { char *name; int ret; @@ -2068,9 +1989,7 @@ imp_init_builtin(self, args) } static PyObject * -imp_init_frozen(self, args) - PyObject *self; - PyObject *args; +imp_init_frozen(PyObject *self, PyObject *args) { char *name; int ret; @@ -2090,9 +2009,7 @@ imp_init_frozen(self, args) } static PyObject * -imp_get_frozen_object(self, args) - PyObject *self; - PyObject *args; +imp_get_frozen_object(PyObject *self, PyObject *args) { char *name; @@ -2102,9 +2019,7 @@ imp_get_frozen_object(self, args) } static PyObject * -imp_is_builtin(self, args) - PyObject *self; - PyObject *args; +imp_is_builtin(PyObject *self, PyObject *args) { char *name; if (!PyArg_ParseTuple(args, "s:is_builtin", &name)) @@ -2113,9 +2028,7 @@ imp_is_builtin(self, args) } static PyObject * -imp_is_frozen(self, args) - PyObject *self; - PyObject *args; +imp_is_frozen(PyObject *self, PyObject *args) { char *name; struct _frozen *p; @@ -2126,10 +2039,7 @@ imp_is_frozen(self, args) } static FILE * -get_file(pathname, fob, mode) - char *pathname; - PyObject *fob; - char *mode; +get_file(char *pathname, PyObject *fob, char *mode) { FILE *fp; if (fob == NULL) { @@ -2147,9 +2057,7 @@ get_file(pathname, fob, mode) } static PyObject * -imp_load_compiled(self, args) - PyObject *self; - PyObject *args; +imp_load_compiled(PyObject *self, PyObject *args) { char *name; char *pathname; @@ -2171,9 +2079,7 @@ imp_load_compiled(self, args) #ifdef HAVE_DYNAMIC_LOADING static PyObject * -imp_load_dynamic(self, args) - PyObject *self; - PyObject *args; +imp_load_dynamic(PyObject *self, PyObject *args) { char *name; char *pathname; @@ -2195,9 +2101,7 @@ imp_load_dynamic(self, args) #endif /* HAVE_DYNAMIC_LOADING */ static PyObject * -imp_load_source(self, args) - PyObject *self; - PyObject *args; +imp_load_source(PyObject *self, PyObject *args) { char *name; char *pathname; @@ -2218,9 +2122,7 @@ imp_load_source(self, args) #ifdef macintosh static PyObject * -imp_load_resource(self, args) - PyObject *self; - PyObject *args; +imp_load_resource(PyObject *self, PyObject *args) { char *name; char *pathname; @@ -2234,9 +2136,7 @@ imp_load_resource(self, args) #endif /* macintosh */ static PyObject * -imp_load_module(self, args) - PyObject *self; - PyObject *args; +imp_load_module(PyObject *self, PyObject *args) { char *name; PyObject *fob; @@ -2271,9 +2171,7 @@ imp_load_module(self, args) } static PyObject * -imp_load_package(self, args) - PyObject *self; - PyObject *args; +imp_load_package(PyObject *self, PyObject *args) { char *name; char *pathname; @@ -2283,9 +2181,7 @@ imp_load_package(self, args) } static PyObject * -imp_new_module(self, args) - PyObject *self; - PyObject *args; +imp_new_module(PyObject *self, PyObject *args) { char *name; if (!PyArg_ParseTuple(args, "s:new_module", &name)) @@ -2356,10 +2252,7 @@ static PyMethodDef imp_methods[] = { }; static int -setint(d, name, value) - PyObject *d; - char *name; - int value; +setint(PyObject *d, char *name, int value) { PyObject *v; int err; @@ -2371,7 +2264,7 @@ setint(d, name, value) } void -initimp() +initimp(void) { PyObject *m, *d; @@ -2402,8 +2295,7 @@ initimp() After a similar function by Just van Rossum. */ int -PyImport_ExtendInittab(newtab) - struct _inittab *newtab; +PyImport_ExtendInittab(struct _inittab *newtab) { static struct _inittab *our_copy = NULL; struct _inittab *p; @@ -2435,9 +2327,7 @@ PyImport_ExtendInittab(newtab) /* Shorthand to add a single entry given a name and a function */ int -PyImport_AppendInittab(name, initfunc) - char *name; - void (*initfunc)(); +PyImport_AppendInittab(char *name, void (*initfunc)(void)) { struct _inittab newtab[2]; |