aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/native/NewtCommon.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt/native/NewtCommon.c')
-rw-r--r--src/newt/native/NewtCommon.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/newt/native/NewtCommon.c b/src/newt/native/NewtCommon.c
new file mode 100644
index 000000000..8b64ec37f
--- /dev/null
+++ b/src/newt/native/NewtCommon.c
@@ -0,0 +1,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;
+}
+