Fix mismatched new char[] and free() - Javascript
Javascript - v8 and node only. When wrapping C code char arrays. Now calloc is now used instead of new char[] in SWIG_AsCharPtrAndSize. Fixes gcc-11 warning -Wmismatched-new-delete in arrays and memberin_extend testcases.
This commit is contained in:
parent
6cafc93135
commit
ada739b4a8
2 changed files with 6 additions and 1 deletions
|
|
@ -7,6 +7,11 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
||||||
Version 4.1.0 (in progress)
|
Version 4.1.0 (in progress)
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
2021-11-12: wsfulton
|
||||||
|
[Javascript] v8 and node only. Fix mismatched new char[] and free()
|
||||||
|
when wrapping C code char arrays. Now calloc is now used instead of
|
||||||
|
new char[] in SWIG_AsCharPtrAndSize.
|
||||||
|
|
||||||
2021-10-03: ajrh1
|
2021-10-03: ajrh1
|
||||||
[Perl] #2074: Avoid -Wmisleading-indentation in generated code
|
[Perl] #2074: Avoid -Wmisleading-indentation in generated code
|
||||||
when using gcc11.
|
when using gcc11.
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ SWIG_AsCharPtrAndSize(SWIGV8_VALUE valRef, char** cptr, size_t* psize, int *allo
|
||||||
%#endif
|
%#endif
|
||||||
|
|
||||||
size_t len = SWIGV8_UTF8_LENGTH(js_str) + 1;
|
size_t len = SWIGV8_UTF8_LENGTH(js_str) + 1;
|
||||||
char* cstr = new char[len];
|
char* cstr = (char*) %new_array(len, char);
|
||||||
SWIGV8_WRITE_UTF8(js_str, cstr, len);
|
SWIGV8_WRITE_UTF8(js_str, cstr, len);
|
||||||
|
|
||||||
if(alloc) *alloc = SWIG_NEWOBJ;
|
if(alloc) *alloc = SWIG_NEWOBJ;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue