More unconsting.

This commit is contained in:
Martin v. Löwis 2006-02-27 17:20:04 +00:00
parent f4e6928c4d
commit 02cbf4ae4b
9 changed files with 56 additions and 62 deletions

View File

@ -40,7 +40,7 @@ bisect_right(PyObject *self, PyObject *args, PyObject *kw)
int lo = 0;
int hi = -1;
int index;
static const char *keywords[] = {"a", "x", "lo", "hi", NULL};
static char *keywords[] = {"a", "x", "lo", "hi", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kw, "OO|ii:bisect_right",
keywords, &list, &item, &lo, &hi))
@ -70,7 +70,7 @@ insort_right(PyObject *self, PyObject *args, PyObject *kw)
int lo = 0;
int hi = -1;
int index;
static const char *keywords[] = {"a", "x", "lo", "hi", NULL};
static char *keywords[] = {"a", "x", "lo", "hi", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kw, "OO|ii:insort_right",
keywords, &list, &item, &lo, &hi))
@ -137,7 +137,7 @@ bisect_left(PyObject *self, PyObject *args, PyObject *kw)
int lo = 0;
int hi = -1;
int index;
static const char *keywords[] = {"a", "x", "lo", "hi", NULL};
static char *keywords[] = {"a", "x", "lo", "hi", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kw, "OO|ii:bisect_left",
keywords, &list, &item, &lo, &hi))
@ -167,7 +167,7 @@ insort_left(PyObject *self, PyObject *args, PyObject *kw)
int lo = 0;
int hi = -1;
int index;
static const char *keywords[] = {"a", "x", "lo", "hi", NULL};
static char *keywords[] = {"a", "x", "lo", "hi", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kw, "OO|ii:insort_left",
keywords, &list, &item, &lo, &hi))

View File

