Skip to content

Commit 68e7379

Browse files
authored
Merge pull request libgit2#4709 from pks-t/pks/refspec-dispose
refspec: rename `git_refspec__free` to `git_refspec__dispose`
2 parents 01574d4 + af3088e commit 68e7379

File tree

8 files changed

+21
-21
lines changed

8 files changed

+21
-21
lines changed

src/fetch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static int filter_wants(git_remote *remote, const git_fetch_options *opts)
7878
goto cleanup;
7979

8080
error = git_refspec__dwim_one(&remote->active_refspecs, &head, &remote->refs);
81-
git_refspec__free(&head);
81+
git_refspec__dispose(&head);
8282

8383
if (error < 0)
8484
goto cleanup;
@@ -96,7 +96,7 @@ static int filter_wants(git_remote *remote, const git_fetch_options *opts)
9696
}
9797

9898
cleanup:
99-
git_refspec__free(&tagspec);
99+
git_refspec__dispose(&tagspec);
100100

101101
return error;
102102
}

src/push.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static void free_refspec(push_spec *spec)
8383
if (spec == NULL)
8484
return;
8585

86-
git_refspec__free(&spec->refspec);
86+
git_refspec__dispose(&spec->refspec);
8787
git__free(spec);
8888
}
8989

src/refspec.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,11 @@ int git_refspec__parse(git_refspec *refspec, const char *input, bool is_fetch)
144144
giterr_set(
145145
GITERR_INVALID,
146146
"'%s' is not a valid refspec.", input);
147-
git_refspec__free(refspec);
147+
git_refspec__dispose(refspec);
148148
return -1;
149149
}
150150

151-
void git_refspec__free(git_refspec *refspec)
151+
void git_refspec__dispose(git_refspec *refspec)
152152
{
153153
if (refspec == NULL)
154154
return;
@@ -181,7 +181,7 @@ int git_refspec_parse(git_refspec **out_refspec, const char *input, int is_fetch
181181

182182
void git_refspec_free(git_refspec *refspec)
183183
{
184-
git_refspec__free(refspec);
184+
git_refspec__dispose(refspec);
185185
git__free(refspec);
186186
}
187187

src/refspec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ int git_refspec__parse(
3030
const char *str,
3131
bool is_fetch);
3232
33-
void git_refspec__free(git_refspec *refspec);
33+
void git_refspec__dispose(git_refspec *refspec);
3434
3535
int git_refspec__serialize(git_buf *out, const git_refspec *refspec);
3636

src/remote.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static int add_refspec_to(git_vector *vector, const char *string, bool is_fetch)
4444

4545
spec->push = !is_fetch;
4646
if (git_vector_insert(vector, spec) < 0) {
47-
git_refspec__free(spec);
47+
git_refspec__dispose(spec);
4848
git__free(spec);
4949
return -1;
5050
}
@@ -117,7 +117,7 @@ static int write_add_refspec(git_repository *repo, const char *name, const char
117117
return error;
118118
}
119119

120-
git_refspec__free(&spec);
120+
git_refspec__dispose(&spec);
121121

122122
if ((error = git_buf_printf(&var, fmt, name)) < 0)
123123
return error;
@@ -826,7 +826,7 @@ static void free_refspecs(git_vector *vec)
826826
git_refspec *spec;
827827

828828
git_vector_foreach(vec, i, spec) {
829-
git_refspec__free(spec);
829+
git_refspec__dispose(spec);
830830
git__free(spec);
831831
}
832832

@@ -1416,13 +1416,13 @@ static int update_tips_for_spec(
14161416
goto on_error;
14171417

14181418
git_vector_free(&update_heads);
1419-
git_refspec__free(&tagspec);
1419+
git_refspec__dispose(&tagspec);
14201420
git_buf_dispose(&refname);
14211421
return 0;
14221422

14231423
on_error:
14241424
git_vector_free(&update_heads);
1425-
git_refspec__free(&tagspec);
1425+
git_refspec__dispose(&tagspec);
14261426
git_buf_dispose(&refname);
14271427
return -1;
14281428

@@ -1607,7 +1607,7 @@ int git_remote_update_tips(
16071607

16081608
out:
16091609
git_vector_free(&refs);
1610-
git_refspec__free(&tagspec);
1610+
git_refspec__dispose(&tagspec);
16111611
return error;
16121612
}
16131613

@@ -2045,7 +2045,7 @@ int git_remote_is_valid_name(
20452045
error = git_refspec__parse(&refspec, git_buf_cstr(&buf), true);
20462046

20472047
git_buf_dispose(&buf);
2048-
git_refspec__free(&refspec);
2048+
git_refspec__dispose(&refspec);
20492049

20502050
giterr_clear();
20512051
return error == 0;

src/transports/smart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static void free_symrefs(git_vector *symrefs)
192192
size_t i;
193193

194194
git_vector_foreach(symrefs, i, spec) {
195-
git_refspec__free(spec);
195+
git_refspec__dispose(spec);
196196
git__free(spec);
197197
}
198198

src/transports/smart_protocol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ static int append_symref(const char **out, git_vector *symrefs, const char *ptr)
131131

132132
on_invalid:
133133
giterr_set(GITERR_NET, "remote sent invalid symref");
134-
git_refspec__free(mapping);
134+
git_refspec__dispose(mapping);
135135
git__free(mapping);
136136
return -1;
137137
}

tests/network/refspecs.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ static void assert_refspec(unsigned int direction, const char *input, bool is_ex
88
int error;
99

1010
error = git_refspec__parse(&refspec, input, direction == GIT_DIRECTION_FETCH);
11-
git_refspec__free(&refspec);
11+
git_refspec__dispose(&refspec);
1212

1313
if (is_expected_to_be_valid)
1414
cl_assert_equal_i(0, error);
@@ -98,7 +98,7 @@ static void assert_valid_transform(const char *refspec, const char *name, const
9898
cl_assert_equal_s(result, buf.ptr);
9999

100100
git_buf_dispose(&buf);
101-
git_refspec__free(&spec);
101+
git_refspec__dispose(&spec);
102102
}
103103

104104
void test_network_refspecs__transform_mid_star(void)
@@ -120,7 +120,7 @@ static void assert_invalid_transform(const char *refspec, const char *name)
120120
cl_git_fail(git_refspec_transform(&buf, &spec, name));
121121

122122
git_buf_dispose(&buf);
123-
git_refspec__free(&spec);
123+
git_refspec__dispose(&spec);
124124
}
125125

126126
void test_network_refspecs__invalid(void)
@@ -138,7 +138,7 @@ static void assert_invalid_rtransform(const char *refspec, const char *name)
138138
cl_git_fail(git_refspec_rtransform(&buf, &spec, name));
139139

140140
git_buf_dispose(&buf);
141-
git_refspec__free(&spec);
141+
git_refspec__dispose(&spec);
142142
}
143143

144144
void test_network_refspecs__invalid_reverse(void)
@@ -156,7 +156,7 @@ void test_network_refspecs__matching(void)
156156
cl_assert_equal_s("", spec.src);
157157
cl_assert_equal_s("", spec.dst);
158158

159-
git_refspec__free(&spec);
159+
git_refspec__dispose(&spec);
160160
}
161161

162162
void test_network_refspecs__parse_free(void)

0 commit comments

Comments
 (0)