-
-
Notifications
You must be signed in to change notification settings - Fork 361
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
Force Function Rename #4703
base: dev
Are you sure you want to change the base?
Force Function Rename #4703
Conversation
New function to forcefully rename a function. Multiple retries will be performed by adding a numeric suffix to function name until the number of retries max's out
About canalysis.c:3336 TODO? |
* @return `false` otherwiese. | ||
* | ||
* @sa rz_analysis_function_force_rename | ||
* */ | ||
RZ_API bool rz_analysis_function_rename(RzAnalysisFunction *fcn, const char *name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add RZ_NOTNULL
* | ||
* @sa rz_analysis_function_rename | ||
* */ | ||
RZ_API const char *rz_analysis_function_force_rename(RzAnalysisFunction *fcn, const char *name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here. RZ_NOT_NULL.
const char *final_name = strdup(name); | ||
ut32 retries = 100; | ||
ut32 suffix = 0; | ||
while ((retries--) && !rz_analysis_function_rename(fcn, final_name)) { | ||
if (final_name) { | ||
free((void *)final_name); | ||
final_name = NULL; | ||
} | ||
|
||
ut32 strsz = snprintf(NULL, 0, "%s_%u", name, suffix) + 1; | ||
final_name = malloc(strsz); | ||
snprintf((char *)final_name, strsz, "%s_%u", name, suffix++); | ||
} | ||
return retries ? fcn->name : NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of doing retries, just do name_offset
which is granted to be unique. also use rz_strf
directly instead of calling snprintf.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above
ignore it. |
New function to forcefully rename an analysis function. Multiple retries will be performed by adding a numeric suffix to function name until the number of retries max's out
Your checklist for this pull request
Detailed description
...
Test plan
...
Closing issues
...