aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/native/NewtCommon.c
blob: 8b64ec37fe5c7fab91cc865794c7649fc6b69219 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13

#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;
}