Skip to content

Commit ecf4f33

Browse files
committed
Convert usage of git_buf_free to new git_buf_dispose
1 parent 56ffdfc commit ecf4f33

File tree

231 files changed

+1057
-1056
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

231 files changed

+1057
-1056
lines changed

examples/diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,6 @@ static void diff_print_stats(git_diff *diff, struct opts *o)
332332

333333
fputs(b.ptr, stdout);
334334

335-
git_buf_free(&b);
335+
git_buf_dispose(&b);
336336
git_diff_stats_free(stats);
337337
}

examples/remote.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ int main(int argc, char *argv[])
6464

6565
check_lg2(git_repository_open(&repo, buf.ptr),
6666
"Could not open repository", NULL);
67-
git_buf_free(&buf);
67+
git_buf_dispose(&buf);
6868

6969
switch (opt.cmd)
7070
{

examples/tag.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ static void action_delete_tag(tag_state *state)
184184

185185
printf("Deleted tag '%s' (was %s)\n", opts->tag_name, abbrev_oid.ptr);
186186

187-
git_buf_free(&abbrev_oid);
187+
git_buf_dispose(&abbrev_oid);
188188
git_object_free(obj);
189189
}
190190

src/apply.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ static int apply_binary_delta(
255255

256256
if (!error && inflated.size != binary_file->inflatedlen) {
257257
error = apply_err("inflated delta does not match expected length");
258-
git_buf_free(out);
258+
git_buf_dispose(out);
259259
}
260260

261261
if (error < 0)
@@ -281,7 +281,7 @@ static int apply_binary_delta(
281281
}
282282

283283
done:
284-
git_buf_free(&inflated);
284+
git_buf_dispose(&inflated);
285285
return error;
286286
}
287287

@@ -320,9 +320,9 @@ static int apply_binary(
320320

321321
done:
322322
if (error < 0)
323-
git_buf_free(out);
323+
git_buf_dispose(out);
324324

325-
git_buf_free(&reverse);
325+
git_buf_dispose(&reverse);
326326
return error;
327327
}
328328

src/attr.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ static int system_attr_file(
298298

299299
/* We can safely provide a git_buf with no allocation (asize == 0) to
300300
* a consumer. This allows them to treat this as a regular `git_buf`,
301-
* but their call to `git_buf_free` will not attempt to free it.
301+
* but their call to `git_buf_dispose` will not attempt to free it.
302302
*/
303303
git_buf_attach_notowned(
304304
out, attr_session->sysdir.ptr, attr_session->sysdir.size);
@@ -359,7 +359,7 @@ static int attr_setup(git_repository *repo, git_attr_session *attr_session)
359359
attr_session->init_setup = 1;
360360

361361
out:
362-
git_buf_free(&path);
362+
git_buf_dispose(&path);
363363

364364
return error;
365365
}
@@ -565,8 +565,8 @@ static int collect_attr_files(
565565
cleanup:
566566
if (error < 0)
567567
release_attr_files(files);
568-
git_buf_free(&attrfile);
569-
git_buf_free(&dir);
568+
git_buf_dispose(&attrfile);
569+
git_buf_dispose(&dir);
570570

571571
return error;
572572
}

src/attr_file.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ int git_attr_file__load(
178178

179179
cleanup:
180180
git_blob_free(blob);
181-
git_buf_free(&content);
181+
git_buf_dispose(&content);
182182

183183
return error;
184184
}
@@ -348,7 +348,7 @@ int git_attr_file__load_standalone(git_attr_file **out, const char *path)
348348

349349
if (!(error = git_futils_readbuffer(&content, path))) {
350350
error = git_attr_file__parse_buffer(NULL, file, content.ptr);
351-
git_buf_free(&content);
351+
git_buf_dispose(&content);
352352
}
353353

