瀏覽代碼

MSVC: Fix warning about assignment in condition

Max Bruckner 8 年之前
父節點
當前提交
ac368e9dfb
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      cJSON.c

+ 2 - 1
cJSON.c

@@ -147,7 +147,8 @@ static unsigned char* cJSON_strdup(const unsigned char* string, const internal_h
     }
 
     length = strlen((const char*)string) + sizeof("");
-    if (!(copy = (unsigned char*)hooks->allocate(length)))
+    copy = (unsigned char*)hooks->allocate(length);
+    if (copy == NULL)
     {
         return NULL;
     }