Browse Source

visualtest: use SDL_malloc

Sylvain 3 năm trước cách đây
mục cha
commit
5699e0fa0c

+ 6 - 6
visualtest/src/action_configparser.c

@@ -54,7 +54,7 @@ SDLVisualTest_EnqueueAction(SDLVisualTest_ActionQueue* queue,
                                       sizeof(SDLVisualTest_ActionNode));
     if(!node)
     {
-        SDLTest_LogError("malloc() failed");
+        SDLTest_LogError("SDL_malloc() failed");
         return 0;
     }
     node->action = action;
@@ -220,10 +220,10 @@ SDLVisualTest_InsertIntoActionQueue(SDLVisualTest_ActionQueue* queue,
         return 1;
     }
 
-    newnode = (SDLVisualTest_ActionNode*)malloc(sizeof(SDLVisualTest_ActionNode));
+    newnode = (SDLVisualTest_ActionNode*)SDL_malloc(sizeof(SDLVisualTest_ActionNode));
     if(!newnode)
     {
-        SDLTest_LogError("malloc() failed");
+        SDLTest_LogError("SDL_malloc() failed");
         return 0;
     }
     newnode->action = action;
@@ -344,7 +344,7 @@ SDLVisualTest_ParseActionConfig(char* file, SDLVisualTest_ActionQueue* queue)
             path = (char*)SDL_malloc(sizeof(char) * (len + 1));
             if(!path)
             {
-                SDLTest_LogError("malloc() failed");
+                SDLTest_LogError("SDL_malloc() failed");
                 SDLVisualTest_EmptyActionQueue(queue);
                 SDL_RWclose(rw);
                 return 0;
@@ -358,7 +358,7 @@ SDLVisualTest_ParseActionConfig(char* file, SDLVisualTest_ActionQueue* queue)
                 args = (char*)SDL_malloc(sizeof(char) * (len + 1));
                 if(!args)
                 {
-                    SDLTest_LogError("malloc() failed");
+                    SDLTest_LogError("SDL_malloc() failed");
                     SDL_free(path);
                     SDLVisualTest_EmptyActionQueue(queue);
                     SDL_RWclose(rw);
@@ -393,4 +393,4 @@ SDLVisualTest_ParseActionConfig(char* file, SDLVisualTest_ActionQueue* queue)
 
     SDL_RWclose(rw);
     return 1;
-}
+}

+ 2 - 2
visualtest/src/harness_argparser.c

@@ -234,7 +234,7 @@ ParseConfig(char* file, SDLVisualTest_HarnessState* state)
         argv = (char**)SDL_malloc((num_params + 1) * sizeof(char*));
         if(!argv)
         {
-            SDLTest_LogError("malloc() failed.");
+            SDLTest_LogError("SDL_malloc() failed.");
             SDL_RWclose(rw);
             return 0;
         }
@@ -355,4 +355,4 @@ SDLVisualTest_FreeHarnessState(SDLVisualTest_HarnessState* state)
         SDLVisualTest_EmptyActionQueue(&state->action_queue);
         SDLVisualTest_FreeSUTConfig(&state->sut_config);
     }
-}
+}

+ 2 - 2
visualtest/src/parsehelper.c

@@ -96,7 +96,7 @@ TokenizeHelper(char* str, char** tokens, int num_tokens, int max_token_len)
         if(!tokens[index])
         {
             int i;
-            SDLTest_LogError("malloc() failed.");
+            SDLTest_LogError("SDL_malloc() failed.");
             for(i = 0; i < index; i++)
                 SDL_free(tokens[i]);
             return 0;
@@ -215,7 +215,7 @@ SDLVisualTest_ParseArgsToArgv(char* args)
     argv = (char**)SDL_malloc((num_tokens + 2) * sizeof(char*));
     if(!argv)
     {
-        SDLTest_LogError("malloc() failed.");
+        SDLTest_LogError("SDL_malloc() failed.");
         return NULL;
     }
 

+ 2 - 2
visualtest/src/screenshot.c

@@ -48,7 +48,7 @@ SDLVisualTest_VerifyScreenshots(char* args, char* test_dir, char* verify_dir)
     verify_path = (char*)SDL_malloc(verify_len * sizeof(char));
     if(!verify_path)
     {
-        SDLTest_LogError("malloc() failed");
+        SDLTest_LogError("SDL_malloc() failed");
         return_code = -1;
         goto verifyscreenshots_cleanup_generic;
     }
@@ -78,7 +78,7 @@ SDLVisualTest_VerifyScreenshots(char* args, char* test_dir, char* verify_dir)
     test_path = (char*)SDL_malloc(test_len * sizeof(char));
     if(!test_path)
     {
-        SDLTest_LogError("malloc() failed");
+        SDLTest_LogError("SDL_malloc() failed");
         return_code = -1;
         goto verifyscreenshots_cleanup_verifybmp;
     }

+ 1 - 1
visualtest/src/sut_configparser.c

@@ -61,7 +61,7 @@ SDLVisualTest_ParseSUTConfig(char* file, SDLVisualTest_SUTConfig* config)
                       sizeof(SDLVisualTest_SUTOption));
     if(!config->options)
     {
-        SDLTest_LogError("malloc() failed");
+        SDLTest_LogError("SDL_malloc() failed");
         SDL_RWclose(rw);
         return 0;
     }

+ 2 - 2
visualtest/src/variator_common.c

@@ -189,7 +189,7 @@ SDLVisualTest_InitVariation(SDLVisualTest_Variation* variation,
                      sizeof(SDLVisualTest_SUTOptionValue));
     if(!variation->vars)
     {
-        SDLTest_LogError("malloc() failed");
+        SDLTest_LogError("SDL_malloc() failed");
         return 0;
     }
     variation->num_vars = config->num_options;
@@ -222,4 +222,4 @@ SDLVisualTest_InitVariation(SDLVisualTest_Variation* variation,
         }
     }
     return 1;
-}
+}

+ 2 - 2
visualtest/src/windows/windows_process.c

@@ -61,7 +61,7 @@ SDL_LaunchProcess(char* file, char* args, SDL_ProcessInfo* pinfo)
     working_directory = (char*)SDL_malloc(path_length + 1);
     if(!working_directory)
     {
-        SDLTest_LogError("Could not allocate working_directory - malloc() failed.");
+        SDLTest_LogError("Could not allocate working_directory - SDL_malloc() failed.");
         return 0;
     }
 
@@ -80,7 +80,7 @@ SDL_LaunchProcess(char* file, char* args, SDL_ProcessInfo* pinfo)
     command_line = (char*)SDL_malloc(path_length + args_length + 2);
     if(!command_line)
     {
-        SDLTest_LogError("Could not allocate command_line - malloc() failed.");
+        SDLTest_LogError("Could not allocate command_line - SDL_malloc() failed.");
         return 0;
     }
     SDL_memcpy(command_line, file, path_length);

+ 2 - 2
visualtest/src/windows/windows_screenshot.c

@@ -241,7 +241,7 @@ ScreenshotWindow(HWND hwnd, char* filename, SDL_bool only_client_area)
         goto screenshotwindow_cleanup_capturebitmap;
     }
 
-    /* free resources */
+    /* Free resources */
 
 screenshotwindow_cleanup_capturebitmap:
     if(!DeleteObject(capturebitmap))
@@ -297,7 +297,7 @@ ScreenshotHwnd(HWND hwnd, LPARAM lparam)
     filename = (char*)SDL_malloc(len * sizeof(char));
     if(!filename)
     {
-        SDLTest_LogError("malloc() failed");
+        SDLTest_LogError("SDL_malloc() failed");
         return FALSE;
     }