diff options
author | Thomas Haller <thaller@redhat.com> | 2015-11-06 15:44:41 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-04-07 11:45:32 +0200 |
commit | caee4e4617a54b472b1d3455a4612d90b6a4ba1c (patch) | |
tree | cd8cfc45651884cd2447795ee0cad0df9ca2c2dd /src/nm-core-utils.h | |
parent | 1b43c880ba43260fe551b0ac923826f16737484f (diff) | |
download | NetworkManager-th/wip/util/nm-ref-string.tar.gz |
utils: add NMRefStringth/wip/util/nm-ref-stringth/util/nm-ref-string
NMRefString is a simple, refcounted, immutable string. Increasing/decreasing
the refcount does not affect const-ness.
It can be used just like a regular 'const char *' pointer. The only
difference is that you need special alloc/free functions.
Diffstat (limited to 'src/nm-core-utils.h')
-rw-r--r-- | src/nm-core-utils.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/nm-core-utils.h b/src/nm-core-utils.h index f77b43e2a3..28235f0560 100644 --- a/src/nm-core-utils.h +++ b/src/nm-core-utils.h @@ -391,4 +391,15 @@ gboolean nm_utils_lifetime_get (guint32 timestamp, gboolean nm_utils_ip4_address_is_link_local (in_addr_t addr); +/*****************************************************************************/ + +typedef const char *NMRefString; +NMRefString nm_ref_string_new (const char *str); +NMRefString nm_ref_string_ref (NMRefString nmstr); +void nm_ref_string_unref (NMRefString nmstr); +NMRefString nm_ref_string_dedup (NMRefString nmstr, const char *str); +NMRefString nm_ref_string_replace (NMRefString nmstr, const char *str); +int nm_ref_string_cmp (NMRefString nmstr1, NMRefString nmstr2); +gboolean nm_ref_string_equal (NMRefString nmstr1, NMRefString nmstr2); + #endif /* __NM_CORE_UTILS_H__ */ |