string-util: add common implementation of function that converts sized character buffers to NUL terminated C strings
This commit is contained in:
@@ -239,6 +239,16 @@ bool streq_skip_trailing_chars(const char *s1, const char *s2, const char *ok);
|
||||
|
||||
char *string_replace_char(char *str, char old_char, char new_char);
|
||||
|
||||
typedef enum MakeCStringMode {
|
||||
MAKE_CSTRING_REFUSE_TRAILING_NUL,
|
||||
MAKE_CSTRING_ALLOW_TRAILING_NUL,
|
||||
MAKE_CSTRING_REQUIRE_TRAILING_NUL,
|
||||
_MAKE_CSTRING_MODE_MAX,
|
||||
_MAKE_CSTRING_MODE_INVALID = -1,
|
||||
} MakeCStringMode;
|
||||
|
||||
int make_cstring(const char *s, size_t n, MakeCStringMode mode, char **ret);
|
||||
|
||||
size_t strspn_from_end(const char *str, const char *accept);
|
||||
|
||||
char *strdupspn(const char *a, const char *accept);
|
||||
|
||||
Reference in New Issue
Block a user