]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
mgr: silence GCC warning 25199/head
authorKefu Chai <kchai@redhat.com>
Wed, 21 Nov 2018 08:56:52 +0000 (16:56 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 21 Nov 2018 09:03:30 +0000 (17:03 +0800)
commit31654a2ba6b288c901ba387f3815a26066c779d3
treed90fc9d08aca949af818c350f501829ac938f1af
parent0a0e9f0179c237ec7331bd1dc3ce85366d2a4326
mgr: silence GCC warning

the signature of PyObject_CallMethod() is different in python2 and
python3:

in python2: it is

PyObject* PyObject_CallMethod(PyObject *o, char *method, char *format,
...)

while in python3, it is

PyObject* PyObject_CallMethod(PyObject *obj, const char *name, const
char *format, ...)

so, if we compile mgr with python2, we will have following warning:

warning: ISO C++ forbids converting a string constant to ‘char*’
[-Wwrite-strings]
        (char*)NULL);
                   ^

it'd be simpler if we just const_cast<> the method name string, to
silence the warning just like other places we call
PyObject_CallMethod().

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/mgr/ActivePyModule.cc