mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 10:00:07 +01:00
glib-aux: add nm_str_truncate() helper
This commit is contained in:
parent
d1fd6eb53b
commit
cc36baa5c7
1 changed files with 11 additions and 0 deletions
|
|
@ -495,6 +495,17 @@ nm_strdup_not_empty(const char *str)
|
|||
return !nm_str_is_empty(str) ? g_strdup(str) : NULL;
|
||||
}
|
||||
|
||||
static inline char *
|
||||
nm_str_truncate(char *str)
|
||||
{
|
||||
/* This is trivial, and is only useful in a macro, to
|
||||
* ensure that we access the macro argument only once. */
|
||||
nm_assert(str);
|
||||
|
||||
str[0] = '\0';
|
||||
return str;
|
||||
}
|
||||
|
||||
static inline char *
|
||||
nm_str_realloc(char *str)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue