summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2004-05-31 20:47:19 +0200
committerMartin Mares <mj@ucw.cz>2004-05-31 20:47:19 +0200
commit2cc37815ae1f194c5a0c51e5761377caea9cc164 (patch)
tree9e623bfb0bf52219d1aac31b0fca08e4422efbef
parent0077aab4f9041e4d05d2d6916edfb0e15738cb37 (diff)
downloadbird-2cc37815ae1f194c5a0c51e5761377caea9cc164.tar
bird-2cc37815ae1f194c5a0c51e5761377caea9cc164.zip
Added rmove() (by Andreas, tweaked by me).
-rw-r--r--lib/resource.c20
-rw-r--r--lib/resource.h1
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/resource.c b/lib/resource.c
index a51e3ca..2a1ad62 100644
--- a/lib/resource.c
+++ b/lib/resource.c
@@ -107,6 +107,26 @@ pool_lookup(resource *P, unsigned long a)
}
/**
+ * 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
*
diff --git a/lib/resource.h b/lib/resource.h
index ab53048..42ed26e 100644
--- a/lib/resource.h
+++ b/lib/resource.h
@@ -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 *);