From 3b466158a457b5a6068094ad19a74236cca8dd2f Mon Sep 17 00:00:00 2001 From: "7u83@mail.ru" <7u83@mail.ru@noemail.net> Date: Fri, 1 May 2015 10:50:03 +0000 Subject: [PATCH] Added set function. FossilOrigin-Name: 60afdccc5f962d3b8dd7d468ce8628ff1cbc16661ad76f46be88021be063c1ad --- src/capwap/mbag.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/capwap/mbag.h b/src/capwap/mbag.h index 39e86bc2..34844872 100644 --- a/src/capwap/mbag.h +++ b/src/capwap/mbag.h @@ -37,8 +37,10 @@ struct mbag_typedef{ const char *name; void (*del)(void*); int (*to_str)(void*,char *dst); - + struct mbag_item * (*from_str)(const char *src); }; + + typedef const struct mbag_typedef * mbagtype_t; @@ -99,6 +101,21 @@ struct mbag_item *mbag_item_create(mbag_t s, const char *id); struct mbag_item *mbag_i_item_create(mbag_t s, uint32_t id); +static inline int mbag_set(mbag_t t,mbag_item_t *is) +{ + mavl_del(t,is); + mavl_add(t,is); + return 1; + +/* + struct mbag_item *i = mavl_get(s, is); + if (i) { + mbag_del_data(i); + return i; + } + mavl_add(t,is); +*/ +} static inline int mbag_set_byte(mbag_t s, const char *id, uint8_t byte) {