Commit 0a2dd1a
committed
Remove unnecessary heap allocated copies when doing transformations.
- Updated transformations to work inplace on the std::string buffer of
the value where the transformation is being applied, instead of
copying to a temporary string.
- Make inplace transformations methods inline and moved them out of the
class interface as almost all of them are not used outside of them.
- Removed std::string Action::evaluate(const std::string &exp,
Transaction *transaction); which was only implemented by
Transformation but was not used from the base class, but only after
downcasting to Transformation, so it can just be declared there (and
not pollute other actions with a default member implementation -that
does nothing- which is never called).
- Renamed Transformation::evaluate to Transformation::transform to avoid
confusion with Action's overload methods.
- Updated Transformation::transform signature to receive the value by
reference and perform the transformation inline, if possible.
- Some transformations still need to use a temporary std::string to
perform their work, and then copy the result back.
- Made Transformation::transform methods const and updated Transaction
parameter to be const.
- Transaction parameter could not be removed because it's used by just
a single transformation, UrlDecodeUni.
- Simplified & shared implementation of several transformations,
removing duplicate code.1 parent 752ab76 commit 0a2dd1a
File tree
95 files changed
+994
-2444
lines changed- headers/modsecurity
- actions
- src
- actions
- transformations
- engine
- operators
- utils
- test
- unit
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
95 files changed
+994
-2444
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
78 | | - | |
79 | 77 | | |
80 | 78 | | |
81 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 122 | + | |
132 | 123 | | |
133 | 124 | | |
134 | 125 | | |
| |||
166 | 157 | | |
167 | 158 | | |
168 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
169 | 168 | | |
170 | 169 | | |
171 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
251 | | - | |
252 | 251 | | |
253 | 252 | | |
254 | 253 | | |
255 | | - | |
256 | 254 | | |
257 | 255 | | |
258 | 256 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | 48 | | |
55 | 49 | | |
56 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | 18 | | |
28 | 19 | | |
29 | 20 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| 21 | + | |
34 | 22 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | 23 | | |
39 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
40 | 28 | | |
41 | 29 | | |
42 | 30 | | |
43 | | - | |
44 | | - | |
45 | | - | |
| 31 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | 16 | | |
22 | 17 | | |
23 | 18 | | |
24 | | - | |
25 | | - | |
26 | | - | |
| 19 | + | |
27 | 20 | | |
28 | | - | |
29 | | - | |
| 21 | + | |
30 | 22 | | |
31 | 23 | | |
32 | 24 | | |
33 | | - | |
| 25 | + | |
| 26 | + | |
34 | 27 | | |
35 | | - | |
36 | | - | |
| 28 | + | |
37 | 29 | | |
38 | 30 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 31 | + | |
44 | 32 | | |
45 | 33 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | 18 | | |
28 | 19 | | |
29 | 20 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| 21 | + | |
34 | 22 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | 23 | | |
39 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
40 | 28 | | |
41 | 29 | | |
42 | 30 | | |
43 | | - | |
44 | | - | |
45 | | - | |
| 31 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | 16 | | |
22 | 17 | | |
23 | 18 | | |
24 | | - | |
25 | | - | |
26 | | - | |
| 19 | + | |
27 | 20 | | |
28 | | - | |
29 | | - | |
| 21 | + | |
30 | 22 | | |
31 | 23 | | |
32 | 24 | | |
33 | | - | |
| 25 | + | |
| 26 | + | |
34 | 27 | | |
35 | | - | |
36 | | - | |
| 28 | + | |
37 | 29 | | |
38 | 30 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 31 | + | |
44 | 32 | | |
45 | 33 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | 18 | | |
28 | 19 | | |
29 | 20 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| 21 | + | |
34 | 22 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | 23 | | |
39 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
40 | 28 | | |
41 | 29 | | |
42 | 30 | | |
43 | | - | |
44 | | - | |
45 | | - | |
| 31 | + | |
0 commit comments