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:
Marcelo Matus 2004-06-14 09:14:48 +00:00
parent 0b945f2dd3
commit b2ede29b59
2 changed files with 8 additions and 12 deletions

View File

@ -261,10 +261,10 @@ SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
SWIGRUNTIME(char *)
SWIG_PackData(char *c, void *ptr, int sz) {
static char hex[17] = "0123456789abcdef";
int i;
unsigned char *u = (unsigned char *) ptr;
const unsigned char *eu = u + sz;
register unsigned char uu;
for (i = 0; i < sz; i++,u++) {
for (; u != eu; ++u) {
uu = *u;
*(c++) = hex[(uu & 0xf0) >> 4];
*(c++) = hex[uu & 0xf];
@ -278,8 +278,8 @@ SWIG_UnpackData(char *c, void *ptr, int sz) {
register unsigned char uu = 0;
register int d;
unsigned char *u = (unsigned char *) ptr;
int i;
for (i = 0; i < sz; i++, u++) {
const unsigned char *eu = u + sz;
for (; u != eu; ++u) {
d = *(c++);
if ((d >= '0') && (d <= '9'))
uu = ((d - '0') << 4);

View File

@ -268,7 +268,7 @@ SWIG_Python_ConvertPtr(PyObject *obj, void **ptr, swig_type_info *ty, int flags)
goto type_error;
}
}
c = PyString_AsString(obj);
c = PyString_AS_STRING(obj);
/* Pointer values must start with leading underscore */
if (*c != '_') {
*ptr = (void *) 0;
@ -296,9 +296,7 @@ cobject:
}
if ((pyobj) && (flags & SWIG_POINTER_DISOWN)) {
PyObject *zero = PyInt_FromLong(0);
PyObject_SetAttrString(pyobj,(char*)"thisown",zero);
Py_DECREF(zero);
PyObject_SetAttrString(pyobj,(char*)"thisown",Py_False);
}
return 0;
@ -331,7 +329,7 @@ SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, int sz, swig_type_info *ty,
char *c = 0;
if ((!obj) || (!PyString_Check(obj))) goto type_error;
c = PyString_AsString(obj);
c = PyString_AS_STRING(obj);
/* Pointer values must start with leading underscore */
if (*c != '_') goto type_error;
c++;
@ -385,9 +383,7 @@ SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int own) {
Py_DECREF(args);
if (inst) {
if (own) {
PyObject *n = PyInt_FromLong(1);
PyObject_SetAttrString(inst,(char*)"thisown",n);
Py_DECREF(n);
PyObject_SetAttrString(inst,(char*)"thisown",Py_True);
}
robj = inst;
}