From 173cc5cf96611e8598121f4beffefbe1113b39fc Mon Sep 17 00:00:00 2001 From: "7u83@mail.ru" <7u83@mail.ru@noemail.net> Date: Fri, 1 May 2015 10:45:59 +0000 Subject: [PATCH] Documentation + removing of debug printfs. FossilOrigin-Name: ea37a6cb345339e283844623141002e6fa9bb9b36fde3f63d1869d1ccc50a1ac --- src/capwap/mavl_merge.c | 53 +++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/src/capwap/mavl_merge.c b/src/capwap/mavl_merge.c index b1627996..1c8cdee8 100644 --- a/src/capwap/mavl_merge.c +++ b/src/capwap/mavl_merge.c @@ -1,28 +1,45 @@ +/* + This file is part of libcapwap. + + libcapwap is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + libcapwap is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Foobar. If not, see . + +*/ + #include "mavl.h" -#include "dbg.h" //Tube -#include "mbag.h" +/** + * @file + * @brief Implementation if mavl_merge. + * @addtogroup MavlFunctions + * @{ + */ + static void mavlnode_move(mavl_t m,mavl_t t, struct mavlnode *n) { - - struct mavlnode * mn = mavl_get_node(m,n->data); if (mn) { -DBGX("replacing !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",""); if (m->del) { m->del(mn->data); } mn->data=n->data; } else{ -DBGX("ODDING replacing !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",""); mavl_add(m,n->data); } - - free(n); t->count--; } @@ -35,17 +52,27 @@ static void mavl_merge0(mavl_t m, mavl_t t ,struct mavlnode * n) return; mavl_merge0(m,t,n->left); mavl_merge0(m,t,n->right); - -mbag_item_t *i = n->data; -DBGX("MBAG I %s",i->id); - mavlnode_move(m,t,n); } + +/** + * Merge two MAVL Objects + * + * Move all elements in MAVL object t to MAVL object m. Delete all + * elements from MAVL object t. If an element from t already exists + * in m, it will be replaced. + * + * @param m target object + * @param t source object + * + * + */ void mavl_merge(mavl_t m, mavl_t t) { mavl_merge0(m,t,t->root); - t->root=0; + t->root=NULL; } +/** *@} */