diff options
Diffstat (limited to 'openbsc')
-rw-r--r-- | openbsc/include/openbsc/debug.h | 2 | ||||
-rw-r--r-- | openbsc/include/openbsc/msgb.h | 1 | ||||
-rw-r--r-- | openbsc/src/msgb.c | 20 | ||||
-rw-r--r-- | openbsc/src/timer.c | 2 |
4 files changed, 23 insertions, 2 deletions
diff --git a/openbsc/include/openbsc/debug.h b/openbsc/include/openbsc/debug.h index 089132ea9..6ac3a5409 100644 --- a/openbsc/include/openbsc/debug.h +++ b/openbsc/include/openbsc/debug.h @@ -31,7 +31,7 @@ #define static_assert(exp, name) typedef int dummy##name [(exp) ? 1 : -1]; char *hexdump(const unsigned char *buf, int len); -void debugp(unsigned int subsys, char *file, int line, int cont, const char *format, ...); +void debugp(unsigned int subsys, char *file, int line, int cont, const char *format, ...) __attribute__ ((format (printf, 5, 6))); void debug_parse_category_mask(const char* mask); void debug_use_color(int use_color); void debug_timestamp(int enable); diff --git a/openbsc/include/openbsc/msgb.h b/openbsc/include/openbsc/msgb.h index 5ecac459b..ab3c03396 100644 --- a/openbsc/include/openbsc/msgb.h +++ b/openbsc/include/openbsc/msgb.h @@ -51,6 +51,7 @@ extern struct msgb *msgb_alloc(u_int16_t size, const char *name); extern void msgb_free(struct msgb *m); extern void msgb_enqueue(struct llist_head *queue, struct msgb *msg); extern struct msgb *msgb_dequeue(struct llist_head *queue); +extern void msgb_reset(struct msgb *m); #define msgb_l2(m) ((void *)(m->l2h)) #define msgb_l3(m) ((void *)(m->l3h)) diff --git a/openbsc/src/msgb.c b/openbsc/src/msgb.c index 52edf2dcd..edeb975a9 100644 --- a/openbsc/src/msgb.c +++ b/openbsc/src/msgb.c @@ -74,6 +74,26 @@ struct msgb *msgb_dequeue(struct llist_head *queue) return llist_entry(lh, struct msgb, list); } +void msgb_reset(struct msgb *msg) +{ + msg->len = 0; + msg->len = 0; + msg->data = 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; +} + static __attribute__((constructor)) void on_dso_load_trau_msgb(void) { tall_msgb_ctx = talloc_named_const(tall_bsc_ctx, 1, "msgb"); diff --git a/openbsc/src/timer.c b/openbsc/src/timer.c index 6f974a2c3..ffeb4aba3 100644 --- a/openbsc/src/timer.c +++ b/openbsc/src/timer.c @@ -176,7 +176,7 @@ restart: int bsc_timer_check(void) { struct timer_list *timer; - int i; + int i = 0; llist_for_each_entry(timer, &timer_list, entry) { i++; |