Consistent memory intiailization between C and C++ in typemaps
Remove unnecessary initialization via calloc calls and replace with malloc.
This commit is contained in:
parent
00a9b8d3af
commit
cd04b372a4
2 changed files with 5 additions and 5 deletions
|
|
@ -29,7 +29,7 @@
|
|||
#ifdef __cplusplus
|
||||
$1 = new char*[size+1];
|
||||
#else
|
||||
$1 = (char **)calloc(size+1, sizeof(char *));
|
||||
$1 = (char **)malloc((size+1) * sizeof(char *));
|
||||
#endif
|
||||
for (i = 0; i<size; i++) {
|
||||
jstring j_string = (jstring)JCALL2(GetObjectArrayElement, jenv, $input, i);
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
#ifdef __cplusplus
|
||||
$1[i] = new char [strlen(c_string)+1];
|
||||
#else
|
||||
$1[i] = (char *)calloc(strlen(c_string)+1, sizeof(const char *));
|
||||
$1[i] = (char *)malloc((strlen(c_string)+1) * sizeof(const char *));
|
||||
#endif
|
||||
strcpy($1[i], c_string);
|
||||
JCALL2(ReleaseStringUTFChars, jenv, j_string, c_string);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue