diff options
Diffstat (limited to 'src/jvm')
-rw-r--r-- | src/jvm/jvm.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/jvm/jvm.c b/src/jvm/jvm.c index d6be887..b52af46 100644 --- a/src/jvm/jvm.c +++ b/src/jvm/jvm.c @@ -317,12 +317,27 @@ JNIEnv_DefineClass(JNIEnv* p0, const char* p1, jobject p2, const jbyte* p3, jsiz return NULL; } +static char* +cstr_replace(char *cstr, const char replace, const char with) +{ + assert(cstr && replace != with); + + if (replace == with) + return cstr; + + char *s = cstr; + while ((s = strchr(s, replace))) + *s = with; + return cstr; +} + static jclass jvm_make_class(struct jvm *jvm, const char *name) { assert(jvm && name); struct jvm_object o = { .this_klass = (jclass)1, .type = JVM_OBJECT_CLASS }; jvm_string_set_cstr(&o.klass.name, name, true); + cstr_replace((char*)o.klass.name.data, '.', '/'); return jvm_add_object_if_not_there(jvm, &o); } @@ -509,20 +524,6 @@ JNIEnv_IsInstanceOf(JNIEnv* p0, jobject p1, jclass p2) return jvm_get_object(jnienv_get_jvm(p0), p1)->this_klass == p2; } -static char* -cstr_replace(char *cstr, const char replace, const char with) -{ - assert(cstr && replace != with); - - if (replace == with) - return cstr; - - char *s = cstr; - while ((s = strchr(s, replace))) - *s = with; - return cstr; -} - static void jvm_form_symbol(struct jvm *jvm, jmethodID method_id, char *symbol, const size_t symbol_sz) { |