#include "NewtCommon.h" jchar* NewtCommon_GetNullTerminatedStringChars(JNIEnv* env, jstring str) { jchar* strChars = NULL; strChars = calloc((*env)->GetStringLength(env, str) + 1, sizeof(jchar)); if (strChars != NULL) { (*env)->GetStringRegion(env, str, 0, (*env)->GetStringLength(env, str), strChars); } return strChars; }