line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
int |
6
|
12
|
|
|
|
|
|
hoedown_stack_new(hoedown_stack *st, size_t initial_size) |
7
|
|
|
|
|
|
|
{ |
8
|
12
|
|
|
|
|
|
st->item = NULL; |
9
|
12
|
|
|
|
|
|
st->size = 0; |
10
|
12
|
|
|
|
|
|
st->asize = 0; |
11
|
|
|
|
|
|
|
|
12
|
12
|
50
|
|
|
|
|
if (!initial_size) |
13
|
|
|
|
|
|
|
initial_size = 8; |
14
|
|
|
|
|
|
|
|
15
|
12
|
|
|
|
|
|
return hoedown_stack_grow(st, initial_size); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
void |
19
|
0
|
|
|
|
|
|
hoedown_stack_free(hoedown_stack *st) |
20
|
|
|
|
|
|
|
{ |
21
|
0
|
0
|
|
|
|
|
if (!st) |
22
|
0
|
|
|
|
|
|
return; |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
free(st->item); |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
st->item = NULL; |
27
|
0
|
|
|
|
|
|
st->size = 0; |
28
|
0
|
|
|
|
|
|
st->asize = 0; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
int |
32
|
23
|
|
|
|
|
|
hoedown_stack_grow(hoedown_stack *st, size_t new_size) |
33
|
|
|
|
|
|
|
{ |
34
|
|
|
|
|
|
|
void **new_st; |
35
|
|
|
|
|
|
|
|
36
|
23
|
100
|
|
|
|
|
if (st->asize >= new_size) |
37
|
|
|
|
|
|
|
return 0; |
38
|
|
|
|
|
|
|
|
39
|
12
|
|
|
|
|
|
new_st = realloc(st->item, new_size * sizeof(void *)); |
40
|
12
|
50
|
|
|
|
|
if (new_st == NULL) |
41
|
|
|
|
|
|
|
return -1; |
42
|
|
|
|
|
|
|
|
43
|
12
|
|
|
|
|
|
memset(new_st + st->asize, 0x0, |
44
|
12
|
|
|
|
|
|
(new_size - st->asize) * sizeof(void *)); |
45
|
|
|
|
|
|
|
|
46
|
12
|
|
|
|
|
|
st->item = new_st; |
47
|
12
|
|
|
|
|
|
st->asize = new_size; |
48
|
|
|
|
|
|
|
|
49
|
12
|
50
|
|
|
|
|
if (st->size > new_size) |
50
|
0
|
|
|
|
|
|
st->size = new_size; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
return 0; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
int |
56
|
11
|
|
|
|
|
|
hoedown_stack_push(hoedown_stack *st, void *item) |
57
|
|
|
|
|
|
|
{ |
58
|
11
|
50
|
|
|
|
|
if (hoedown_stack_grow(st, st->size * 2) < 0) |
59
|
|
|
|
|
|
|
return -1; |
60
|
|
|
|
|
|
|
|
61
|
11
|
|
|
|
|
|
st->item[st->size++] = item; |
62
|
11
|
|
|
|
|
|
return 0; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
void * |
66
|
0
|
|
|
|
|
|
hoedown_stack_pop(hoedown_stack *st) |
67
|
|
|
|
|
|
|
{ |
68
|
0
|
0
|
|
|
|
|
if (!st->size) |
69
|
|
|
|
|
|
|
return NULL; |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
return st->item[--st->size]; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
void * |
75
|
0
|
|
|
|
|
|
hoedown_stack_top(hoedown_stack *st) |
76
|
|
|
|
|
|
|
{ |
77
|
0
|
0
|
|
|
|
|
if (!st->size) |
78
|
|
|
|
|
|
|
return NULL; |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
return st->item[st->size - 1]; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|