354354
if (error < 0)
@@ -518,7 +518,7 @@ int git_attr_path__init(
518518

519519
void git_attr_path__free(git_attr_path *info)
520520
{
521-
git_buf_free(&info->full);
521+
git_buf_dispose(&info->full);
522522
info->path = NULL;
523523
info->basename = NULL;
524524
}
@@ -875,8 +875,8 @@ void git_attr_session__free(git_attr_session *session)
875875
if (!session)
876876
return;
877877

878-
git_buf_free(&session->sysdir);
879-
git_buf_free(&session->tmp);
878+
git_buf_dispose(&session->sysdir);
879+
git_buf_dispose(&session->tmp);
880880

881881
memset(session, 0, sizeof(git_attr_session));
882882
}

src/attrcache.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ static int attr_cache_lookup(
204204
*out_file = file;
205205
*out_entry = entry;
206206

207-
git_buf_free(&path);
207+
git_buf_dispose(&path);
208208
return error;
209209
}
210210

@@ -310,7 +310,7 @@ static int attr_cache__lookup_path(
310310
}
311311

312312
git_config_entry_free(entry);
313-
git_buf_free(&buf);
313+
git_buf_dispose(&buf);
314314

315315
return error;
316316
}

src/blob.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static int write_file_filtered(
126126
error = git_odb_write(id, odb, tgt.ptr, tgt.size, GIT_OBJ_BLOB);
127127
}
128128

129-
git_buf_free(&tgt);
129+
git_buf_dispose(&tgt);
130130
return error;
131131
}
132132

@@ -238,7 +238,7 @@ int git_blob__create_from_paths(
238238

239239
done:
240240
git_odb_free(odb);
241-
git_buf_free(&path);
241+
git_buf_dispose(&path);
242242

243243
return error;
244244
}
@@ -257,7 +257,7 @@ int git_blob_create_fromdisk(
257257
const char *workdir, *hintpath;
258258

259259
if ((error = git_path_prettify(&full_path, path, NULL)) < 0) {
260-
git_buf_free(&full_path);
260+
git_buf_dispose(&full_path);
261261
return error;
262262
}
263263

@@ -270,7 +270,7 @@ int git_blob_create_fromdisk(
270270
error = git_blob__create_from_paths(
271271
id, NULL, repo, git_buf_cstr(&full_path), hintpath, 0, true);
272272

273-
git_buf_free(&full_path);
273+
git_buf_dispose(&full_path);
274274
return error;
275275
}
276276

@@ -340,7 +340,7 @@ int git_blob_create_fromstream(git_writestream **out, git_repository *repo, cons
340340
if (error < 0)
341341
blob_writestream_free((git_writestream *) stream);
342342

343-
git_buf_free(&path);
343+
git_buf_dispose(&path);
344344
return error;
345345
}
346346

src/branch.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static int retrieve_branch_reference(
4040

4141
*branch_reference_out = branch; /* will be NULL on error */
4242

43-
git_buf_free(&ref_name);
43+
git_buf_dispose(&ref_name);
4444
return error;
4545
}
4646

@@ -108,8 +108,8 @@ static int create_branch(
108108
*ref_out = branch;
109109

110110
cleanup:
111-
git_buf_free(&canonical_branch_name);
112-
git_buf_free(&log_message);
111+
git_buf_dispose(&canonical_branch_name);
112+
git_buf_dispose(&log_message);
113113
return error;
114114
}
115115

@@ -199,7 +199,7 @@ int git_branch_delete(git_reference *branch)
199199
error = git_reference_delete(branch);
200200

201201
on_error:
202-
git_buf_free(&config_section);
202+
git_buf_dispose(&config_section);
203203
return error;
204204
}
205205

@@ -310,10 +310,10 @@ int git_branch_move(
310310
git_buf_cstr(&new_config_section));
311311

