]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Added rmove() (by Andreas, tweaked by me).
authorMartin Mares <mj@ucw.cz>
Mon, 31 May 2004 18:47:19 +0000 (18:47 +0000)
committerMartin Mares <mj@ucw.cz>
Mon, 31 May 2004 18:47:19 +0000 (18:47 +0000)
lib/resource.c
lib/resource.h

index a51e3cafaff422732288a73208c55b4e9be5d2bb..2a1ad62b4c540baaea3482c1e28160b67c88a394 100644 (file)
@@ -106,6 +106,26 @@ pool_lookup(resource *P, unsigned long a)
   return NULL;
 }
 
+/**
+ * rmove - move a resource
+ * @res: resource
+ * @p: pool to move the resource to
+ *
+ * rmove() moves a resource from one pool to another.
+ */
+
+void rmove(void *res, pool *p)
+{
+  resource *r = res;
+
+  if (r)
+    {
+      if (r->n.next)
+        rem_node(&r->n);
+      add_tail(&p->inside, &r->n);
+    }
+}
+
 /**
  * rfree - free a resource
  * @res: resource
index ab530480330ca469f93058fb49b97aa72b88babc..42ed26ed65f53311a58fdcea0016957864fe6c38 100644 (file)
@@ -37,6 +37,7 @@ pool *rp_new(pool *, char *);         /* Create new pool */
 void rfree(void *);                    /* Free single resource */
 void rdump(void *);                    /* Dump to debug output */
 void rlookup(unsigned long);           /* Look up address (only for debugging) */
+void rmove(void *, pool *);            /* Move to a different pool */
 
 void *ralloc(pool *, struct resclass *);