rz_str_trim_tail: Declare RZ_INOUT on both parameter and return value (#5546)

This commit is contained in:
Khairul Azhar Kasmiran 2025-11-23 02:04:35 +08:00 committed by GitHub
parent 451eab4e09
commit 4cbba6a263
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 5 additions and 5 deletions

View file

@ -376,7 +376,7 @@ In Rizin code, there are some conventions to help developers use pointers more s
```c
#define RZ_IN /* do not use, implicit */
#define RZ_OUT /* parameter is written, not read */
#define RZ_INOUT /* parameter is read and written */
#define RZ_INOUT /* parameter is read and written / return value is copy of RZ_INOUT parameter */
#define RZ_OWN /* pointer ownership is transferred */
#define RZ_BORROW /* pointer ownership is not transferred, it must not be freed by the receiver */
#define RZ_NONNULL /* pointer cannot be null */

View file

@ -35,7 +35,7 @@ extern "C" {
#define RZ_IN /* do not use, implicit */
#define RZ_OUT /* parameter is written, not read */
#define RZ_INOUT /* parameter is read and written */
#define RZ_INOUT /* parameter is read and written / return value is copy of RZ_INOUT parameter */
#ifdef RZ_BINDINGS
#define RZ_OWN __attribute__((annotate("RZ_OWN")))

View file

@ -181,7 +181,7 @@ RZ_API void rz_str_trim_head(RZ_NONNULL RZ_INOUT char *str);
RZ_API void rz_str_trim_head_char(RZ_NONNULL RZ_INOUT char *str, const char c);
RZ_API const char *rz_str_trim_head_ro(RZ_NONNULL const char *str);
RZ_API const char *rz_str_trim_head_wp(RZ_NONNULL const char *str);
RZ_API RZ_BORROW char *rz_str_trim_tail(RZ_NONNULL char *str);
RZ_API RZ_INOUT char *rz_str_trim_tail(RZ_NONNULL RZ_INOUT char *str);
RZ_API void rz_str_trim_tail_char(RZ_NONNULL RZ_INOUT char *str, const char c);
RZ_API ut64 rz_str_djb2_hash(const char *str);
RZ_API char *rz_str_trim_nc(char *str);

View file

@ -126,9 +126,9 @@ RZ_API void rz_str_trim_head(RZ_NONNULL RZ_INOUT char *str) {
* The string is changed in place.
*
* \param str The string to trim.
* \return The edited string.
* \return The `str` pointer.
*/
RZ_API RZ_BORROW char *rz_str_trim_tail(RZ_NONNULL char *str) {
RZ_API RZ_INOUT char *rz_str_trim_tail(RZ_NONNULL RZ_INOUT char *str) {
rz_return_val_if_fail(str, NULL);
size_t length = strlen(str);
while (length-- > 0) {