summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2010-11-26 15:32:10 (GMT)
committerThomas Graf <tgraf@suug.ch>2010-11-26 15:32:10 (GMT)
commit7105aea116208422812a3803ef1e58f08b45c75e (patch)
tree7db9c5c2874435a0cffea553aa2eca560b91feab /lib
parentc158d06b7b13dfcdc0fc66f8e8267a2493006926 (diff)
downloadlibnl-7105aea116208422812a3803ef1e58f08b45c75e.zip
libnl-7105aea116208422812a3803ef1e58f08b45c75e.tar.gz
libnl-7105aea116208422812a3803ef1e58f08b45c75e.tar.bz2
addr: hide nl_addr_destroy()
everyone should use nl_addr_put()
Diffstat (limited to 'lib')
-rw-r--r--lib/addr.c39
1 files changed, 14 insertions, 25 deletions
diff --git a/lib/addr.c b/lib/addr.c
index 5f2402b..c8c4ca4 100644
--- a/lib/addr.c
+++ b/lib/addr.c
@@ -6,7 +6,7 @@
* License as published by the Free Software Foundation version 2.1
* of the License.
*
- * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2003-2010 Thomas Graf <tgraf@suug.ch>
*/
/**
@@ -151,6 +151,17 @@ static inline int dnet_pton(const char *src, char *addrbuf)
return 1;
}
+static void addr_destroy(struct nl_addr *addr)
+{
+ if (!addr)
+ return;
+
+ if (addr->a_refcnt != 1)
+ BUG();
+
+ free(addr);
+}
+
/**
* @name Creating Abstract Addresses
* @{
@@ -395,7 +406,7 @@ prefix:
char *p;
long pl = strtol(++prefix, &p, 0);
if (p == prefix) {
- nl_addr_destroy(addr);
+ addr_destroy(addr);
err = -NLE_INVAL;
goto errout;
}
@@ -431,28 +442,6 @@ struct nl_addr *nl_addr_clone(struct nl_addr *addr)
/** @} */
/**
- * @name Destroying Abstract Addresses
- * @{
- */
-
-/**
- * Destroy abstract address object.
- * @arg addr Abstract address object.
- */
-void nl_addr_destroy(struct nl_addr *addr)
-{
- if (!addr)
- return;
-
- if (addr->a_refcnt != 1)
- BUG();
-
- free(addr);
-}
-
-/** @} */
-
-/**
* @name Managing Usage References
* @{
*/
@@ -470,7 +459,7 @@ void nl_addr_put(struct nl_addr *addr)
return;
if (addr->a_refcnt == 1)
- nl_addr_destroy(addr);
+ addr_destroy(addr);
else
addr->a_refcnt--;
}