diff --git a/README.md b/README.md index 79f722b..baef264 100644 --- a/README.md +++ b/README.md @@ -21,11 +21,11 @@ varch(we-architecture,意为我们的框架库)是嵌入式C语言常用 | command | 01.00.00 | [link](/doc/command.md) | ./source/01_general | 命令解析模块,输入字符串命令(类似于shell命令),执行相应的命令功能 | cPatten | 01.00.00 | [link](/doc/cPatten.md) | ./source/01_general | 艺术图案字符 | cQueue | 01.00.00 | [link](/doc/cQueue.md) | ./source/01_general | 通用队列控制器 -| dList | 01.00.00 | [link](/doc/dList.md) | ./source/01_general | 通用双链表控制器 +| dList | 01.00.01 | [link](/doc/dList.md) | ./source/01_general | 通用双链表控制器 | fsm | 01.00.00 | [link](/doc/fsm.md) | ./source/01_general | 通用有限状态机模块 | kern | 01.00.00 | [link](/doc/kern.md) | ./source/01_general | 用于调度周期性任务的内核模块主要用于varch测试 | oscp | 01.00.00 | [link](/doc/oscp.md) | ./source/01_general | 模拟示波器模块,可以方便地监测波形的变量变化 -| sList | 01.00.00 | [link](/doc/sList.md) | ./source/01_general | 通用单链表控制器 +| sList | 01.00.01 | [link](/doc/sList.md) | ./source/01_general | 通用单链表控制器 | tool | 01.00.00 | [link](/doc/tool.md) | ./source/01_general | 通用工具代码 | valloc | 01.00.00 | [link](/doc/valloc.md) | ./source/01_general | 动态内存使用测试工具 | vlog | 01.01.00 | [link](/doc/vlog.md) | ./source/01_general | 日志输出模块 diff --git a/makefile b/makefile index 9b85227..4b37af1 100644 --- a/makefile +++ b/makefile @@ -44,7 +44,7 @@ SOURCES += $(wildcard $(PARSER_PATH)/*.c) # SOURCES += $(TESTSPACE)/test_valloc.c # SOURCES += $(TESTSPACE)/test_arg.c # SOURCES += $(TESTSPACE)/test_vstd.c -SOURCES += $(TESTSPACE)/test_vlog.c +# SOURCES += $(TESTSPACE)/test_vlog.c # SOURCES += $(TESTSPACE)/test_ini.c # SOURCES += $(TESTSPACE)/test_txls.c # SOURCES += $(TESTSPACE)/test_xml.c @@ -75,7 +75,7 @@ SOURCES += $(TESTSPACE)/test_vlog.c # SOURCES += $(TESTSPACE)/test_filter.c # SOURCES += $(TESTSPACE)/test_oscp.c # SOURCES += $(TESTSPACE)/test_tool.c -# SOURCES += $(TESTSPACE)/test_sList.c +SOURCES += $(TESTSPACE)/test_sList.c # SOURCES += $(TESTSPACE)/test_dList.c # SOURCES += $(TESTSPACE)/test_cQueue.c diff --git a/source/01_general/dList.c b/source/01_general/dList.c index ba6d3f2..a10f8dc 100644 --- a/source/01_general/dList.c +++ b/source/01_general/dList.c @@ -436,8 +436,8 @@ int dList_set(dList *list, void* data, int size) { d = realloc(list->data, size); if (!d) return 0; + list->data = d; } - list->data = d; /* Data assignment */ if (data) memcpy(list->data, data, size); diff --git a/source/01_general/dList.h b/source/01_general/dList.h index 722cccc..8e85560 100644 --- a/source/01_general/dList.h +++ b/source/01_general/dList.h @@ -19,7 +19,7 @@ #define DLIST_V_MAJOR 1 #define DLIST_V_MINOR 0 -#define DLIST_V_PATCH 0 +#define DLIST_V_PATCH 1 /* Type of dList */ typedef struct dList diff --git a/source/01_general/sList.c b/source/01_general/sList.c index 9682d34..c1455b5 100644 --- a/source/01_general/sList.c +++ b/source/01_general/sList.c @@ -342,8 +342,8 @@ int sList_set(sList *list, void* data, int size) { d = realloc(list->data, size); if (!d) return 0; + list->data = d; } - list->data = d; /* Data assignment */ if (data) memcpy(list->data, data, size); diff --git a/source/01_general/sList.h b/source/01_general/sList.h index 6567dbf..46008e7 100644 --- a/source/01_general/sList.h +++ b/source/01_general/sList.h @@ -19,7 +19,7 @@ #define SLIST_V_MAJOR 1 #define SLIST_V_MINOR 0 -#define SLIST_V_PATCH 0 +#define SLIST_V_PATCH 1 /* Type of sList */ typedef struct sList diff --git a/test/test_sList.c b/test/test_sList.c index 610911e..4bd9ef4 100644 --- a/test/test_sList.c +++ b/test/test_sList.c @@ -55,6 +55,10 @@ static void test_set(void) sList_set(list, &dataInt, sizeof(dataInt)); printf("list->data %d\r\n", sList_ref(list, int)); + dataInt = 100; + sList_set(list, &dataInt, sizeof(dataInt)); + printf("list->data %d\r\n", sList_ref(list, int)); + sList_set(list, dataString, strlen(dataString) + 1); printf("list->data %s\r\n", ((char *)(list->data))); @@ -320,14 +324,14 @@ static void test(void) printf("sList test!\r\n"); // test_create(); - // test_set(); + test_set(); // test_insert(); // test_erase(); // test_attach(); // test_detach(); // test_push(); // test_pop(); - test_to(); + // test_to(); // test_size(); // test_append(); // test_copy();