mirror of
https://gitee.com/Lamdonn/varch.git
synced 2025-12-06 08:46:42 +08:00
修复sList和dList的set方法
This commit is contained in:
parent
d9955e8742
commit
c91eabcb57
@ -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 | 日志输出模块
|
||||
|
||||
4
makefile
4
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
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user