From c77859245f1653ee06afc66ae3e1d65236472d6e Mon Sep 17 00:00:00 2001 From: Juho Kuisma Date: Fri, 17 Jan 2025 20:40:18 +0200 Subject: [PATCH] Rename r_buf_new_slurp -> r_buf_new_from_file --- libr/anal/flirt.c | 4 ++-- libr/bin/format/pdb/pdb.c | 2 +- libr/core/p/core_prj.c | 2 +- libr/include/r_util/r_buf.h | 2 +- libr/util/buf.c | 3 +-- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/libr/anal/flirt.c b/libr/anal/flirt.c index 3d258fd6d2dcc..2e604c44433f3 100644 --- a/libr/anal/flirt.c +++ b/libr/anal/flirt.c @@ -1388,7 +1388,7 @@ static inline void flirt_free(RFlirt *f) { // dump a flirt signature content on screen R_API void r_sign_flirt_dump(const RAnal *anal, const char *flirt_file) { - RBuffer *flirt_buf = r_buf_new_slurp (flirt_file); + RBuffer *flirt_buf = r_buf_new_from_file (flirt_file); if (!flirt_buf) { R_LOG_ERROR ("Can't slurp %s", flirt_file); return; @@ -1406,7 +1406,7 @@ R_API void r_sign_flirt_dump(const RAnal *anal, const char *flirt_file) { // parses a flirt signature file and scan the currently opened file with it R_API void r_sign_flirt_scan(RAnal *anal, const char *flirt_file) { - RBuffer *flirt_buf = r_buf_new_slurp (flirt_file); + RBuffer *flirt_buf = r_buf_new_from_file (flirt_file); if (!flirt_buf) { R_LOG_ERROR ("Can't slurp %s", flirt_file); return; diff --git a/libr/bin/format/pdb/pdb.c b/libr/bin/format/pdb/pdb.c index 76f51ad45c861..d738b7f11fde3 100644 --- a/libr/bin/format/pdb/pdb.c +++ b/libr/bin/format/pdb/pdb.c @@ -1502,7 +1502,7 @@ R_API bool init_pdb_parser_with_buf(RPdb *pdb, RBuffer* buf) { } R_API bool init_pdb_parser(RPdb *pdb, const char *filename) { - RBuffer *buf = r_buf_new_slurp (filename); + RBuffer *buf = r_buf_new_from_file (filename); if (!buf) { R_LOG_ERROR ("%s: Error reading file \"%s\"", __func__, filename); return false; diff --git a/libr/core/p/core_prj.c b/libr/core/p/core_prj.c index 16233e5c41e55..7de24f8887d95 100644 --- a/libr/core/p/core_prj.c +++ b/libr/core/p/core_prj.c @@ -503,7 +503,7 @@ static ut8 *rprj_find(RBuffer *b, ut32 type, ut32 *size) { } static void prj_load(RCore *core, const char *file, int mode) { - RBuffer *b = r_buf_new_slurp (file); + RBuffer *b = r_buf_new_from_file (file); if (!b) { R_LOG_ERROR ("Cannot open file"); return; diff --git a/libr/include/r_util/r_buf.h b/libr/include/r_util/r_buf.h index 466394665ac16..b8808c66bbaa2 100644 --- a/libr/include/r_util/r_buf.h +++ b/libr/include/r_util/r_buf.h @@ -129,7 +129,7 @@ R_API RBuffer *r_buf_new_with_string(const char *msg); R_API RBuffer *r_buf_new_with_pointers(const ut8 *bytes, ut64 len, bool steal); R_API RBuffer *r_buf_new_file(const char *file, int perm, int mode); R_API RBuffer *r_buf_new_with_buf(RBuffer *b); -R_API RBuffer *r_buf_new_slurp(const char *file); +R_API RBuffer *r_buf_new_from_file(const char *file); R_API RBuffer *r_buf_new_slice(RBuffer *b, ut64 offset, ut64 size); R_API RBuffer *r_buf_new_empty(ut64 len); R_API RBuffer *r_buf_new_mmap(const char *file, int flags); diff --git a/libr/util/buf.c b/libr/util/buf.c index 1de8677455d5f..d6302a8c945fe 100644 --- a/libr/util/buf.c +++ b/libr/util/buf.c @@ -224,8 +224,7 @@ R_API RBuffer *r_buf_new_file(const char *file, int perm, int mode) { return new_buffer (R_BUFFER_FILE, &u); } -// R2_600 : rename to new_from_file ? -R_API RBuffer *r_buf_new_slurp(const char *file) { +R_API RBuffer *r_buf_new_from_file(const char *file) { size_t len; char *tmp = r_file_slurp (file, &len); if (!tmp) {