string-util: modernize split_pair()

- use _cleanup_free_ attribute,
- rename output arguments,
- trigger assertion when an empty separator is passed.
This commit is contained in:
Yu Watanabe
2024-12-28 16:16:27 +09:00
parent f587da03c2
commit ac3f3026a9
3 changed files with 23 additions and 30 deletions
+1 -1
View File
@@ -214,7 +214,7 @@ char* strrep(const char *s, unsigned n);
_d_; \
})
int split_pair(const char *s, const char *sep, char **l, char **r);
int split_pair(const char *s, const char *sep, char **ret_first, char **ret_second);
int free_and_strdup(char **p, const char *s);
static inline int free_and_strdup_warn(char **p, const char *s) {