]> git.ipfire.org Git - thirdparty/libnl.git/commitdiff
addr: hide nl_addr_destroy()
authorThomas Graf <tgraf@suug.ch>
Fri, 26 Nov 2010 15:32:10 +0000 (16:32 +0100)
committerThomas Graf <tgraf@suug.ch>
Fri, 26 Nov 2010 15:32:10 +0000 (16:32 +0100)
everyone should use nl_addr_put()

include/netlink/addr.h
lib/addr.c

index cc3d201f97814c4e4beb76fbad1db69d24f4666a..794c4ff803c89b2299b3871b1844548fd0d38e92 100644 (file)
@@ -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>
  */
 
 #ifndef NETLINK_ADDR_H_
@@ -27,9 +27,6 @@ extern struct nl_addr *       nl_addr_build(int, void *, size_t);
 extern int             nl_addr_parse(const char *, int, struct nl_addr **);
 extern struct nl_addr *        nl_addr_clone(struct nl_addr *);
 
-/* Destroyage */
-extern void            nl_addr_destroy(struct nl_addr *);
-
 /* Usage Management */
 extern struct nl_addr *        nl_addr_get(struct nl_addr *);
 extern void            nl_addr_put(struct nl_addr *);
index 5f2402b3b0cc0c979b35b1f9776e56e7575375c2..c8c4ca47fbd7f4340369584bcb06656b720a3d2a 100644 (file)
@@ -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;
                }
@@ -430,28 +441,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--;
 }