1. Fix set and map iterate looping error issue

2. Fix the list pop back macro definition
This commit is contained in:
Lamdonn 2025-10-10 20:25:47 +08:00
parent a15641c42e
commit 70d1741bab
8 changed files with 44 additions and 24 deletions

View File

@ -45,13 +45,13 @@ It has the characteristics of **simplicity, universality, and efficiency**, with
| queue | 01.00.00 | [link](/doc/queue.en.md) | [path](./source/03_container) | Universal queue container
| stack | 01.00.00 | [link](/doc/stack.en.md) | [path](./source/03_container) | Universal stack container
| deque | 01.00.00 | [link](/doc/deque.en.md) | [path](./source/03_container) | Universal double-end queue container
| list | 01.00.00 | [link](/doc/list.en.md) | [path](./source/03_container) | Universal list container, single-link and internal iteration
| list | 01.00.01 | [link](/doc/list.en.md) | [path](./source/03_container) | Universal list container, single-link and internal iteration
| vector | 01.00.00 | [link](/doc/vector.en.md) | [path](./source/03_container) | Universal vector(array) container
| str | 01.00.00 | [link](/doc/str.en.md) | [path](./source/03_container) | String class
| dict | 01.00.00 | [link](/doc/dict.en.md) | [path](./source/03_container) | Universal dictionarie container, implementation based on hash table
| heap | 01.00.00 | [link](/doc/heap.en.md) | [path](./source/03_container) | Universal heap container
| set | 01.00.00 | [link](/doc/set.en.md) | [path](./source/03_container) | Universal set container, implementation based on RB-tree
| map | 01.00.00 | [link](/doc/map.en.md) | [path](./source/03_container) | Universal map container, implementation based on RB-tree
| set | 01.00.01 | [link](/doc/set.en.md) | [path](./source/03_container) | Universal set container, implementation based on RB-tree
| map | 01.00.01 | [link](/doc/map.en.md) | [path](./source/03_container) | Universal map container, implementation based on RB-tree
| tree | 01.00.00 | [link](/doc/tree.en.md) | [path](./source/03_container) | Universal tree container
| graph | 01.00.00 | [link](/doc/graph.en.md) | [path](./source/03_container) | Universal graph container
| check | 01.00.00 | [link](/doc/check.en.md) | [path](./source/04_algorithm) | Verification algorithm, sum check, parity check, XOR check, LRC check

View File

@ -45,13 +45,13 @@ varchwe-architecture意为我们的框架库是嵌入式C语言常用
| queue | 01.00.00 | [link](/doc/queue.md) | [path](./source/03_container) | 通用队列容器
| stack | 01.00.00 | [link](/doc/stack.md) | [path](./source/03_container) | 通用栈式容器
| deque | 01.00.00 | [link](/doc/deque.md) | [path](./source/03_container) | 通用双端队列容器
| list | 01.00.00 | [link](/doc/list.md) | [path](./source/03_container) | 通用列表容器,单链接和支持内部迭代器
| list | 01.00.01 | [link](/doc/list.md) | [path](./source/03_container) | 通用列表容器,单链接和支持内部迭代器
| vector | 01.00.00 | [link](/doc/vector.md) | [path](./source/03_container) | 通用向量(数组)容器
| str | 01.00.00 | [link](/doc/str.md) | [path](./source/03_container) | 字符串类
| dict | 01.00.00 | [link](/doc/dict.md) | [path](./source/03_container) | 通用字典容器,基于哈希表实现
| heap | 01.00.00 | [link](/doc/heap.md) | [path](./source/03_container) | 通用堆容器
| set | 01.00.00 | [link](/doc/set.md) | [path](./source/03_container) | 通用集合容器基于RB-tree实现
| map | 01.00.00 | [link](/doc/map.md) | [path](./source/03_container) | 通用映射容器基于RB-tree实现
| set | 01.00.01 | [link](/doc/set.md) | [path](./source/03_container) | 通用集合容器基于RB-tree实现
| map | 01.00.01 | [link](/doc/map.md) | [path](./source/03_container) | 通用映射容器基于RB-tree实现
| tree | 01.00.00 | [link](/doc/tree.md) | [path](./source/03_container) | 通用树容器
| graph | 01.00.00 | [link](/doc/graph.md) | [path](./source/03_container) | 通用图容器
| check | 01.00.00 | [link](/doc/check.md) | [path](./source/04_algorithm) | 校验算法求和校验奇偶校验异或校验LRC校验

View File

@ -6,7 +6,7 @@
* \unit list
* \brief This is a C language singly linked list with built-in iterators, simple, reliable, fast, small space
* \author Lamdonn
* \version v1.0.0
* \version v1.0.1
* \license GPL-2.0
* \copyright Copyright (C) 2023 Lamdonn.
********************************************************************************************************/

View File

@ -6,7 +6,7 @@
* \unit list
* \brief This is a C language singly linked list with built-in iterators, simple, reliable, fast, small space
* \author Lamdonn
* \version v1.0.0
* \version v1.0.1
* \license GPL-2.0
* \copyright Copyright (C) 2023 Lamdonn.
********************************************************************************************************/
@ -19,7 +19,7 @@
#define LIST_V_MAJOR 1
#define LIST_V_MINOR 0
#define LIST_V_PATCH 0
#define LIST_V_PATCH 1
/* list type definition, hiding structural members, not for external use */
@ -123,7 +123,7 @@ int list_dsize(list_t list);
* \param[out] data: the address of data
* \return 1 success or 0 fail
*/
#define list_pop_back(list) list_erase((list), list_size(list), 1)
#define list_pop_back(list) list_erase((list), list_size(list) - 1, 1)
/**
* \brief clear list.

View File

@ -6,7 +6,7 @@
* \unit map
* \brief This is a general-purpose C language map module, with common data structure
* \author Lamdonn
* \version v1.0.0
* \version v1.0.1
* \license GPL-2.0
* \copyright Copyright (C) 2023 Lamdonn.
********************************************************************************************************/
@ -694,8 +694,13 @@ static NODE* node_next(map_t map, NODE* node)
}
else
{
if (node == node->parent->left) node = node->parent;
else node = node->parent->parent;
NODE *parent = node->parent;
while (parent != map->nil && node == parent->right)
{
node = parent;
parent = parent->parent;
}
return parent;
}
return node;
}
@ -709,8 +714,13 @@ static NODE* node_prev(map_t map, NODE* node)
}
else
{
if (node == node->parent->right) node = node->parent;
else node = node->parent->parent;
NODE *parent = node->parent;
while (parent != map->nil && node == parent->left)
{
node = parent;
parent = parent->parent;
}
return parent;
}
return node;
}

View File

@ -6,7 +6,7 @@
* \unit map
* \brief This is a general-purpose C language map module, with common data structure
* \author Lamdonn
* \version v1.0.0
* \version v1.0.1
* \license GPL-2.0
* \copyright Copyright (C) 2023 Lamdonn.
********************************************************************************************************/
@ -20,7 +20,7 @@
#define MAP_V_MAJOR 1
#define MAP_V_MINOR 0
#define MAP_V_PATCH 0
#define MAP_V_PATCH 1
/* map type definition, hiding structural members, not for external use */

View File

@ -6,7 +6,7 @@
* \unit set
* \brief This is a general-purpose C language set module, with common data structure
* \author Lamdonn
* \version v1.0.0
* \version v1.0.1
* \license GPL-2.0
* \copyright Copyright (C) 2023 Lamdonn.
********************************************************************************************************/
@ -592,8 +592,13 @@ static NODE* node_next(set_t set, NODE* node)
}
else
{
if (node == node->parent->left) node = node->parent;
else node = node->parent->parent;
NODE *parent = node->parent;
while (parent != set->nil && node == parent->right)
{
node = parent;
parent = parent->parent;
}
return parent;
}
return node;
}
@ -607,8 +612,13 @@ static NODE* node_prev(set_t set, NODE* node)
}
else
{
if (node == node->parent->right) node = node->parent;
else node = node->parent->parent;
NODE *parent = node->parent;
while (parent != set->nil && node == parent->left)
{
node = parent;
parent = parent->parent;
}
return parent;
}
return node;
}

View File

@ -6,7 +6,7 @@
* \unit set
* \brief This is a general-purpose C language set module, with common data structure
* \author Lamdonn
* \version v1.0.0
* \version v1.0.1
* \license GPL-2.0
* \copyright Copyright (C) 2023 Lamdonn.
********************************************************************************************************/
@ -19,7 +19,7 @@
#define SET_V_MAJOR 1
#define SET_V_MINOR 0
#define SET_V_PATCH 0
#define SET_V_PATCH 1
/* set type definition, hiding structural members, not for external use */