summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-02-15 16:38:53 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:53:58 -0300
commit7c606aeda23b4469ca924ebb974b1eac397ff0e5 (patch)
tree201c09967ef2df716bd319084762891df7787a0d
parent0f29c21f6e9364593831c0d03693c36a2858dc0a (diff)
Refactor to simplify code just avoding some Cism.
-rw-r--r--libpyside/pysidesignal.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/libpyside/pysidesignal.cpp b/libpyside/pysidesignal.cpp
index 3fc8b8ed..1fe4b7f8 100644
--- a/libpyside/pysidesignal.cpp
+++ b/libpyside/pysidesignal.cpp
@@ -664,12 +664,10 @@ PySideSignal* newObject(const char* name, ...)
PyObject* buildQtCompatible(const char* signature)
{
- char* qtSignature;
- qtSignature = reinterpret_cast<char*>(malloc(strlen(signature)+2));
- sprintf(qtSignature, "%c%s", QT_SIGNAL_SENTINEL, signature);
- PyObject* ret = PyString_FromString(qtSignature);
- free(qtSignature);
- return ret;
+ QByteArray ba;
+ ba.append(QT_SIGNAL_SENTINEL);
+ ba.append(signature);
+ return PyString_FromStringAndSize(ba, ba.size());
}
void addSignalToWrapper(SbkObjectType* wrapperType, const char* signalName, PySideSignal* signal)