From 8339f9c864b5858ce58d96abeeffcfc234b6b9ca Mon Sep 17 00:00:00 2001 From: hzcheng Date: Sun, 29 Mar 2020 19:19:51 +0800 Subject: [PATCH] TD-34 --- src/util/src/tlist.c | 4 ++++ src/util/tests/stringTest.cpp | 28 ++++++++++++++-------------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/util/src/tlist.c b/src/util/src/tlist.c index aaedc76726..bdb12a59f9 100644 --- a/src/util/src/tlist.c +++ b/src/util/src/tlist.c @@ -100,6 +100,8 @@ SListNode *tdListPopHead(SList *list) { list->head = node->next; } list->numOfEles--; + node->next = NULL; + node->prev = NULL; return node; } @@ -113,6 +115,7 @@ SListNode *tdListPopTail(SList *list) { list->tail = node->prev; } list->numOfEles--; + node->next = node->prev = NULL; return node; } @@ -131,6 +134,7 @@ SListNode *tdListPopNode(SList *list, SListNode *node) { node->next->prev = node->prev; } list->numOfEles--; + node->next = node->prev = NULL; return node; } diff --git a/src/util/tests/stringTest.cpp b/src/util/tests/stringTest.cpp index b1b06c7f49..ef8df90e3e 100644 --- a/src/util/tests/stringTest.cpp +++ b/src/util/tests/stringTest.cpp @@ -157,22 +157,22 @@ TEST(testCase, string_strnchr_test) { EXPECT_TRUE(strnchr(a10, '.', strlen(a10), true) == NULL); } -TEST(testCase, cache_resize_test) { - char a11[] = "abc'.'"; - EXPECT_TRUE(strnchr(a11, '.', strlen(a11), false) != NULL); +// TEST(testCase, cache_resize_test) { +// char a11[] = "abc'.'"; +// EXPECT_TRUE(strnchr(a11, '.', strlen(a11), false) != NULL); - char a12[] = "abc'-'"; - EXPECT_TRUE(strnchr(a12, '-', strlen(a12), false) != NULL); +// char a12[] = "abc'-'"; +// EXPECT_TRUE(strnchr(a12, '-', strlen(a12), false) != NULL); - char a15[] = "abc'-'"; - EXPECT_TRUE(strnchr(a15, '-', strlen(a15), true) == NULL); +// char a15[] = "abc'-'"; +// EXPECT_TRUE(strnchr(a15, '-', strlen(a15), true) == NULL); - char a13[] = "'-'"; - EXPECT_TRUE(strnchr(a13, '-', strlen(a13), false) != NULL); +// char a13[] = "'-'"; +// EXPECT_TRUE(strnchr(a13, '-', strlen(a13), false) != NULL); - char a14[] = "'-'"; - EXPECT_TRUE(strnchr(a14, '-', strlen(a14), true) == NULL); +// char a14[] = "'-'"; +// EXPECT_TRUE(strnchr(a14, '-', strlen(a14), true) == NULL); - char a16[] = "'-'."; - EXPECT_TRUE(strnchr(a16, '.', strlen(a16), true) != NULL); -} \ No newline at end of file +// char a16[] = "'-'."; +// EXPECT_TRUE(strnchr(a16, '.', strlen(a16), true) != NULL); +// } \ No newline at end of file -- GitLab