6
6
7
7
/* Test: test_increment_int */
8
8
9
- EXPORT void increment_int (int * ptr ) {
9
+ EXPORT void increment_int (int32_t * ptr ) {
10
10
* ptr += 1 ;
11
11
}
12
12
13
13
/* Test: test_init_int */
14
14
15
- EXPORT void init_int (int * ptr , int val ) {
15
+ EXPORT void init_int (int32_t * ptr , int32_t val ) {
16
16
* ptr = val ;
17
17
}
18
18
19
19
/* Test: test_init_array */
20
20
21
- EXPORT void init_array (int * array , size_t len , int val ) {
21
+ EXPORT void init_array (int32_t * array , size_t len , int32_t val ) {
22
22
for (size_t i = 0 ; i < len ; i ++ ) {
23
23
array [i ] = val ;
24
24
}
@@ -27,83 +27,83 @@ EXPORT void init_array(int *array, size_t len, int val) {
27
27
/* Test: test_init_static_inner */
28
28
29
29
typedef struct SyncPtr {
30
- int * ptr ;
30
+ int32_t * ptr ;
31
31
} SyncPtr ;
32
32
33
- EXPORT void init_static_inner (const SyncPtr * s_ptr , int val ) {
33
+ EXPORT void init_static_inner (const SyncPtr * s_ptr , int32_t val ) {
34
34
* (s_ptr -> ptr ) = val ;
35
35
}
36
36
37
37
/* Tests: test_exposed, test_pass_dangling */
38
38
39
- EXPORT void ignore_ptr (__attribute__((unused )) const int * ptr ) {
39
+ EXPORT void ignore_ptr (__attribute__((unused )) const int32_t * ptr ) {
40
40
return ;
41
41
}
42
42
43
43
/* Test: test_expose_int */
44
- EXPORT void expose_int (const int * int_ptr , const int * * pptr ) {
44
+ EXPORT void expose_int (const int32_t * int_ptr , const int32_t * * pptr ) {
45
45
* pptr = int_ptr ;
46
46
}
47
47
48
48
/* Test: test_swap_ptr */
49
49
50
- EXPORT void swap_ptr (const int * * pptr0 , const int * * pptr1 ) {
51
- const int * tmp = * pptr0 ;
50
+ EXPORT void swap_ptr (const int32_t * * pptr0 , const int32_t * * pptr1 ) {
51
+ const int32_t * tmp = * pptr0 ;
52
52
* pptr0 = * pptr1 ;
53
53
* pptr1 = tmp ;
54
54
}
55
55
56
56
/* Test: test_swap_ptr_tuple */
57
57
58
58
typedef struct Tuple {
59
- int * ptr0 ;
60
- int * ptr1 ;
59
+ int32_t * ptr0 ;
60
+ int32_t * ptr1 ;
61
61
} Tuple ;
62
62
63
63
EXPORT void swap_ptr_tuple (Tuple * t_ptr ) {
64
- int * tmp = t_ptr -> ptr0 ;
64
+ int32_t * tmp = t_ptr -> ptr0 ;
65
65
t_ptr -> ptr0 = t_ptr -> ptr1 ;
66
66
t_ptr -> ptr1 = tmp ;
67
67
}
68
68
69
69
/* Test: test_overwrite_dangling */
70
70
71
- EXPORT void overwrite_ptr (const int * * pptr ) {
71
+ EXPORT void overwrite_ptr (const int32_t * * pptr ) {
72
72
* pptr = NULL ;
73
73
}
74
74
75
75
/* Test: test_swap_ptr_triple_dangling */
76
76
77
77
typedef struct Triple {
78
- int * ptr0 ;
79
- int * ptr1 ;
80
- int * ptr2 ;
78
+ int32_t * ptr0 ;
79
+ int32_t * ptr1 ;
80
+ int32_t * ptr2 ;
81
81
} Triple ;
82
82
83
83
EXPORT void swap_ptr_triple_dangling (Triple * t_ptr ) {
84
- int * tmp = t_ptr -> ptr0 ;
84
+ int32_t * tmp = t_ptr -> ptr0 ;
85
85
t_ptr -> ptr0 = t_ptr -> ptr2 ;
86
86
t_ptr -> ptr2 = tmp ;
87
87
}
88
88
89
- EXPORT const int * return_ptr (const int * ptr ) {
89
+ EXPORT const int32_t * return_ptr (const int32_t * ptr ) {
90
90
return ptr ;
91
91
}
92
92
93
93
/* Test: test_pass_ptr_as_int */
94
94
95
- EXPORT void pass_ptr_as_int (uintptr_t ptr , int set_to_val ) {
96
- * (int * )ptr = set_to_val ;
95
+ EXPORT void pass_ptr_as_int (uintptr_t ptr , int32_t set_to_val ) {
96
+ * (int32_t * )ptr = set_to_val ;
97
97
}
98
98
99
99
/* Test: test_pass_ptr_via_previously_shared_mem */
100
100
101
- int * * shared_place ;
101
+ int32_t * * shared_place ;
102
102
103
- EXPORT void set_shared_mem (int * * ptr ) {
103
+ EXPORT void set_shared_mem (int32_t * * ptr ) {
104
104
shared_place = ptr ;
105
105
}
106
106
107
- EXPORT void init_ptr_stored_in_shared_mem (int val ) {
107
+ EXPORT void init_ptr_stored_in_shared_mem (int32_t val ) {
108
108
* * shared_place = val ;
109
109
}
0 commit comments