improve darray

This commit is contained in:
xianjimli 2020-10-22 14:17:57 +08:00
parent 40f7bf6b60
commit 68a164dd79
3 changed files with 10 additions and 1 deletions

View File

@ -2,6 +2,7 @@
2020/10/22
* OpenGL 模式下的图片采样算法由相邻采样改为线性采样,主要为了提高图片旋转缩放效果(感谢智明提供补丁)。
* 修改darray的elms为NULL是内存泄漏的问题感谢兆坤提供补丁
2020/10/21
* awtk-web 修复编译报错问题(感谢智明提供补丁)。

View File

@ -335,7 +335,7 @@ ret_t darray_deinit(darray_t* darray) {
}
ret_t darray_destroy(darray_t* darray) {
return_value_if_fail(darray != NULL && darray->elms != NULL, RET_BAD_PARAMS);
return_value_if_fail(darray != NULL, RET_BAD_PARAMS);
darray_deinit(darray);
TKMEM_FREE(darray);

View File

@ -29,6 +29,14 @@ TEST(DArrayTest, create) {
darray_destroy(darray);
}
TEST(DArrayTest, create0) {
darray_t* darray = darray_create(0, NULL, NULL);
ASSERT_EQ(darray->size, 0);
ASSERT_EQ(darray->elms == NULL, true);
ASSERT_EQ(darray->capacity, 0);
darray_destroy(darray);
}
TEST(DArrayTest, stack) {
char* p = NULL;
darray_t* darray = darray_create(10, NULL, NULL);