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

R2600 renaming #23908

Merged
merged 5 commits into from
Jan 20, 2025
Merged

R2600 renaming #23908

merged 5 commits into from
Jan 20, 2025

Conversation

jukuisma
Copy link
Contributor

@jukuisma jukuisma commented Jan 17, 2025

  • Mark this if you consider it ready to merge
  • I've added tests (optional)
  • I wrote some lines in the book (optional)

Description

@jukuisma jukuisma marked this pull request as draft January 17, 2025 14:16
@jukuisma
Copy link
Contributor Author

diff --git a/libr/flag/flag.c b/libr/flag/flag.c
index 1fc8765f3d..1cfcda26ad 100644
--- a/libr/flag/flag.c
+++ b/libr/flag/flag.c
@@ -509,8 +509,7 @@ R_API RFlagItem *r_flag_get(RFlag *f, const char *name) {
 }

 /* return the first flag item that can be found at offset "off", or NULL otherwise */
-// R2_600 - rename to r_flag_get_at and r_flag_get_in ??
-R_API RFlagItem *r_flag_get_i(RFlag *f, ut64 off) {
+R_API RFlagItem *r_flag_get_item(RFlag *f, ut64 off) {
        R_RETURN_VAL_IF_FAIL (f, NULL);
        if (f->mask) {
                off &= f->mask;

Not exactly the suggestion, but r_flag_get_item seems more logical if get_i isn't clear enough.

@jukuisma
Copy link
Contributor Author

Renamed

-R_API RBuffer *r_buf_new_slurp(const char *file);
+R_API RBuffer *r_buf_new_from_file(const char *file);

But there's also:

215 // rename to new?
  1 R_API RBuffer *r_buf_new_mmap(const char *filename, int perm) {
  2     R_RETURN_VAL_IF_FAIL (filename, NULL);
  3     struct buf_mmap_user u = {filename, perm};
  4     return new_buffer (R_BUFFER_MMAP, &u);
  5 }

without the R2_600 comment. Do we want to rename this while we're at it?

@jukuisma jukuisma marked this pull request as ready for review January 17, 2025 18:53
@jukuisma jukuisma changed the title Draft: R2600 renaming R2600 renaming Jan 17, 2025
@trufae
Copy link
Collaborator

trufae commented Jan 20, 2025

All those changes look good to me :) thanks for taking the time to do such a painful renaming!

@trufae trufae merged commit e96e55c into radareorg:master Jan 20, 2025
45 checks passed
@jukuisma
Copy link
Contributor Author

All those changes look good to me :) thanks for taking the time to do such a painful renaming!

No problem, the following script helps with the pain ;)

#!/usr/bin/bash

if [ "$#" -ne 2 ]; then
    echo "Must be 2 parameters: e.g. 'replace replace_this with_this'"
    return 1
fi

limit=50  # if more than 50 grep results found, do nothing
search="$1"
replace="$2"
length=$(grep -rlI --color=never "$search" | wc -l)

if [ "$length" -ne 0 ] && [ "$length" -lt $limit ]; then
    for file in $(grep -rlI --color=never "$search")
    do
        nvim -c "%s/$search/$replace/gc" -c 'wq' "$file"
    done
else
    echo "$length results found, nothing done"
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants