../3rdparty/pcre/sljit/sljitUtils.c

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4static pthread_mutex_t allocator_mutex = { { 0, 0, 0, 0, 0, 0, { 0, 0 } } }; -
5 -
6static __inline void allocator_grab_lock(void) -
7{ -
8 pthread_mutex_lock(&allocator_mutex); -
9}
executed: }
Execution Count:30
30
10 -
11static __inline void allocator_release_lock(void) -
12{ -
13 pthread_mutex_unlock(&allocator_mutex); -
14}
executed: }
Execution Count:30
30
15 -
16 -
17 -
18 -
19 -
20static pthread_mutex_t global_mutex = { { 0, 0, 0, 0, 0, 0, { 0, 0 } } }; -
21 -
22static __attribute__((unused)) void sljit_grab_lock(void) -
23{ -
24 pthread_mutex_lock(&global_mutex); -
25}
never executed: }
0
26 -
27static __attribute__((unused)) void sljit_release_lock(void) -
28{ -
29 pthread_mutex_unlock(&global_mutex); -
30}
never executed: }
0
31 -
32 -
33 -
34static sljit_w sljit_page_align = 0; -
35 -
36static __attribute__((unused)) struct sljit_stack* sljit_allocate_stack(sljit_uw limit, sljit_uw max_limit) -
37{ -
38 struct sljit_stack *stack; -
39 union { -
40 void *ptr; -
41 sljit_uw uw; -
42 } base; -
43 -
44 -
45 -
46 -
47 if (limit > max_limit || limit < 1)
never evaluated: limit > max_limit
never evaluated: limit < 1
0
48 return ((void *)0);
never executed: return ((void *)0);
0
49 -
50 -
51 -
52 -
53 -
54 -
55 -
56 if (!sljit_page_align) {
never evaluated: !sljit_page_align
0
57 sljit_page_align = sysconf(_SC_PAGESIZE); -
58 -
59 if (sljit_page_align < 0)
never evaluated: sljit_page_align < 0
0
60 sljit_page_align = 4096;
never executed: sljit_page_align = 4096;
0
61 sljit_page_align--; -
62 }
never executed: }
0
63 -
64 -
65 -
66 max_limit = (max_limit + sljit_page_align) & ~sljit_page_align; -
67 -
68 stack = (struct sljit_stack*)(pcre16_malloc)(sizeof(struct sljit_stack)); -
69 if (!stack)
never evaluated: !stack
0
70 return ((void *)0);
never executed: return ((void *)0);
0
71 base.ptr = mmap(0, max_limit, 0x1 | 0x2, 0x02 | 0x20, -1, 0); -
72 if (base.ptr == ((void *) -1)) {
never evaluated: base.ptr == ((void *) -1)
0
73 (pcre16_free)(stack); -
74 return ((void *)0);
never executed: return ((void *)0);
0
75 } -
76 stack->base = base.uw; -
77 stack->limit = stack->base + limit; -
78 stack->max_limit = stack->base + max_limit; -
79 -
80 stack->top = stack->base; -
81 return stack;
never executed: return stack;
0
82} -
83 -
84 -
85 -
86static __attribute__((unused)) void sljit_free_stack(struct sljit_stack* stack) -
87{ -
88 -
89 -
90 -
91 munmap((void*)stack->base, stack->max_limit - stack->base); -
92 -
93 (pcre16_free)(stack); -
94}
never executed: }
0
95 -
96static __attribute__((unused)) sljit_w sljit_stack_resize(struct sljit_stack* stack, sljit_uw new_limit) -
97{ -
98 sljit_uw aligned_old_limit; -
99 sljit_uw aligned_new_limit; -
100 -
101 if ((new_limit > stack->max_limit) || (new_limit < stack->base))
never evaluated: (new_limit > stack->max_limit)
never evaluated: (new_limit < stack->base)
0
102 return -1;
never executed: return -1;
0
103 if (new_limit >= stack->limit) {
never evaluated: new_limit >= stack->limit
0
104 stack->limit = new_limit; -
105 return 0;
never executed: return 0;
0
106 } -
107 aligned_new_limit = (new_limit + sljit_page_align) & ~sljit_page_align; -
108 aligned_old_limit = (stack->limit + sljit_page_align) & ~sljit_page_align; -
109 if (aligned_new_limit < aligned_old_limit)
never evaluated: aligned_new_limit < aligned_old_limit
0
110 -
111 -
112 -
113 madvise((void*)aligned_new_limit, aligned_old_limit - aligned_new_limit, 4);
never executed: madvise((void*)aligned_new_limit, aligned_old_limit - aligned_new_limit, 4);
0
114 -
115 stack->limit = new_limit; -
116 return 0;
never executed: return 0;
0
117 -
118} -
119 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial