Commit dd090a8
name-rev: pull out deref handling from the recursion
The 'if (deref) { ... }' condition near the beginning of the recursive
name_rev() function can only ever be true in the first invocation,
because the 'deref' parameter is always 0 in the subsequent recursive
invocations.
Extract this condition from the recursion into name_rev()'s caller and
drop the function's 'deref' parameter. This makes eliminating the
recursion a bit easier to follow, and it will be moved back into
name_rev() after the recursion is eliminated.
Furthermore, drop the condition that die()s when both 'deref' and
'generation' are non-null (which should have been a BUG() to begin
with).
Note that this change reintroduces the memory leak that was plugged in
in commit 5308224 (name-rev: avoid leaking memory in the `deref`
case, 2017-05-04), but a later patch (name-rev: restructure
creating/updating 'struct rev_name' instances) in this series will
plug it in again.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent 766f9e3 commit dd090a8
1 file changed
+10
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
110 | | - | |
| 109 | + | |
111 | 110 | | |
112 | 111 | | |
113 | 112 | | |
114 | | - | |
115 | 113 | | |
116 | 114 | | |
117 | 115 | | |
118 | 116 | | |
119 | 117 | | |
120 | 118 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | 119 | | |
129 | | - | |
130 | | - | |
| 120 | + | |
131 | 121 | | |
132 | | - | |
133 | 122 | | |
134 | 123 | | |
135 | 124 | | |
| |||
148 | 137 | | |
149 | 138 | | |
150 | 139 | | |
151 | | - | |
| 140 | + | |
152 | 141 | | |
153 | 142 | | |
154 | 143 | | |
155 | | - | |
| 144 | + | |
156 | 145 | | |
157 | 146 | | |
158 | 147 | | |
| |||
284 | 273 | | |
285 | 274 | | |
286 | 275 | | |
| 276 | + | |
287 | 277 | | |
288 | 278 | | |
289 | 279 | | |
290 | 280 | | |
291 | | - | |
292 | | - | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
293 | 286 | | |
294 | 287 | | |
295 | 288 | | |
| |||
0 commit comments