mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-11 20:00:35 +01:00
shared: add nm_utils_strdup_reset() helper
This commit is contained in:
parent
45a832ac50
commit
455cec9986
1 changed files with 14 additions and 0 deletions
|
|
@ -1615,4 +1615,18 @@ guint nm_utils_parse_debug_string (const char *string,
|
|||
const GDebugKey *keys,
|
||||
guint nkeys);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static inline gboolean
|
||||
nm_utils_strdup_reset (char **dst, const char *src)
|
||||
{
|
||||
nm_assert (dst);
|
||||
|
||||
if (nm_streq0 (*dst, src))
|
||||
return FALSE;
|
||||
g_free (*dst);
|
||||
*dst = g_strdup (src);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif /* __NM_SHARED_UTILS_H__ */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue