int uv_set_process_title(const char* title) { if (process_title.len == 0) return 0; /* No need to terminate, byte after is always '\0'. */ strncpy(process_title.str, title, process_title.len); uv__set_process_title(title); return 0; }
uv_err_t uv_set_process_title(const char* title) { if (process_title.len == 0) return uv_ok_; /* No need to terminate, last char is always '\0'. */ strncpy(process_title.str, title, process_title.len - 1); uv__set_process_title(title); return uv_ok_; }
/* * Class: com_iwebpp_libuvpp_LibUV * Method: _setTitle * Signature: (Ljava/lang/String;)V */ extern "C" JNIEXPORT void JNICALL Java_com_iwebpp_libuvpp_LibUV__1setTitle (JNIEnv *env, jclass cls, jstring title) { const char* t = env->GetStringUTFChars(title, JNI_FALSE); if (process_title) { free(process_title); } process_title = strdup(t); #ifdef __POSIX__ uv__set_process_title(process_title); #endif // __POSIX__ env->ReleaseStringUTFChars(title, t); }