@ -651,7 +651,7 @@ static PyObject* _DBCursor_get(DBCursorObject* self, int extra_flags,
int dlen = -1;
int doff = -1;
int flags = 0;
static const char* kwnames[] = { "flags", "dlen", "doff", NULL };
static char* kwnames[] = { "flags", "dlen", "doff", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, format, kwnames,
&flags, &dlen, &doff))
@ -1150,10 +1150,10 @@ DB_associate(DBObject* self, PyObject* args, PyObject* kwargs)
#if (DBVER >= 41)
PyObject *txnobj = NULL;
DB_TXN *txn = NULL;
static const char* kwnames[] = {"secondaryDB", "callback", "flags", "txn",
static char* kwnames[] = {"secondaryDB", "callback", "flags", "txn",
NULL};
#else
static const char* kwnames[] = {"secondaryDB", "callback", "flags", NULL};
static char* kwnames[] = {"secondaryDB", "callback", "flags", NULL};
#endif
#if (DBVER >= 41)
@ -1259,7 +1259,7 @@ _DB_consume(DBObject* self, PyObject* args, PyObject* kwargs, int consume_flag)
PyObject* retval = NULL;
DBT key, data;
DB_TXN *txn = NULL;
static const char* kwnames[] = { "txn", "flags", NULL };
static char* kwnames[] = { "txn", "flags", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Oi:consume", kwnames,
&txnobj, &flags))
@ -1329,7 +1329,7 @@ DB_cursor(DBObject* self, PyObject* args, PyObject* kwargs)
DBC* dbc;
PyObject* txnobj = NULL;
DB_TXN *txn = NULL;
static const char* kwnames[] = { "txn", "flags", NULL };
static char* kwnames[] = { "txn", "flags", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Oi:cursor", kwnames,
&txnobj, &flags))
@ -1354,7 +1354,7 @@ DB_delete(DBObject* self, PyObject* args, PyObject* kwargs)
PyObject* keyobj;
DBT key;
DB_TXN *txn = NULL;
static const char* kwnames[] = { "key", "txn", "flags", NULL };
static char* kwnames[] = { "key", "txn", "flags", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|Oi:delete", kwnames,
&keyobj, &txnobj, &flags))
@ -1406,7 +1406,7 @@ DB_get(DBObject* self, PyObject* args, PyObject* kwargs)
int doff = -1;
DBT key, data;
DB_TXN *txn = NULL;
static const char* kwnames[] = {"key", "default", "txn", "flags", "dlen",
static char* kwnames[] = {"key", "default", "txn", "flags", "dlen",
"doff", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OOiii:get", kwnames,
@ -1474,7 +1474,7 @@ DB_pget(DBObject* self, PyObject* args, PyObject* kwargs)
int doff = -1;
DBT key, pkey, data;
DB_TXN *txn = NULL;
static const char* kwnames[] = {"key", "default", "txn", "flags", "dlen",
static char* kwnames[] = {"key", "default", "txn", "flags", "dlen",
"doff", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OOiii:pget", kwnames,
@ -1572,7 +1572,7 @@ DB_get_size(DBObject* self, PyObject* args, PyObject* kwargs)
PyObject* retval = NULL;
DBT key, data;
DB_TXN *txn = NULL;
static const char* kwnames[] = { "key", "txn", NULL };
static char* kwnames[] = { "key", "txn", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:get_size", kwnames,
&keyobj, &txnobj))
@ -1615,7 +1615,7 @@ DB_get_both(DBObject* self, PyObject* args, PyObject* kwargs)
PyObject* retval = NULL;
DBT key, data;
DB_TXN *txn = NULL;
static const char* kwnames[] = { "key", "data", "txn", "flags", NULL };
static char* kwnames[] = { "key", "data", "txn", "flags", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|Oi:get_both", kwnames,
@ -1766,7 +1766,7 @@ DB_key_range(DBObject* self, PyObject* args, PyObject* kwargs)
DBT key;
DB_TXN *txn = NULL;
DB_KEY_RANGE range;
static const char* kwnames[] = { "key", "txn", "flags", NULL };
static char* kwnames[] = { "key", "txn", "flags", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|Oi:key_range", kwnames,
&keyobj, &txnobj, &flags))
@ -1797,17 +1797,17 @@ DB_open(DBObject* self, PyObject* args, PyObject* kwargs)
PyObject *txnobj = NULL;
DB_TXN *txn = NULL;
/* with dbname */
static const char* kwnames[] = {
static char* kwnames[] = {
"filename", "dbname", "dbtype", "flags", "mode", "txn", NULL};
/* without dbname */
static const char* kwnames_basic[] = {
"filename", "dbtype", "flags", "mode", "txn", NULL};
#else
/* with dbname */
static const char* kwnames[] = {
static char* kwnames[] = {
"filename", "dbname", "dbtype", "flags", "mode", NULL};
/* without dbname */
static const char* kwnames_basic[] = {
static char* kwnames_basic[] = {
"filename", "dbtype", "flags", "mode", NULL};
#endif
@ -1891,7 +1891,7 @@ DB_put(DBObject* self, PyObject* args, PyObject* kwargs)
PyObject* keyobj, *dataobj, *retval;
DBT key, data;
DB_TXN *txn = NULL;
static const char* kwnames[] = { "key", "data", "txn", "flags", "dlen",
static char* kwnames[] = { "key", "data", "txn", "flags", "dlen",
"doff", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|Oiii:put", kwnames,
@ -1932,7 +1932,7 @@ DB_remove(DBObject* self, PyObject* args, PyObject* kwargs)
char* filename;
char* database = NULL;
int err, flags=0;
static const char* kwnames[] = { "filename", "dbname", "flags", NULL};
static char* kwnames[] = { "filename", "dbname", "flags", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|zi:remove", kwnames,
&filename, &database, &flags))
@ -2350,9 +2350,9 @@ DB_stat(DBObject* self, PyObject* args, PyObject* kwargs)
#if (DBVER >= 43)
PyObject* txnobj = NULL;
DB_TXN *txn = NULL;
static const char* kwnames[] = { "txn", "flags", NULL };
static char* kwnames[] = { "txn", "flags", NULL };
#else
static const char* kwnames[] = { "flags", NULL };
static char* kwnames[] = { "flags", NULL };
#endif
#if (DBVER >= 43)
@ -2492,7 +2492,7 @@ DB_truncate(DBObject* self, PyObject* args, PyObject* kwargs)
u_int32_t count=0;
PyObject* txnobj = NULL;
DB_TXN *txn = NULL;
static const char* kwnames[] = { "txn", "flags", NULL };
static char* kwnames[] = { "txn", "flags", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Oi:cursor", kwnames,
&txnobj, &flags))
@ -2536,7 +2536,7 @@ DB_verify(DBObject* self, PyObject* args, PyObject* kwargs)
char* dbName=NULL;
char* outFileName=NULL;
FILE* outFile=NULL;
static const char* kwnames[] = { "filename", "dbname", "outfile", "flags",
static char* kwnames[] = { "filename", "dbname", "outfile", "flags",
NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|zzi:verify", kwnames,
@ -2594,7 +2594,7 @@ DB_set_encrypt(DBObject* self, PyObject* args, PyObject* kwargs)
int err;
u_int32_t flags=0;
char *passwd = NULL;
static const char* kwnames[] = { "passwd", "flags", NULL };
static char* kwnames[] = { "passwd", "flags", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|i:set_encrypt", kwnames,
&passwd, &flags)) {
@ -3034,7 +3034,7 @@ DBC_get(DBCursorObject* self, PyObject* args, PyObject *kwargs)
int dlen = -1;
int doff = -1;
DBT key, data;
static const char* kwnames[] = { "key","data", "flags", "dlen", "doff",
static char* kwnames[] = { "key","data", "flags", "dlen", "doff",
NULL };
CLEAR_DBT(key);
@ -3121,7 +3121,7 @@ DBC_pget(DBCursorObject* self, PyObject* args, PyObject *kwargs)
int dlen = -1;
int doff = -1;
DBT key, pkey, data;
static const char* kwnames[] = { "key","data", "flags", "dlen", "doff",
static char* kwnames[] = { "key","data", "flags", "dlen", "doff",
NULL };
CLEAR_DBT(key);
@ -3283,7 +3283,7 @@ DBC_put(DBCursorObject* self, PyObject* args, PyObject* kwargs)
int err, flags = 0;
PyObject* keyobj, *dataobj;
DBT key, data;
static const char* kwnames[] = { "key", "data", "flags", "dlen", "doff",
static char* kwnames[] = { "key", "data", "flags", "dlen", "doff",
NULL };
int dlen = -1;
int doff = -1;
@ -3319,7 +3319,7 @@ DBC_set(DBCursorObject* self, PyObject* args, PyObject *kwargs)
int err, flags = 0;
DBT key, data;
PyObject* retval, *keyobj;
static const char* kwnames[] = { "key", "flags", "dlen", "doff", NULL };
static char* kwnames[] = { "key", "flags", "dlen", "doff", NULL };
int dlen = -1;
int doff = -1;
@ -3389,7 +3389,7 @@ DBC_set_range(DBCursorObject* self, PyObject* args, PyObject* kwargs)
int err, flags = 0;
DBT key, data;
PyObject* retval, *keyobj;
static const char* kwnames[] = { "key", "flags", "dlen", "doff", NULL };
static char* kwnames[] = { "key", "flags", "dlen", "doff", NULL };
int dlen = -1;
int doff = -1;
@ -3579,7 +3579,7 @@ DBC_set_recno(DBCursorObject* self, PyObject* args, PyObject *kwargs)
PyObject* retval;
int dlen = -1;
int doff = -1;
static const char* kwnames[] = { "recno","flags", "dlen", "doff", NULL };
static char* kwnames[] = { "recno","flags", "dlen", "doff", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|iii:set_recno", kwnames,
&irecno, &flags, &dlen, &doff))
@ -3773,7 +3773,7 @@ DBEnv_dbremove(DBEnvObject* self, PyObject* args, PyObject* kwargs)
char *database = NULL;
PyObject *txnobj = NULL;
DB_TXN *txn = NULL;
static const char* kwnames[] = { "file", "database", "txn", "flags",
static char* kwnames[] = { "file", "database", "txn", "flags",
NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ss|Oi:dbremove", kwnames,
@ -3801,7 +3801,7 @@ DBEnv_dbrename(DBEnvObject* self, PyObject* args, PyObject* kwargs)
char *newname = NULL;
PyObject *txnobj = NULL;
DB_TXN *txn = NULL;
static const char* kwnames[] = { "file", "database", "newname", "txn",
static char* kwnames[] = { "file", "database", "newname", "txn",
"flags", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sss|Oi:dbrename", kwnames,
@ -3826,7 +3826,7 @@ DBEnv_set_encrypt(DBEnvObject* self, PyObject* args, PyObject* kwargs)
int err;
u_int32_t flags=0;
char *passwd = NULL;
static const char* kwnames[] = { "passwd", "flags", NULL };
static char* kwnames[] = { "passwd", "flags", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|i:set_encrypt", kwnames,
&passwd, &flags)) {
@ -3849,7 +3849,7 @@ DBEnv_set_timeout(DBEnvObject* self, PyObject* args, PyObject* kwargs)
int err;
u_int32_t flags=0;
u_int32_t timeout = 0;
static const char* kwnames[] = { "timeout", "flags", NULL };
static char* kwnames[] = { "timeout", "flags", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:set_timeout", kwnames,
&timeout, &flags)) {
@ -4136,7 +4136,7 @@ DBEnv_txn_begin(DBEnvObject* self, PyObject* args, PyObject* kwargs)
int flags = 0;
PyObject* txnobj = NULL;
DB_TXN *txn = NULL;
static const char* kwnames[] = { "parent", "flags", NULL };
static char* kwnames[] = { "parent", "flags", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Oi:txn_begin", kwnames,
&txnobj, &flags))
@ -4986,7 +4986,7 @@ DB_construct(PyObject* self, PyObject* args, PyObject* kwargs)
{
PyObject* dbenvobj = NULL;
int flags = 0;
static const char* kwnames[] = { "dbEnv", "flags", NULL};
static char* kwnames[] = { "dbEnv", "flags", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Oi:DB", kwnames,
&dbenvobj, &flags))

View File

@ -291,7 +291,7 @@ Dialect_dealloc(DialectObj *self)
self->ob_type->tp_free((PyObject *)self);
}
static const char *dialect_kws[] = {
static char *dialect_kws[] = {
"dialect",
"delimiter",
"doublequote",

View File

@ -106,12 +106,6 @@ typedef int Py_ssize_t;
#endif
#endif
#if (PY_VERSION_HEX >= 0x02050000)
#define PY_CONST const /* 2.5 adds const to some API:s */
#else
#define PY_CONST
#endif
#if !defined(Py_RETURN_NONE)
#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
#endif
@ -2192,7 +2186,7 @@ xmlparser(PyObject* _self, PyObject* args, PyObject* kw)
PyObject* target = NULL;
char* encoding = NULL;
static PY_CONST char* kwlist[] = { "target", "encoding", NULL };
static char* kwlist[] = { "target", "encoding", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kw, "|Oz:XMLParser", kwlist,
&target, &encoding))
return NULL;

View File

@ -45,8 +45,8 @@ PyDoc_STRVAR(MultibyteCodec_StreamReader__doc__,
PyDoc_STRVAR(MultibyteCodec_StreamWriter__doc__,
"I.StreamWriter(stream[, errors]) -> StreamWriter instance");
static const char *codeckwarglist[] = {"input", "errors", NULL};
static const char *streamkwarglist[] = {"stream", "errors", NULL};
static char *codeckwarglist[] = {"input", "errors", NULL};
static char *streamkwarglist[] = {"stream", "errors", NULL};
static PyObject *multibytecodec_encode(MultibyteCodec *,
MultibyteCodec_State *, const Py_UNICODE **, size_t,

View File

@ -1891,7 +1891,7 @@ delta_new(PyTypeObject *type, PyObject *args, PyObject *kw)
PyObject *y = NULL; /* temp sum of microseconds */
double leftover_us = 0.0;
static const char *keywords[] = {
static char *keywords[] = {
"days", "seconds", "microseconds", "milliseconds",
"minutes", "hours", "weeks", NULL
};
@ -2194,7 +2194,7 @@ static PyGetSetDef date_getset[] = {
/* Constructors. */
static const char *date_kws[] = {"year", "month", "day", NULL};
static char *date_kws[] = {"year", "month", "day", NULL};
static PyObject *
date_new(PyTypeObject *type, PyObject *args, PyObject *kw)
@ -2448,7 +2448,7 @@ date_strftime(PyDateTime_Date *self, PyObject *args, PyObject *kw)
PyObject *result;
PyObject *format;
PyObject *tuple;
static const char *keywords[] = {"format", NULL};
static char *keywords[] = {"format", NULL};
if (! PyArg_ParseTupleAndKeywords(args, kw, "O!:strftime", keywords,
&PyString_Type, &format))
@ -3028,7 +3028,7 @@ static PyGetSetDef time_getset[] = {
* Constructors.
*/
static const char *time_kws[] = {"hour", "minute", "second", "microsecond",
static char *time_kws[] = {"hour", "minute", "second", "microsecond",
"tzinfo", NULL};
static PyObject *
@ -3196,7 +3196,7 @@ time_strftime(PyDateTime_Time *self, PyObject *args, PyObject *kw)
PyObject *result;
PyObject *format;
PyObject *tuple;
static const char *keywords[] = {"format", NULL};
static char *keywords[] = {"format", NULL};
if (! PyArg_ParseTupleAndKeywords(args, kw, "O!:strftime", keywords,
&PyString_Type, &format))
@ -3548,7 +3548,7 @@ static PyGetSetDef datetime_getset[] = {
* Constructors.
*/
static const char *datetime_kws[] = {
static char *datetime_kws[] = {
"year", "month", "day", "hour", "minute", "second",
"microsecond", "tzinfo", NULL
};
@ -3729,7 +3729,7 @@ datetime_now(PyObject *cls, PyObject *args, PyObject *kw)
{
PyObject *self;
PyObject *tzinfo = Py_None;
static const char *keywords[] = {"tz", NULL};
static char *keywords[] = {"tz", NULL};
if (! PyArg_ParseTupleAndKeywords(args, kw, "|O:now", keywords,
&tzinfo))
@ -3765,7 +3765,7 @@ datetime_fromtimestamp(PyObject *cls, PyObject *args, PyObject *kw)
PyObject *self;
double timestamp;
PyObject *tzinfo = Py_None;
static const char *keywords[] = {"timestamp", "tz", NULL};
static char *keywords[] = {"timestamp", "tz", NULL};
if (! PyArg_ParseTupleAndKeywords(args, kw, "d|O:fromtimestamp",
keywords, &timestamp, &tzinfo))
@ -3843,7 +3843,7 @@ datetime_strptime(PyObject *cls, PyObject *args)
static PyObject *
datetime_combine(PyObject *cls, PyObject *args, PyObject *kw)
{
static const char *keywords[] = {"date", "time", NULL};
static char *keywords[] = {"date", "time", NULL};
PyObject *date;
PyObject *time;
PyObject *result = NULL;
@ -4070,7 +4070,7 @@ static PyObject *
datetime_isoformat(PyDateTime_DateTime *self, PyObject *args, PyObject *kw)
{
char sep = 'T';
static const char *keywords[] = {"sep", NULL};
static char *keywords[] = {"sep", NULL};
char buffer[100];
char *cp;
PyObject *result;
@ -4261,7 +4261,7 @@ datetime_astimezone(PyDateTime_DateTime *self, PyObject *args, PyObject *kw)
int offset, none;
PyObject *tzinfo;
static const char *keywords[] = {"tz", NULL};
static char *keywords[] = {"tz", NULL};
if (! PyArg_ParseTupleAndKeywords(args, kw, "O!:astimezone", keywords,
&PyDateTime_TZInfoType, &tzinfo))

View File

@ -26,7 +26,7 @@ static PyObject *_grouper_create(groupbyobject *, PyObject *);
static PyObject *
groupby_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
static const char *kwargs[] = {"iterable", "key", NULL};
static char *kwargs[] = {"iterable", "key", NULL};
groupbyobject *gbo;
PyObject *it, *keyfunc = Py_None;

View File

@ -874,7 +874,7 @@ new_mmap_object(PyObject *self, PyObject *args, PyObject *kwdict)
int fd, flags = MAP_SHARED, prot = PROT_WRITE | PROT_READ;
int devzero = -1;
int access = (int)ACCESS_DEFAULT;
static const char *keywords[] = {"fileno", "length",
static char *keywords[] = {"fileno", "length",
"flags", "prot",
"access", NULL};
@ -992,7 +992,7 @@ new_mmap_object(PyObject *self, PyObject *args, PyObject *kwdict)
HANDLE fh = 0;
int access = (access_mode)ACCESS_DEFAULT;
DWORD flProtect, dwDesiredAccess;
static const char *keywords[] = { "fileno", "length",
static char *keywords[] = { "fileno", "length",
"tagname",
"access", NULL };

View File

@ -2566,7 +2566,7 @@ sock_initobj(PyObject *self, PyObject *args, PyObject *kwds)
PySocketSockObject *s = (PySocketSockObject *)self;
SOCKET_T fd;
int family = AF_INET, type = SOCK_STREAM, proto = 0;
static const char *keywords[] = {"family", "type", "proto", 0};
static char *keywords[] = {"family", "type", "proto", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds,
"|iii:socket", keywords,