Commit 5699e0fa0c9617138754e1954c6cf71ad98526d9

Sylvain 2021-11-22T16:22:39

visualtest: use SDL_malloc

diff --git a/visualtest/src/action_configparser.c b/visualtest/src/action_configparser.c
index 6d95b91..fc226bc 100644
--- a/visualtest/src/action_configparser.c
+++ b/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;
-}
\ No newline at end of file
+}
diff --git a/visualtest/src/harness_argparser.c b/visualtest/src/harness_argparser.c
index aa814a6..b7f9d0d 100644
--- a/visualtest/src/harness_argparser.c
+++ b/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);
     }
-}
\ No newline at end of file
+}
diff --git a/visualtest/src/parsehelper.c b/visualtest/src/parsehelper.c
index 01e64b0..566ad8a 100644
--- a/visualtest/src/parsehelper.c
+++ b/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;
     }
 
diff --git a/visualtest/src/screenshot.c b/visualtest/src/screenshot.c
index 394ae09..189774f 100644
--- a/visualtest/src/screenshot.c
+++ b/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;
     }
diff --git a/visualtest/src/sut_configparser.c b/visualtest/src/sut_configparser.c
index b4f8e39..fa8c2d4 100644
--- a/visualtest/src/sut_configparser.c
+++ b/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;
     }
diff --git a/visualtest/src/variator_common.c b/visualtest/src/variator_common.c
index 4eea9b4..e8444b3 100644
--- a/visualtest/src/variator_common.c
+++ b/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;
-}
\ No newline at end of file
+}
diff --git a/visualtest/src/windows/windows_process.c b/visualtest/src/windows/windows_process.c
index da7a99c..36d0299 100644
--- a/visualtest/src/windows/windows_process.c
+++ b/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);
diff --git a/visualtest/src/windows/windows_screenshot.c b/visualtest/src/windows/windows_screenshot.c
index 5f26754..e3e8ea4 100644
--- a/visualtest/src/windows/windows_screenshot.c
+++ b/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;
     }