Skip to content

Commit ad94b85

Browse files
committed
Refine type definitions
New types may be suffixed with "_t".
1 parent 77ae9a3 commit ad94b85

File tree

4 files changed

+90
-88
lines changed

4 files changed

+90
-88
lines changed

bench.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
#include "tlsf.h"
1919

20-
static tlsf t = TLSF_INIT;
20+
static tlsf_t t = TLSF_INIT;
2121

2222
static void usage(const char *name)
2323
{
@@ -115,7 +115,7 @@ static void run_alloc_benchmark(size_t loops,
115115
static size_t max_size;
116116
static void *mem = 0;
117117

118-
void *tlsf_resize(tlsf *_t, size_t req_size)
118+
void *tlsf_resize(tlsf_t *_t, size_t req_size)
119119
{
120120
(void) _t;
121121
return req_size <= max_size ? mem : 0;

test.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ static size_t MAX_PAGES;
2121
static size_t curr_pages = 0;
2222
static void *start_addr = 0;
2323

24-
void *tlsf_resize(tlsf *t, size_t req_size)
24+
void *tlsf_resize(tlsf_t *t, size_t req_size)
2525
{
2626
(void) t;
2727

@@ -43,7 +43,7 @@ void *tlsf_resize(tlsf *t, size_t req_size)
4343
return start_addr;
4444
}
4545

46-
static void random_test(tlsf *t, size_t spacelen, const size_t cap)
46+
static void random_test(tlsf_t *t, size_t spacelen, const size_t cap)
4747
{
4848
const size_t maxitems = 2 * spacelen;
4949

@@ -112,7 +112,7 @@ static void random_test(tlsf *t, size_t spacelen, const size_t cap)
112112

113113
#define __arraycount(__x) (sizeof(__x) / sizeof(__x[0]))
114114

115-
static void random_sizes_test(tlsf *t)
115+
static void random_sizes_test(tlsf_t *t)
116116
{
117117
const size_t sizes[] = {16, 32, 64, 128, 256, 512, 1024, 1024 * 1024};
118118

@@ -127,7 +127,7 @@ static void random_sizes_test(tlsf *t)
127127
}
128128
}
129129

130-
static void large_alloc(tlsf *t, size_t s)
130+
static void large_alloc(tlsf_t *t, size_t s)
131131
{
132132
printf("large alloc %zu\n", s);
133133
for (size_t d = 0; d < 100 && d < s; ++d) {
@@ -147,7 +147,7 @@ static void large_alloc(tlsf *t, size_t s)
147147
}
148148
}
149149

150-
static void large_size_test(tlsf *t)
150+
static void large_size_test(tlsf_t *t)
151151
{
152152
size_t s = 1;
153153
while (s <= TLSF_MAX_SIZE) {
@@ -166,7 +166,7 @@ int main(void)
166166
{
167167
PAGE = (size_t) sysconf(_SC_PAGESIZE);
168168
MAX_PAGES = 20 * TLSF_MAX_SIZE / PAGE;
169-
tlsf t = TLSF_INIT;
169+
tlsf_t t = TLSF_INIT;
170170
srand((unsigned int) time(0));
171171
large_size_test(&t);
172172
random_sizes_test(&t);

0 commit comments

Comments
 (0)