ithewei 5 rokov pred
rodič
commit
00457d8d9e
4 zmenil súbory, kde vykonal 4 pridanie a 3 odobranie
  1. 1 1
      Makefile
  2. 0 1
      base/hbase.c
  3. 1 1
      unittest/CMakeLists.txt
  4. 2 0
      unittest/hstring_test.cpp

+ 1 - 1
Makefile

@@ -97,7 +97,7 @@ unittest: prepare
 	$(CC)  -g -Wall -std=c99   -I. -Ibase            -o bin/connect_test      unittest/connect_test.c       base/hsocket.c base/htime.c
 	$(CC)  -g -Wall -std=c99   -I. -Ibase            -o bin/socketpair_test   unittest/socketpair_test.c    base/hsocket.c
 	$(CXX) -g -Wall -std=c++11 -I. -Ibase            -o bin/defer_test        unittest/defer_test.cpp
-	$(CXX) -g -Wall -std=c++11 -I. -Ibase            -o bin/hstring_test      unittest/hstring_test.cpp     base/hstring.cpp base/hbase.c
+	$(CXX) -g -Wall -std=c++11 -I. -Ibase            -o bin/hstring_test      unittest/hstring_test.cpp     base/hstring.cpp
 	$(CXX) -g -Wall -std=c++11 -I. -Ibase            -o bin/threadpool_test   unittest/threadpool_test.cpp  -pthread
 	$(CXX) -g -Wall -std=c++11 -I. -Ibase            -o bin/objectpool_test   unittest/objectpool_test.cpp  -pthread
 	$(CXX) -g -Wall -std=c++11 -I. -Ibase            -o bin/ls                unittest/listdir_test.cpp     base/hdir.cpp

+ 0 - 1
base/hbase.c

@@ -19,7 +19,6 @@ unsigned int hv_free_cnt() {
 
 void* safe_malloc(size_t size) {
     ATOMIC_INC(&s_alloc_cnt);
-    ++s_alloc_cnt;
     void* ptr = malloc(size);
     if (!ptr) {
         fprintf(stderr, "malloc failed!\n");

+ 1 - 1
unittest/CMakeLists.txt

@@ -22,7 +22,7 @@ target_include_directories(socketpair_test PRIVATE .. ../base)
 add_executable(defer_test defer_test.cpp)
 target_include_directories(defer_test PRIVATE .. ../base)
 
-add_executable(hstring_test hstring_test.cpp ../base/hstring.cpp ../base/hbase.c)
+add_executable(hstring_test hstring_test.cpp ../base/hstring.cpp)
 target_include_directories(hstring_test PRIVATE .. ../base)
 
 add_executable(threadpool_test threadpool_test.cpp)

+ 2 - 0
unittest/hstring_test.cpp

@@ -1,6 +1,7 @@
 #include "hstring.h"
 
 int main(int argc, char** argv) {
+    /*
     char str1[] = "a1B2*C3d4==";
     char str2[] = "a1B2*C3d4==";
     printf("strupper %s\n", strupper(str1));
@@ -13,6 +14,7 @@ int main(int argc, char** argv) {
         (int)strstartswith(str4, "123"),
         (int)strendswith(str4, "789"),
         (int)strcontains(str4, "456"));
+    */
 
     std::string str5 = asprintf("%s%d", "hello", 5);
     printf("asprintf %s\n", str5.c_str());