From cc60532d74fb250f757f50186fe06a67e5401a30 Mon Sep 17 00:00:00 2001 From: Augusto Gunsch Date: Mon, 4 Jan 2021 17:20:57 -0300 Subject: [PATCH] Fix class names --- misc/threads.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/misc/threads.c b/misc/threads.c index 49b1673..9a1a481 100644 --- a/misc/threads.c +++ b/misc/threads.c @@ -21,16 +21,13 @@ void* compileunit(void* input) { } char* getclassname(char* filename) { - int count = 0; - int len = strlen(filename); + int len = strlen(filename) - 1; - for(int i = len-1; i >= 0; i--) - if(filename[i] == '.') { - count = i; + for(len = len; len >= 0; len--) + if(filename[len] == '.') break; - } - int sz = sizeof(char) * (len - count); + int sz = sizeof(char) * (len + 1); char* classname = (char*)malloc(sz); snprintf(classname, sz, "%s", filename); // legitimately needs to be snprintf return classname;