debian: Updates to fix lintian errors
[osmocom-bb.git] / src / msgb.c
index 2521ca8..f9841ed 100644 (file)
@@ -1,4 +1,5 @@
 /* (C) 2008 by Harald Welte <laforge@gnumonks.org>
+ * (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
  * All Rights Reserved
  *
  * This program is free software; you can redistribute it and/or modify
 #include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
-#include <sys/types.h>
 
-#include <osmocore/msgb.h>
+#include <osmocom/core/msgb.h>
 //#include <openbsc/gsm_data.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/talloc.h>
 //#include <openbsc/debug.h>
 
 void *tall_msgb_ctx;
@@ -44,12 +44,8 @@ struct msgb *msgb_alloc(uint16_t size, const char *name)
        msg->data_len = size;
        msg->len = 0;
        msg->data = msg->_data;
-
-       msg->head = msg->data;
-       msg->data = msg->data;
-       /* reset tail pointer */
-       msg->tail = msg->data;
-       //msg->end = msg->tail + size;
+       msg->head = msg->_data;
+       msg->tail = msg->_data;
 
        return msg;
 }
@@ -79,20 +75,31 @@ struct msgb *msgb_dequeue(struct llist_head *queue)
 
 void msgb_reset(struct msgb *msg)
 {
-       msg->len = 0;
        msg->len = 0;
        msg->data = msg->_data;
+       msg->head = msg->_data;
+       msg->tail = msg->_data;
 
-       msg->head = msg->data;
-       msg->data = msg->data;
-       /* reset tail pointer */
-       msg->tail = msg->data;
-
-       /* reset pointers */
-       msg->bts_link = NULL;
        msg->trx = NULL;
        msg->lchan = NULL;
        msg->l2h = NULL;
        msg->l3h = NULL;
-       msg->smsh = NULL;
+       msg->l4h = NULL;
+
+       memset(&msg->cb, 0, sizeof(msg->cb));
+}
+
+uint8_t *msgb_data(const struct msgb *msg)
+{
+       return msg->data;
+}
+
+uint16_t msgb_length(const struct msgb *msg)
+{
+       return msg->len;
+}
+
+void msgb_set_talloc_ctx(void *ctx)
+{
+       tall_msgb_ctx = ctx;
 }