mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 03:08:08 +02: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;
|
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 *
|
static inline char *
|
||||||
nm_str_realloc(char *str)
|
nm_str_realloc(char *str)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue