Commit 573e4fd
committed
S_invlist_trim - don't SvPV_renew where no change is likely
Currently, `S_invlist_trim` always calls `SvPV_renew(invlist, <size>)`,
which is a macro wrapping a call to `safesysrealloc()`.
However, `SvLEN(invlist)` is often already exactly the desired size, or
it is larger by less than the size of a pointer. With this commit, the
new `expected_size` macro is used to reduce the number of cases in which
S_invlist_trim will try to shrink a buffer but no shrinkage is likely to
occur. (For example, if the desired size is less than the minimum actual
allocation size.)1 parent 4a38ddc commit 573e4fd
1 file changed
+21
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | | - | |
250 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
251 | 254 | | |
252 | 255 | | |
253 | 256 | | |
254 | 257 | | |
255 | 258 | | |
256 | | - | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
257 | 275 | | |
258 | 276 | | |
259 | 277 | | |
| |||
0 commit comments