312312
done:
313-
git_buf_free(&new_reference_name);
314-
git_buf_free(&old_config_section);
315-
git_buf_free(&new_config_section);
316-
git_buf_free(&log_message);
313+
git_buf_dispose(&new_reference_name);
314+
git_buf_dispose(&old_config_section);
315+
git_buf_dispose(&new_config_section);
316+
git_buf_dispose(&log_message);
317317

318318
return error;
319319
}
@@ -366,7 +366,7 @@ static int retrieve_upstream_configuration(
366366
return -1;
367367

368368
error = git_config_get_string_buf(out, config, git_buf_cstr(&buf));
369-
git_buf_free(&buf);
369+
git_buf_dispose(&buf);
370370
return error;
371371
}
372372

@@ -429,9 +429,9 @@ int git_branch_upstream_name(
429429
cleanup:
430430
git_config_free(config);
431431
git_remote_free(remote);
432-
git_buf_free(&remote_name);
433-
git_buf_free(&merge_name);
434-
git_buf_free(&buf);
432+
git_buf_dispose(&remote_name);
433+
git_buf_dispose(&merge_name);
434+
git_buf_dispose(&buf);
435435
return error;
436436
}
437437

@@ -522,7 +522,7 @@ int git_branch_remote_name(git_buf *buf, git_repository *repo, const char *refna
522522

523523
cleanup:
524524
if (error < 0)
525-
git_buf_free(buf);
525+
git_buf_dispose(buf);
526526

527527
git_strarray_free(&remote_list);
528528
return error;
@@ -544,7 +544,7 @@ int git_branch_upstream(
544544
git_reference_owner(branch),
545545
git_buf_cstr(&tracking_name));
546546

547-
git_buf_free(&tracking_name);
547+
git_buf_dispose(&tracking_name);
548548
return error;
549549
}
550550

@@ -565,11 +565,11 @@ static int unset_upstream(git_config *config, const char *shortname)
565565
if (git_config_delete_entry(config, git_buf_cstr(&buf)) < 0)
566566
goto on_error;
567567

568-
git_buf_free(&buf);
568+
git_buf_dispose(&buf);
569569
return 0;
570570

571571
on_error:
572-
git_buf_free(&buf);
572+
git_buf_dispose(&buf);
573573
return -1;
574574
}
575575

@@ -655,15 +655,15 @@ int git_branch_set_upstream(git_reference *branch, const char *upstream_name)
655655
goto on_error;
656656

657657
git_reference_free(upstream);
658-
git_buf_free(&key);
659-
git_buf_free(&value);
658+
git_buf_dispose(&key);
659+
git_buf_dispose(&value);
660660

661661
return 0;
662662

663663
on_error:
664664
git_reference_free(upstream);
665-
git_buf_free(&key);
666-
git_buf_free(&value);
665+
git_buf_dispose(&key);
666+
git_buf_dispose(&value);
667667
git_remote_free(remote);
668668

669669
return -1;

src/buffer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ char *git_buf_detach(git_buf *buf)
615615

616616
int git_buf_attach(git_buf *buf, char *ptr, size_t asize)
617617
{
618-
git_buf_free(buf);
618+
git_buf_dispose(buf);
619619

620620
if (ptr) {
621621
buf->ptr = ptr;
@@ -633,7 +633,7 @@ int git_buf_attach(git_buf *buf, char *ptr, size_t asize)
633633
void git_buf_attach_notowned(git_buf *buf, const char *ptr, size_t size)
634634
{
635635
if (git_buf_is_allocated(buf))
636-
git_buf_free(buf);
636+
git_buf_dispose(buf);
637637

638638
if (!size) {
639639
git_buf_init(buf, 0);
@@ -954,7 +954,7 @@ int git_buf_quote(git_buf *buf)
954954
git_buf_swap(&quoted, buf);
955955

956956
done:
957-
git_buf_free(&quoted);
957+
git_buf_dispose(&quoted);
958958
return error;
959959
}
960960

0 commit comments

Comments
 (0)