summaryrefslogtreecommitdiff
path: root/cesar/mac/sar/src/sar_pb.c
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/mac/sar/src/sar_pb.c')
-rw-r--r--cesar/mac/sar/src/sar_pb.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/cesar/mac/sar/src/sar_pb.c b/cesar/mac/sar/src/sar_pb.c
new file mode 100644
index 0000000000..1315323453
--- /dev/null
+++ b/cesar/mac/sar/src/sar_pb.c
@@ -0,0 +1,48 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file sar_pb.c
+ * \brief common function to process pbs
+ * \ingroup mac/sar/src
+ *
+ */
+
+#include "common/std.h"
+#include "mac/sar/inc/sar_pb.h"
+
+/**
+ * Free a pb of a chain and return the next PB of the PB given in parameter
+ *
+ * \param pb The PB to free
+ * \return The next PB of the freed PB.
+ */
+pb_t *pb_free (pb_t *pb)
+{
+ pb_t *next;
+
+ dbg_assert (pb);
+
+ next = pb->next;
+ blk_release_desc ((blk_t *) pb);
+
+ return next;
+}
+
+/**
+ * Free a range of pb
+ *
+ * \param pb The PB to free
+ * \return The next PB of the freed PB.
+ */
+void pb_free_range (pb_t *pb)
+{
+ dbg_assert (pb);
+
+ while ((pb = pb_free (pb)))
+ ;
+}