mirror of https://github.com/swig/swig
some performance improvements
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5982 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
0b945f2dd3
commit
b2ede29b59
|
@ -261,10 +261,10 @@ SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
|
||||||
SWIGRUNTIME(char *)
|
SWIGRUNTIME(char *)
|
||||||
SWIG_PackData(char *c, void *ptr, int sz) {
|
SWIG_PackData(char *c, void *ptr, int sz) {
|
||||||
static char hex[17] = "0123456789abcdef";
|
static char hex[17] = "0123456789abcdef";
|
||||||
int i;
|
|
||||||
unsigned char *u = (unsigned char *) ptr;
|
unsigned char *u = (unsigned char *) ptr;
|
||||||
|
const unsigned char *eu = u + sz;
|
||||||
register unsigned char uu;
|
register unsigned char uu;
|
||||||
for (i = 0; i < sz; i++,u++) {
|
for (; u != eu; ++u) {
|
||||||
uu = *u;
|
uu = *u;
|
||||||
*(c++) = hex[(uu & 0xf0) >> 4];
|
*(c++) = hex[(uu & 0xf0) >> 4];
|
||||||
*(c++) = hex[uu & 0xf];
|
*(c++) = hex[uu & 0xf];
|
||||||
|
@ -278,8 +278,8 @@ SWIG_UnpackData(char *c, void *ptr, int sz) {
|
||||||
register unsigned char uu = 0;
|
register unsigned char uu = 0;
|
||||||
register int d;
|
register int d;
|
||||||
unsigned char *u = (unsigned char *) ptr;
|
unsigned char *u = (unsigned char *) ptr;
|
||||||
int i;
|
const unsigned char *eu = u + sz;
|
||||||
for (i = 0; i < sz; i++, u++) {
|
for (; u != eu; ++u) {
|
||||||
d = *(c++);
|
d = *(c++);
|
||||||
if ((d >= '0') && (d <= '9'))
|
if ((d >= '0') && (d <= '9'))
|
||||||
uu = ((d - '0') << 4);
|
uu = ((d - '0') << 4);
|
||||||
|
|
|
@ -268,7 +268,7 @@ SWIG_Python_ConvertPtr(PyObject *obj, void **ptr, swig_type_info *ty, int flags)
|
||||||
goto type_error;
|
goto type_error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
c = PyString_AsString(obj);
|
c = PyString_AS_STRING(obj);
|
||||||
/* Pointer values must start with leading underscore */
|
/* Pointer values must start with leading underscore */
|
||||||
if (*c != '_') {
|
if (*c != '_') {
|
||||||
*ptr = (void *) 0;
|
*ptr = (void *) 0;
|
||||||
|
@ -296,9 +296,7 @@ cobject:
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((pyobj) && (flags & SWIG_POINTER_DISOWN)) {
|
if ((pyobj) && (flags & SWIG_POINTER_DISOWN)) {
|
||||||
PyObject *zero = PyInt_FromLong(0);
|
PyObject_SetAttrString(pyobj,(char*)"thisown",Py_False);
|
||||||
PyObject_SetAttrString(pyobj,(char*)"thisown",zero);
|
|
||||||
Py_DECREF(zero);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -331,7 +329,7 @@ SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, int sz, swig_type_info *ty,
|
||||||
char *c = 0;
|
char *c = 0;
|
||||||
|
|
||||||
if ((!obj) || (!PyString_Check(obj))) goto type_error;
|
if ((!obj) || (!PyString_Check(obj))) goto type_error;
|
||||||
c = PyString_AsString(obj);
|
c = PyString_AS_STRING(obj);
|
||||||
/* Pointer values must start with leading underscore */
|
/* Pointer values must start with leading underscore */
|
||||||
if (*c != '_') goto type_error;
|
if (*c != '_') goto type_error;
|
||||||
c++;
|
c++;
|
||||||
|
@ -385,9 +383,7 @@ SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int own) {
|
||||||
Py_DECREF(args);
|
Py_DECREF(args);
|
||||||
if (inst) {
|
if (inst) {
|
||||||
if (own) {
|
if (own) {
|
||||||
PyObject *n = PyInt_FromLong(1);
|
PyObject_SetAttrString(inst,(char*)"thisown",Py_True);
|
||||||
PyObject_SetAttrString(inst,(char*)"thisown",n);
|
|
||||||
Py_DECREF(n);
|
|
||||||
}
|
}
|
||||||
robj = inst;
|
robj = inst;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue