< prev index next >
src/java.base/share/native/libjli/jli_util.c
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -24,17 +24,18 @@
*/
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
+#include "jni.h"
#include "jli_util.h"
/*
* Returns a pointer to a block of at least 'size' bytes of memory.
* Prints error message and exits if the memory could not be allocated.
*/
-void *
+JNIEXPORT void * JNICALL
JLI_MemAlloc(size_t size)
{
void *p = malloc(size);
if (p == 0) {
perror("malloc");
@@ -60,11 +61,11 @@
/*
* Wrapper over strdup(3C) which prints an error message and exits if memory
* could not be allocated.
*/
-char *
+JNIEXPORT char * JNICALL
JLI_StringDup(const char *s1)
{
char *s = strdup(s1);
if (s == NULL) {
perror("strdup");
@@ -75,11 +76,11 @@
/*
* Very equivalent to free(ptr).
* Here to maintain pairing with the above routines.
*/
-void
+JNIEXPORT void JNICALL
JLI_MemFree(void *ptr)
{
free(ptr);
}
@@ -97,11 +98,11 @@
vprintf(fmt,vl);
va_end(vl);
fflush(stdout);
}
-void
+JNIEXPORT void JNICALL
JLI_SetTraceLauncher()
{
if (getenv(JLDEBUG_ENV_ENTRY) != 0) {
_launcher_debug = JNI_TRUE;
JLI_TraceLauncher("----%s----\n", JLDEBUG_ENV_ENTRY);
@@ -118,11 +119,11 @@
JLI_StrCCmp(const char *s1, const char* s2)
{
return JLI_StrNCmp(s1, s2, JLI_StrLen(s2));
}
-JLI_List
+JNIEXPORT JLI_List JNICALL
JLI_List_new(size_t capacity)
{
JLI_List l = (JLI_List) JLI_MemAlloc(sizeof(struct JLI_List_));
l->capacity = capacity;
l->elements = (char **) JLI_MemAlloc(capacity * sizeof(l->elements[0]));
@@ -153,11 +154,11 @@
sl->elements = JLI_MemRealloc(sl->elements,
sl->capacity * sizeof(sl->elements[0]));
}
}
-void
+JNIEXPORT void JNICALL
JLI_List_add(JLI_List sl, char *str)
{
JLI_List_ensureCapacity(sl, sl->size+1);
sl->elements[sl->size++] = str;
}
< prev index next >