diff options
author | Thomas Graf <tgraf@suug.ch> | 2012-11-16 01:11:55 +0100 |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2012-11-16 01:11:55 +0100 |
commit | 00132b46968fff7975eb8d20a307c626dfefe2f1 (patch) | |
tree | e2d6ea3d7535358435ea136019e03c35c22c19ba /src | |
parent | 23c4ef67c735813fd41f66f6722b996d1ad7314a (diff) | |
download | libnl-00132b46968fff7975eb8d20a307c626dfefe2f1.tar.gz |
cache: provide safe variant of nl_cache_mngt_require() and use it
This makes runtime removal of cache operations possible if non-safe
API is not in use by application. The non-safe API will be removed
in the next major version.
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Diffstat (limited to 'src')
-rw-r--r-- | src/nl-addr-list.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nl-addr-list.c b/src/nl-addr-list.c index 5044d5c..20995a8 100644 --- a/src/nl-addr-list.c +++ b/src/nl-addr-list.c @@ -65,7 +65,7 @@ static void env_dump(struct nl_object *obj, void *arg) nl_addr2str(rtnl_addr_get_local(addr), buf, sizeof(buf))); nl_dump_line(p, "%s_IFINDEX=%u\n", pfx, rtnl_addr_get_ifindex(addr)); - link_cache = nl_cache_mngt_require("route/link"); + link_cache = nl_cache_mngt_require_safe("route/link"); if (link_cache) nl_dump_line(p, "%s_IFNAME=%s\n", pfx, rtnl_link_i2name(link_cache, @@ -94,6 +94,9 @@ static void env_dump(struct nl_object *obj, void *arg) nl_dump_line(p, "%s_CACHEINFO_VALID=%u\n", pfx, rtnl_addr_get_valid_lifetime(addr)); + if (link_cache) + nl_cache_put(link_cache); + #if 0 if (addr->ce_mask & ADDR_ATTR_CACHEINFO) { struct rtnl_addr_cacheinfo *ci = &addr->a_cacheinfo; |