File tree Expand file tree Collapse file tree 1 file changed +9
-18
lines changed Expand file tree Collapse file tree 1 file changed +9
-18
lines changed Original file line number Diff line number Diff line change @@ -200,25 +200,17 @@ int repo_submodule_init(struct repository *submodule,
200
200
201
201
void repo_clear (struct repository * repo )
202
202
{
203
- free (repo -> gitdir );
204
- repo -> gitdir = NULL ;
205
- free (repo -> commondir );
206
- repo -> commondir = NULL ;
207
- free (repo -> objectdir );
208
- repo -> objectdir = NULL ;
209
- free (repo -> graft_file );
210
- repo -> graft_file = NULL ;
211
- free (repo -> index_file );
212
- repo -> index_file = NULL ;
213
- free (repo -> worktree );
214
- repo -> worktree = NULL ;
215
- free (repo -> submodule_prefix );
216
- repo -> submodule_prefix = NULL ;
203
+ FREE_AND_NULL (repo -> gitdir );
204
+ FREE_AND_NULL (repo -> commondir );
205
+ FREE_AND_NULL (repo -> objectdir );
206
+ FREE_AND_NULL (repo -> graft_file );
207
+ FREE_AND_NULL (repo -> index_file );
208
+ FREE_AND_NULL (repo -> worktree );
209
+ FREE_AND_NULL (repo -> submodule_prefix );
217
210
218
211
if (repo -> config ) {
219
212
git_configset_clear (repo -> config );
220
- free (repo -> config );
221
- repo -> config = NULL ;
213
+ FREE_AND_NULL (repo -> config );
222
214
}
223
215
224
216
if (repo -> submodule_cache ) {
@@ -228,8 +220,7 @@ void repo_clear(struct repository *repo)
228
220
229
221
if (repo -> index ) {
230
222
discard_index (repo -> index );
231
- free (repo -> index );
232
- repo -> index = NULL ;
223
+ FREE_AND_NULL (repo -> index );
233
224
}
234
225
}
235
226
You can’t perform that action at this time.
0 commit comments