aboutsummaryrefslogtreecommitdiff
path: root/collections/map/map.c
diff options
context:
space:
mode:
Diffstat (limited to 'collections/map/map.c')
-rw-r--r--collections/map/map.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/collections/map/map.c b/collections/map/map.c
index a1c7798..c217fa2 100644
--- a/collections/map/map.c
+++ b/collections/map/map.c
@@ -50,6 +50,12 @@ struct map_node **node;
tmp->right = (*node)->left;
(*node)->left = tmp;
+ (*node)->parent = (*node)->left->parent;
+ (*node)->left->parent = *node;
+
+ if ((*node)->left->right)
+ (*node)->left->right->parent = (*node)->left;
+
return;
}
@@ -63,6 +69,12 @@ struct map_node **node;
tmp->left = (*node)->right;
(*node)->right = tmp;
+ (*node)->parent = (*node)->right->parent;
+ (*node)->right->parent = *node;
+
+ if ((*node)->right->left)
+ (*node)->right->left->parent = (*node)->right;
+
return;
}