67 JLI_StringDup(const char *s1) 68 { 69 char *s = strdup(s1); 70 if (s == NULL) { 71 perror("strdup"); 72 exit(1); 73 } 74 return s; 75 } 76 77 /* 78 * Very equivalent to free(ptr). 79 * Here to maintain pairing with the above routines. 80 */ 81 JNIEXPORT void JNICALL 82 JLI_MemFree(void *ptr) 83 { 84 free(ptr); 85 } 86 87 /* 88 * debug helpers we use 89 */ 90 static jboolean _launcher_debug = JNI_FALSE; 91 92 void 93 JLI_TraceLauncher(const char* fmt, ...) 94 { 95 va_list vl; 96 if (_launcher_debug != JNI_TRUE) return; 97 va_start(vl, fmt); 98 vprintf(fmt,vl); 99 va_end(vl); 100 fflush(stdout); 101 } 102 103 JNIEXPORT void JNICALL 104 JLI_SetTraceLauncher() 105 { 106 if (getenv(JLDEBUG_ENV_ENTRY) != 0) { | 67 JLI_StringDup(const char *s1) 68 { 69 char *s = strdup(s1); 70 if (s == NULL) { 71 perror("strdup"); 72 exit(1); 73 } 74 return s; 75 } 76 77 /* 78 * Very equivalent to free(ptr). 79 * Here to maintain pairing with the above routines. 80 */ 81 JNIEXPORT void JNICALL 82 JLI_MemFree(void *ptr) 83 { 84 free(ptr); 85 } 86 87 jboolean 88 JLI_HasSuffix(const char *s1, const char *s2) 89 { 90 char *p = JLI_StrRChr(s1, '.'); 91 if (p == NULL || *p == '\0') { 92 return JNI_FALSE; 93 } 94 return (JLI_StrCaseCmp(p, s2) == 0); 95 } 96 97 /* 98 * debug helpers we use 99 */ 100 static jboolean _launcher_debug = JNI_FALSE; 101 102 void 103 JLI_TraceLauncher(const char* fmt, ...) 104 { 105 va_list vl; 106 if (_launcher_debug != JNI_TRUE) return; 107 va_start(vl, fmt); 108 vprintf(fmt,vl); 109 va_end(vl); 110 fflush(stdout); 111 } 112 113 JNIEXPORT void JNICALL 114 JLI_SetTraceLauncher() 115 { 116 if (getenv(JLDEBUG_ENV_ENTRY) != 0) { |