Fix class names
This commit is contained in:
parent
2de711957a
commit
cc60532d74
|
@ -21,16 +21,13 @@ void* compileunit(void* input) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char* getclassname(char* filename) {
|
char* getclassname(char* filename) {
|
||||||
int count = 0;
|
int len = strlen(filename) - 1;
|
||||||
int len = strlen(filename);
|
|
||||||
|
|
||||||
for(int i = len-1; i >= 0; i--)
|
for(len = len; len >= 0; len--)
|
||||||
if(filename[i] == '.') {
|
if(filename[len] == '.')
|
||||||
count = i;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
int sz = sizeof(char) * (len - count);
|
int sz = sizeof(char) * (len + 1);
|
||||||
char* classname = (char*)malloc(sz);
|
char* classname = (char*)malloc(sz);
|
||||||
snprintf(classname, sz, "%s", filename); // legitimately needs to be snprintf
|
snprintf(classname, sz, "%s", filename); // legitimately needs to be snprintf
|
||||||
return classname;
|
return classname;
|
||||||
|
|
Loading…
Reference in New Issue