summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2011-12-21 17:40:44 -0500
committerAles Kozumplik <akozumpl@redhat.com>2011-12-22 10:49:56 +0100
commita9e6f2ab9d0d390b5147deaa066b7d1d50429704 (patch)
tree17e4fada03d37907bf41610bfa81f3340382e462 /python
parent5538280ed8f1b29fd37172a11e206517ccb8a8ef (diff)
downloadlibrpm-tizen-a9e6f2ab9d0d390b5147deaa066b7d1d50429704.tar.gz
librpm-tizen-a9e6f2ab9d0d390b5147deaa066b7d1d50429704.tar.bz2
librpm-tizen-a9e6f2ab9d0d390b5147deaa066b7d1d50429704.zip
mark strings extracted from PyArg_Parse* as "const"
- Various places within the bindings use PyArg_ParseTuple[AndKeywords] to extract (char*) string arguments. These are pointers to the internal representation of a PyStringObject, and shouldn't be modified, hence it's safest to explicitly mark these values as (const char*), rather than just (char*). Signed-off-by: Ales Kozumplik <akozumpl@redhat.com>
Diffstat (limited to 'python')
-rw-r--r--python/header-py.c4
-rw-r--r--python/rpmfd-py.c4
-rw-r--r--python/rpmmacro-py.c6
-rw-r--r--python/rpmmi-py.c2
-rw-r--r--python/rpmmodule.c4
-rw-r--r--python/rpmts-py.c2
6 files changed, 11 insertions, 11 deletions
diff --git a/python/header-py.c b/python/header-py.c
index d312f5431..26103445f 100644
--- a/python/header-py.c
+++ b/python/header-py.c
@@ -232,7 +232,7 @@ static PyObject * hdrFullFilelist(hdrObject * s)
static PyObject * hdrFormat(hdrObject * s, PyObject * args, PyObject * kwds)
{
- char * fmt;
+ const char * fmt;
char * r;
errmsg_t err;
PyObject * result;
@@ -859,7 +859,7 @@ static int compare_values(const char *str1, const char *str2)
PyObject * labelCompare (PyObject * self, PyObject * args)
{
- char *v1, *r1, *v2, *r2;
+ const char *v1, *r1, *v2, *r2;
const char *e1, *e2;
int rc;
diff --git a/python/rpmfd-py.c b/python/rpmfd-py.c
index 1150aa1b2..2d443f36f 100644
--- a/python/rpmfd-py.c
+++ b/python/rpmfd-py.c
@@ -57,8 +57,8 @@ static FD_t openPath(const char *path, const char *mode, const char *flags)
static int rpmfd_init(rpmfdObject *s, PyObject *args, PyObject *kwds)
{
char *kwlist[] = { "obj", "mode", "flags", NULL };
- char *mode = "r";
- char *flags = "ufdio";
+ const char *mode = "r";
+ const char *flags = "ufdio";
PyObject *fo = NULL;
FD_t fd = NULL;
int fdno;
diff --git a/python/rpmmacro-py.c b/python/rpmmacro-py.c
index 074861d86..3eb0acb56 100644
--- a/python/rpmmacro-py.c
+++ b/python/rpmmacro-py.c
@@ -7,7 +7,7 @@
PyObject *
rpmmacro_AddMacro(PyObject * self, PyObject * args, PyObject * kwds)
{
- char * name, * val;
+ const char * name, * val;
char * kwlist[] = {"name", "value", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "ss:AddMacro", kwlist,
@@ -22,7 +22,7 @@ rpmmacro_AddMacro(PyObject * self, PyObject * args, PyObject * kwds)
PyObject *
rpmmacro_DelMacro(PyObject * self, PyObject * args, PyObject * kwds)
{
- char * name;
+ const char * name;
char * kwlist[] = {"name", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "s:DelMacro", kwlist, &name))
@@ -36,7 +36,7 @@ rpmmacro_DelMacro(PyObject * self, PyObject * args, PyObject * kwds)
PyObject *
rpmmacro_ExpandMacro(PyObject * self, PyObject * args, PyObject * kwds)
{
- char *macro;
+ const char *macro;
PyObject *res;
int num = 0;
char * kwlist[] = {"macro", "numeric", NULL};
diff --git a/python/rpmmi-py.c b/python/rpmmi-py.c
index 91eb21c4b..977e47552 100644
--- a/python/rpmmi-py.c
+++ b/python/rpmmi-py.c
@@ -99,7 +99,7 @@ static PyObject *
rpmmi_Pattern(rpmmiObject * s, PyObject * args, PyObject * kwds)
{
int type;
- char * pattern;
+ const char * pattern;
rpmTagVal tag;
char * kwlist[] = {"tag", "type", "patern", NULL};
diff --git a/python/rpmmodule.c b/python/rpmmodule.c
index f9149cbab..f2e0ed746 100644
--- a/python/rpmmodule.c
+++ b/python/rpmmodule.c
@@ -28,7 +28,7 @@ PyObject * pyrpmError;
static PyObject * archScore(PyObject * self, PyObject * arg)
{
- char * arch;
+ const char * arch;
if (!PyArg_Parse(arg, "s", &arch))
return NULL;
@@ -117,7 +117,7 @@ static PyObject * doLog(PyObject * self, PyObject * args, PyObject *kwds)
static PyObject * reloadConfig(PyObject * self, PyObject * args, PyObject *kwds)
{
- char * target = NULL;
+ const char * target = NULL;
char * kwlist[] = { "target", NULL };
int rc;
diff --git a/python/rpmts-py.c b/python/rpmts-py.c
index 854d3a1ee..5c6e9baf3 100644
--- a/python/rpmts-py.c
+++ b/python/rpmts-py.c
@@ -751,7 +751,7 @@ static PyObject * rpmts_new(PyTypeObject * subtype, PyObject *args, PyObject *kw
static int rpmts_init(rpmtsObject *s, PyObject *args, PyObject *kwds)
{
- char * rootDir = "/";
+ const char * rootDir = "/";
rpmVSFlags vsflags = rpmExpandNumeric("%{?__vsflags}");
char * kwlist[] = {"rootdir", "vsflags", 0};