Skip to content

Commit 3be7301

Browse files
authored
Merge pull request libgit2#4436 from pks-t/pks/packfile-stream-free
pack: rename `git_packfile_stream_free`
2 parents e6444da + ecf4f33 commit 3be7301

File tree

234 files changed

+1092
-1063
lines changed

Some content is hidden

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

234 files changed

+1092
-1063
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

include/git2/buffer.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,19 @@ typedef struct {
6969
*
7070
* @param buffer The buffer to deallocate
7171
*/
72-
GIT_EXTERN(void) git_buf_free(git_buf *buffer);
72+
GIT_EXTERN(void) git_buf_dispose(git_buf *buffer);
73+
74+
/**
75+
* Alias of `git_buf_dispose`.
76+
*
77+
* This function is directly calls `git_buf_dispose` now and is deprecated.
78+
* Going forward, we refer to functions freeing the internal state of a
79+
* structure a `dispose` function, while functions freeing the structure
80+
* themselves will be called a `free` function.
81+
*
82+
* This function is going to be removed in v0.30.0.
83+
*/
84+
GIT_EXTERN(void) GIT_DEPRECATED(git_buf_free)(git_buf *buffer);
7385

7486
/**
7587
* Resize the buffer allocation to make more space.

include/git2/common.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ typedef size_t size_t;
4848
# define GIT_EXTERN(type) extern type
4949
#endif
5050

51+
/** Declare a function as deprecated. */
52+
#if defined(__GNUC__)
53+
# define GIT_DEPRECATED(func) \
54+
__attribute__((deprecated)) \
55+
func
56+
#elif defined(_MSC_VER)
57+
# define GIT_DEPRECATED(func) __declspec(deprecated) func
58+
#else
59+
# define GIT_DEPRECATED(func) func
60+
#endif
61+
5162
/** Declare a function's takes printf style arguments. */
5263
#ifdef __GNUC__
5364
# define GIT_FORMAT_PRINTF(a,b) __attribute__((format (printf, a, b)))

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
}
@@ -876,8 +876,8 @@ void git_attr_session__free(git_attr_session *session)
876876
if (!session)
877877
return;
878878

879-
git_buf_free(&session->sysdir);
880-
git_buf_free(&session->tmp);
879+
git_buf_dispose(&session->sysdir);
880+
git_buf_dispose(&session->tmp);
881881

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

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

0 commit comments

Comments
 (0)