comparison test/call_suite/globals.c @ 436:23b12c7ad462

- call_suite cleanup (no change in functionality): removal of unused decl, freeing memory at end, func renaming for clarity, static for tu-local symbols, ...
author Tassilo Philipp
date Wed, 26 Jan 2022 11:37:57 +0100
parents 8e22b70d3ee4
children 94c7904977aa
comparison
equal deleted inserted replaced
435:a29baee68340 436:23b12c7ad462
4 Library: test 4 Library: test
5 File: test/call_suite/globals.c 5 File: test/call_suite/globals.c
6 Description: 6 Description:
7 License: 7 License:
8 8
9 Copyright (c) 2011-2018 Daniel Adler <dadler@uni-goettingen.de>, 9 Copyright (c) 2011-2022 Daniel Adler <dadler@uni-goettingen.de>,
10 Tassilo Philipp <tphilipp@potion-studios.com> 10 Tassilo Philipp <tphilipp@potion-studios.com>
11 11
12 Permission to use, copy, modify, and distribute this software for any 12 Permission to use, copy, modify, and distribute this software for any
13 purpose with or without fee is hereby granted, provided that the above 13 purpose with or without fee is hereby granted, provided that the above
14 copyright notice and this permission notice appear in all copies. 14 copyright notice and this permission notice appear in all copies.
29 29
30 #define X(CH,T) T *V_##CH; T *K_##CH; 30 #define X(CH,T) T *V_##CH; T *K_##CH;
31 DEF_TYPES 31 DEF_TYPES
32 #undef X 32 #undef X
33 33
34 double rand_d() { return ( ( (double) rand() ) / ( (double) RAND_MAX ) ); } 34 static double rand_d() { return ( ( (double) rand() ) / ( (double) RAND_MAX ) ); }
35 35
36 void init_K() 36 void init_test_data()
37 { 37 {
38 int i; 38 int i;
39 #define X(CH,T) V_##CH = (T*) malloc(sizeof(T)*(G_maxargs+1)); K_##CH = (T*) malloc(sizeof(T)*(G_maxargs+1)); 39 #define X(CH,T) V_##CH = (T*) malloc(sizeof(T)*(G_maxargs+1)); K_##CH = (T*) malloc(sizeof(T)*(G_maxargs+1));
40 DEF_TYPES 40 DEF_TYPES
41 #undef X 41 #undef X
59 DEF_TYPES 59 DEF_TYPES
60 #undef X 60 #undef X
61 } 61 }
62 } 62 }
63 63
64 void deinit_test_data()
65 {
66 #define X(CH,T) free(V_##CH); free(K_##CH);
67 DEF_TYPES
68 #undef X
69 }