diff options
-rw-r--r-- | CHANGES.current | 28 | ||||
-rw-r--r-- | Lib/perl5/perlstrings.swg | 15 | ||||
-rw-r--r-- | Lib/python/pystrings.swg | 14 | ||||
-rw-r--r-- | Lib/python/pywstrings.swg | 12 | ||||
-rw-r--r-- | Lib/ruby/rubystrings.swg | 14 | ||||
-rw-r--r-- | Lib/typemaps/std_strings.swg | 34 |
6 files changed, 81 insertions, 36 deletions
diff --git a/CHANGES.current b/CHANGES.current index 385cdda96..b92db4424 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -1,6 +1,34 @@ Version 1.3.28 (unreleased). =========================== +12/10/2005: mmatus + [UTF] + - Fix inneccessary calls to SWIG_TypeQuery for 'char *' + and 'wchar_t *', problem found by Clay Culver while + profiling the PyOgre project. + + + [Python] + - Add the -dirvtable/-nodirvtable to enable/disable + a pseudo virtual table used for directors, avoiding + to resolv the python method at each call. + + - Add the -safecstrings/-nosafecstrings options to + enable/disable the use of safe conversions from PyString + to char *. Python requires you never change the internal + buffer directly, and henve 'safectrings' warranties that + but returning a copy of the internal python string buffer. + + The default, as in previous releases, is to return a + pointer to the buffer (nosafecstrings), so, is the user + responsability to avoid its modification. + + - Add the -O option to enable all the optimization options + at once, equivalent to + + -modern -fastdispatch -dirvtable -nosafecstrings -fvirtual -fcompact + + 12/08/2005: mmatus - Add the -fastdispatch option (fastdispatch feature). This diff --git a/Lib/perl5/perlstrings.swg b/Lib/perl5/perlstrings.swg index 9362f1917..b3d1a9eb0 100644 --- a/Lib/perl5/perlstrings.swg +++ b/Lib/perl5/perlstrings.swg @@ -23,16 +23,17 @@ SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc) if (psize) *psize = size; return SWIG_OK; } else { - char* vptr = 0; swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); - if (pchar_descriptor && (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK)) { - if (cptr) *cptr = vptr; - if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0; - if (alloc) *alloc = SWIG_OLDOBJ; - return SWIG_OK; + if (pchar_descriptor) { + char* vptr = 0; + if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) { + if (cptr) *cptr = vptr; + if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0; + if (alloc) *alloc = SWIG_OLDOBJ; + return SWIG_OK; + } } } - return SWIG_TypeError; } } diff --git a/Lib/python/pystrings.swg b/Lib/python/pystrings.swg index d2f4fdc8c..0399cf130 100644 --- a/Lib/python/pystrings.swg +++ b/Lib/python/pystrings.swg @@ -39,13 +39,15 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) if (psize) *psize = len + 1; return SWIG_OK; } else { - char* vptr = 0; swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); - if (pchar_descriptor && (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK)) { - if (cptr) *cptr = vptr; - if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0; - if (alloc) *alloc = SWIG_OLDOBJ; - return SWIG_OK; + if (pchar_descriptor) { + char* vptr = 0; + if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) { + if (cptr) *cptr = vptr; + if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0; + if (alloc) *alloc = SWIG_OLDOBJ; + return SWIG_OK; + } } } return SWIG_TypeError; diff --git a/Lib/python/pywstrings.swg b/Lib/python/pywstrings.swg index 2fecbbf0c..bb6e19486 100644 --- a/Lib/python/pywstrings.swg +++ b/Lib/python/pywstrings.swg @@ -27,11 +27,13 @@ SWIG_AsWCharPtrAndSize(PyObject *obj, wchar_t **cptr, size_t *psize, int *alloc) return SWIG_OK; } else { swig_type_info* pwchar_descriptor = SWIG_pwchar_descriptor(); - wchar_t * vptr = 0; - if (pwchar_descriptor && (SWIG_ConvertPtr(obj, (void**)&vptr, pwchar_descriptor, 0) == SWIG_OK)) { - if (cptr) *cptr = vptr; - if (psize) *psize = vptr ? (wcslen(vptr) + 1) : 0; - return SWIG_OK; + if (pwchar_descriptor) { + wchar_t * vptr = 0; + if (SWIG_ConvertPtr(obj, (void**)&vptr, pwchar_descriptor, 0) == SWIG_OK) { + if (cptr) *cptr = vptr; + if (psize) *psize = vptr ? (wcslen(vptr) + 1) : 0; + return SWIG_OK; + } } } return SWIG_TypeError; diff --git a/Lib/ruby/rubystrings.swg b/Lib/ruby/rubystrings.swg index 06254b681..e7b0330ba 100644 --- a/Lib/ruby/rubystrings.swg +++ b/Lib/ruby/rubystrings.swg @@ -22,13 +22,15 @@ SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc) if (psize) *psize = size; return SWIG_OK; } else { - char* vptr = 0; swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); - if (pchar_descriptor && (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK)) { - if (cptr) *cptr = vptr; - if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0; - if (alloc) *alloc = SWIG_OLDOBJ; - return SWIG_OK; + if (pchar_descriptor) { + char* vptr = 0; + if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) { + if (cptr) *cptr = vptr; + if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0; + if (alloc) *alloc = SWIG_OLDOBJ; + return SWIG_OK; + } } } return SWIG_TypeError; diff --git a/Lib/typemaps/std_strings.swg b/Lib/typemaps/std_strings.swg index ddba34b1f..86729a5d3 100644 --- a/Lib/typemaps/std_strings.swg +++ b/Lib/typemaps/std_strings.swg @@ -6,22 +6,32 @@ SWIGINTERN int SWIG_AsPtr_dec(String)(SWIG_Object obj, String **val) { - static swig_type_info* string_info = SWIG_TypeQuery(#String " *"); - String *vptr; - if (SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0) != -1) { - if (val) *val = vptr; - return SWIG_OLDOBJ; + Char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ; + if (SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc) == SWIG_OK) { + if (buf) { + if (val) *val = new String(buf, size - 1); + if (alloc == SWIG_NEWOBJ) %delete_array(buf); + return SWIG_NEWOBJ; + } else { + if (val) *val = 0; + return SWIG_OLDOBJ; + } } else { - Char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ; - if (SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc) == SWIG_OK) { - if (buf) { - if (val) *val = new String(buf, size - 1); - if (alloc == SWIG_NEWOBJ) %delete_array(buf); - return SWIG_NEWOBJ; + static int init = 0; + static swig_type_info* descriptor = 0; + if (!init) { + descriptor = SWIG_TypeQuery(#String " *"); + init = 1; + } + if (descriptor) { + String *vptr; + if ((SWIG_ConvertPtr(obj, (void**)&vptr, descriptor, 0) == SWIG_OK)) { + if (val) *val = vptr; + return SWIG_OLDOBJ; } } - return 0; } + return 0; } } %enddef |