comparison test/automated/SDL_at.c @ 3452:1f1a41879fe4

Use SDL's string and memory functions instead of stdlib
author Sam Lantinga <slouken@libsdl.org>
date Wed, 18 Nov 2009 09:28:35 +0000
parents 22ac66da0765
children 06c66b8d5033
comparison
equal deleted inserted replaced
3451:a65f7b3a2524 3452:1f1a41879fe4
6 * Released under Public Domain. 6 * Released under Public Domain.
7 */ 7 */
8 8
9 9
10 #include "SDL_at.h" 10 #include "SDL_at.h"
11 #include "SDL_stdinc.h"
11 12
12 #include <stdio.h> /* printf/fprintf */ 13 #include <stdio.h> /* printf/fprintf */
13 #include <stdarg.h> /* va_list */ 14 #include <stdarg.h> /* va_list */
14 #include <string.h> /* strdup */
15 #include <stdlib.h> /* free */
16 15
17 16
18 /* 17 /*
19 * Internal usage SDL_AT variables. 18 * Internal usage SDL_AT variables.
20 */ 19 */
43 * @brief Cleans up the automated testsuite state. 42 * @brief Cleans up the automated testsuite state.
44 */ 43 */
45 static void SDL_ATcleanup (void) 44 static void SDL_ATcleanup (void)
46 { 45 {
47 if (at_suite_msg != NULL) 46 if (at_suite_msg != NULL)
48 free(at_suite_msg); 47 SDL_free(at_suite_msg);
49 at_suite_msg = NULL; 48 at_suite_msg = NULL;
50 if (at_test_msg != NULL) 49 if (at_test_msg != NULL)
51 free(at_test_msg); 50 SDL_free(at_test_msg);
52 at_test_msg = NULL; 51 at_test_msg = NULL;
53 at_success = 0; 52 at_success = 0;
54 at_failure = 0; 53 at_failure = 0;
55 } 54 }
56 55
68 /* Must have a name. */ 67 /* Must have a name. */
69 if (suite == NULL) { 68 if (suite == NULL) {
70 SDL_ATprintErr( "AT testsuite does not have a name.\n"); 69 SDL_ATprintErr( "AT testsuite does not have a name.\n");
71 } 70 }
72 SDL_ATcleanup(); 71 SDL_ATcleanup();
73 at_suite_msg = strdup(suite); 72 at_suite_msg = SDL_strdup(suite);
74 73
75 /* Verbose message. */ 74 /* Verbose message. */
76 SDL_ATprintVerbose( 2, "--+---> Started Test Suite '%s'\n", at_suite_msg ); 75 SDL_ATprintVerbose( 2, "--+---> Started Test Suite '%s'\n", at_suite_msg );
77 } 76 }
78 77
164 } 163 }
165 /* Must have a name. */ 164 /* Must have a name. */
166 if (testcase == NULL) { 165 if (testcase == NULL) {
167 SDL_ATprintErr( "AT testcase does not have a name.\n"); 166 SDL_ATprintErr( "AT testcase does not have a name.\n");
168 } 167 }
169 at_test_msg = strdup(testcase); 168 at_test_msg = SDL_strdup(testcase);
170 169
171 /* Verbose message. */ 170 /* Verbose message. */
172 SDL_ATprintVerbose( 2, " +---> StartedTest Case '%s'\n", testcase ); 171 SDL_ATprintVerbose( 2, " +---> StartedTest Case '%s'\n", testcase );
173 } 172 }
174 173
193 /* Verbose message. */ 192 /* Verbose message. */
194 SDL_ATprintVerbose( 2, " +---- Finished Test Case '%s'\n", at_test_msg ); 193 SDL_ATprintVerbose( 2, " +---- Finished Test Case '%s'\n", at_test_msg );
195 194
196 /* Clean up. */ 195 /* Clean up. */
197 if (at_test_msg != NULL) 196 if (at_test_msg != NULL)
198 free(at_test_msg); 197 SDL_free(at_test_msg);
199 at_test_msg = NULL; 198 at_test_msg = NULL;
200 } 199 }
201 200
202 201
203 /** 202 /**