diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2000-06-18 14:51:21 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2000-06-18 14:51:21 (GMT) |
commit | 6fef30e1fad0775b80e37d9465fe5cbe3531418d (patch) | |
tree | e8700a459daa274c463f9a606a2295138b802cb1 | |
parent | 1d15869534582e45d2b15c3d2db0b4d62221265b (diff) | |
download | cpython-6fef30e1fad0775b80e37d9465fe5cbe3531418d.zip cpython-6fef30e1fad0775b80e37d9465fe5cbe3531418d.tar.gz cpython-6fef30e1fad0775b80e37d9465fe5cbe3531418d.tar.bz2 |
Support resizing the mapping depending on whether HAVE_MREMAP is defined
Remove two unused variables
-rw-r--r-- | Modules/mmapmodule.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 03960fc..4b18466 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -334,7 +334,7 @@ mmap_resize_method (mmap_object * self, #endif /* MS_WIN32 */ #ifdef UNIX -#ifndef MREMAP_MAYMOVE +#ifndef HAVE_MREMAP } else { PyErr_SetString(PyExc_SystemError, "mmap: resizing not available--no mremap()"); @@ -343,7 +343,11 @@ mmap_resize_method (mmap_object * self, } else { void *newmap; +#ifdef MREMAP_MAYMOVE newmap = mremap(self->data, self->size, new_size, MREMAP_MAYMOVE); +#else + newmap = mremap(self->data, self->size, new_size, 0); +#endif if (newmap == (void *)-1) { PyErr_SetFromErrno(mmap_module_error); @@ -353,7 +357,7 @@ mmap_resize_method (mmap_object * self, self->size = new_size; Py_INCREF(Py_None); return Py_None; -#endif /* MREMAP_MAYMOVE */ +#endif /* HAVE_MREMAP */ #endif /* UNIX */ } } @@ -774,8 +778,6 @@ new_mmap_object (PyObject * self, PyObject * args, PyObject *kwdict) PyObject *map_size_obj = NULL; int map_size; int fd, flags = MAP_SHARED, prot = PROT_WRITE | PROT_READ; - char * filename; - int namelen; char *keywords[] = {"file", "size", "flags", "prot", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwdict, |