Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize strncmp with a constant string to strcmp #449

Merged
merged 1 commit into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/mcemu/imports.lst
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ stdio_IMPORTS_end

sysclib_IMPORTS_start
I_prnt
I_strncmp
I_strcmp
sysclib_IMPORTS_end

sysmem_IMPORTS_start
Expand Down
8 changes: 4 additions & 4 deletions modules/mcemu/mcemu.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ int hookRegisterLibraryEntires(iop_library_t *lib)
{
register int ret;

if (!strncmp(lib->name, "sio2man", 8)) {
if (!strcmp(lib->name, "sio2man")) {
ret = pRegisterLibraryEntires(lib);
if (ret == 0) {
ReleaseLibraryEntries((struct irx_export_table *)lib);
Expand All @@ -252,7 +252,7 @@ int hookRegisterLibraryEntires(iop_library_t *lib)
DPRINTF("registering library %s failed, error %d\n", lib->name, ret);
return ret;
}
} else if (!strncmp(lib->name, "secrman", 8)) {
} else if (!strcmp(lib->name, "secrman")) {
ret = pRegisterLibraryEntires(lib);
if (ret == 0) {
ReleaseLibraryEntries((struct irx_export_table *)lib);
Expand All @@ -262,7 +262,7 @@ int hookRegisterLibraryEntires(iop_library_t *lib)
DPRINTF("registering library %s failed, error %d\n", lib->name, ret);
return ret;
}
} else if (!strncmp(lib->name, "mcman", 8)) {
} else if (!strcmp(lib->name, "mcman")) {
ret = pRegisterLibraryEntires(lib);
if (ret == 0) {
ReleaseLibraryEntries((struct irx_export_table *)lib);
Expand All @@ -274,7 +274,7 @@ int hookRegisterLibraryEntires(iop_library_t *lib)
return ret;
}
#ifdef PADEMU
} else if (!strncmp(lib->name, "pademu", 8)) {
} else if (!strcmp(lib->name, "pademu")) {
pademu_hookSio2man = GetExportEntry(&lib[1], 4);
#endif
}
Expand Down