Commit a6c9e0b367c4882ab0f8e78bd0ad4ab2904ac377

Patrick Steinhardt 2020-06-08T12:40:47

tree-wide: mark local functions as static We've accumulated quite some functions which are never used outside of their respective code unit, but which are lacking the `static` keyword. Add it to reduce their linkage scope and allow the compiler to optimize better.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
diff --git a/src/checkout.c b/src/checkout.c
index 1e6ea4d..44a8671 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -806,7 +806,7 @@ static int checkout_conflictdata_cmp(const void *a, const void *b)
 	return diff;
 }
 
-int checkout_conflictdata_empty(
+static int checkout_conflictdata_empty(
 	const git_vector *conflicts, size_t idx, void *payload)
 {
 	checkout_conflictdata *conflict;
diff --git a/src/config.c b/src/config.c
index 8338da0..81f010f 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1000,7 +1000,7 @@ static int multivar_iter_next(git_config_entry **entry, git_config_iterator *_it
 	return error;
 }
 
-void multivar_iter_free(git_config_iterator *_iter)
+static void multivar_iter_free(git_config_iterator *_iter)
 {
 	multivar_iter *iter = (multivar_iter *) _iter;
 
diff --git a/src/diff.c b/src/diff.c
index efbedb5..9fd3613 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -150,7 +150,7 @@ int git_diff_foreach(
 	return error;
 }
 
-int git_diff_format_email__append_header_tobuf(
+static int diff_format_email_append_header_tobuf(
 	git_buf *out,
 	const git_oid *id,
 	const git_signature *author,
@@ -207,7 +207,7 @@ int git_diff_format_email__append_header_tobuf(
 	return error;
 }
 
-int git_diff_format_email__append_patches_tobuf(
+static int diff_format_email_append_patches_tobuf(
 	git_buf *out,
 	git_diff *diff)
 {
@@ -287,7 +287,7 @@ int git_diff_format_email(
 		strncpy(summary, opts->summary, offset);
 	}
 
-	error = git_diff_format_email__append_header_tobuf(out,
+	error = diff_format_email_append_header_tobuf(out,
 		opts->id, opts->author, summary == NULL ? opts->summary : summary,
 		opts->body, opts->patch_no, opts->total_patches, ignore_marker);
 
@@ -300,7 +300,7 @@ int git_diff_format_email(
 		(error = git_diff_get_stats(&stats, diff)) < 0 ||
 		(error = git_diff_stats_to_buf(out, stats, format_flags, 0)) < 0 ||
 		(error = git_buf_putc(out, '\n')) < 0 ||
-		(error = git_diff_format_email__append_patches_tobuf(out, diff)) < 0)
+		(error = diff_format_email_append_patches_tobuf(out, diff)) < 0)
 			goto on_error;
 
 	error = git_buf_puts(out, "--\nlibgit2 " LIBGIT2_VERSION "\n\n");
@@ -421,7 +421,7 @@ static void strip_spaces(git_buf *buf)
 	git_buf_truncate(buf, len);
 }
 
-int git_diff_patchid_print_callback__to_buf(
+static int diff_patchid_print_callback_to_buf(
 	const git_diff_delta *delta,
 	const git_diff_hunk *hunk,
 	const git_diff_line *line,
@@ -480,7 +480,7 @@ int git_diff_patchid(git_oid *out, git_diff *diff, git_diff_patchid_options *opt
 
 	if ((error = git_diff_print(diff,
 				    GIT_DIFF_FORMAT_PATCH_ID,
-				    git_diff_patchid_print_callback__to_buf,
+				    diff_patchid_print_callback_to_buf,
 				    &args)) < 0)
 		goto out;
 
diff --git a/src/diff_generate.c b/src/diff_generate.c
index e9e5242..e7bfd62 100644
--- a/src/diff_generate.c
+++ b/src/diff_generate.c
@@ -301,14 +301,14 @@ GIT_INLINE(const char *) diff_delta__i2w_path(const git_diff_delta *delta)
 		delta->old_file.path : delta->new_file.path;
 }
 
-int git_diff_delta__i2w_cmp(const void *a, const void *b)
+static int diff_delta_i2w_cmp(const void *a, const void *b)
 {
 	const git_diff_delta *da = a, *db = b;
 	int val = strcmp(diff_delta__i2w_path(da), diff_delta__i2w_path(db));
 	return val ? val : ((int)da->status - (int)db->status);
 }
 
-int git_diff_delta__i2w_casecmp(const void *a, const void *b)
+static int diff_delta_i2w_casecmp(const void *a, const void *b)
 {
 	const git_diff_delta *da = a, *db = b;
 	int val = strcasecmp(diff_delta__i2w_path(da), diff_delta__i2w_path(db));
@@ -361,7 +361,7 @@ static const char *diff_mnemonic_prefix(
 	return pfx;
 }
 
-void git_diff__set_ignore_case(git_diff *diff, bool ignore_case)
+static void diff_set_ignore_case(git_diff *diff, bool ignore_case)
 {
 	if (!ignore_case) {
 		diff->opts.flags &= ~GIT_DIFF_IGNORE_CASE;
@@ -431,7 +431,7 @@ static git_diff_generated *diff_generated_alloc(
 
 	/* Use case-insensitive compare if either iterator has
 	 * the ignore_case bit set */
-	git_diff__set_ignore_case(
+	diff_set_ignore_case(
 		&diff->base,
 		git_iterator_ignore_case(old_iter) ||
 		git_iterator_ignore_case(new_iter));
@@ -1375,7 +1375,7 @@ int git_diff_tree_to_index(
 
 	/* if index is in case-insensitive order, re-sort deltas to match */
 	if (index_ignore_case)
-		git_diff__set_ignore_case(diff, true);
+		diff_set_ignore_case(diff, true);
 
 	*out = diff;
 	diff = NULL;
@@ -1526,7 +1526,7 @@ int git_diff_index_to_index(
 
 	/* if index is in case-insensitive order, re-sort deltas to match */
 	if (old_index->ignore_case || new_index->ignore_case)
-		git_diff__set_ignore_case(diff, true);
+		diff_set_ignore_case(diff, true);
 
 	*out = diff;
 	diff = NULL;
@@ -1583,10 +1583,10 @@ int git_diff__paired_foreach(
 	if (i2w_icase && !icase_mismatch) {
 		strcomp = git__strcasecmp;
 
-		git_vector_set_cmp(&idx2wd->deltas, git_diff_delta__i2w_casecmp);
+		git_vector_set_cmp(&idx2wd->deltas, diff_delta_i2w_casecmp);
 		git_vector_sort(&idx2wd->deltas);
 	} else if (idx2wd != NULL) {
-		git_vector_set_cmp(&idx2wd->deltas, git_diff_delta__i2w_cmp);
+		git_vector_set_cmp(&idx2wd->deltas, diff_delta_i2w_cmp);
 		git_vector_sort(&idx2wd->deltas);
 	}
 
diff --git a/src/diff_print.c b/src/diff_print.c
index a78953c..9ff6d9a 100644
--- a/src/diff_print.c
+++ b/src/diff_print.c
@@ -337,7 +337,7 @@ static int diff_delta_format_with_paths(
 	return git_buf_printf(out, template, oldpath, newpath);
 }
 
-int diff_delta_format_similarity_header(
+static int diff_delta_format_similarity_header(
 	git_buf *out,
 	const git_diff_delta *delta)
 {
diff --git a/src/diff_stats.c b/src/diff_stats.c
index 19c9da0..1028b01 100644
--- a/src/diff_stats.c
+++ b/src/diff_stats.c
@@ -46,7 +46,7 @@ static int digits_for_value(size_t val)
 	return count;
 }
 
-int git_diff_file_stats__full_to_buf(
+static int diff_file_stats_full_to_buf(
 	git_buf *out,
 	const git_diff_delta *delta,
 	const diff_file_stats *filestat,
@@ -134,7 +134,7 @@ on_error:
 	return (git_buf_oom(out) ? -1 : 0);
 }
 
-int git_diff_file_stats__number_to_buf(
+static int diff_file_stats_number_to_buf(
 	git_buf *out,
 	const git_diff_delta *delta,
 	const diff_file_stats *filestats)
@@ -151,7 +151,7 @@ int git_diff_file_stats__number_to_buf(
 	return error;
 }
 
-int git_diff_file_stats__summary_to_buf(
+static int diff_file_stats_summary_to_buf(
 	git_buf *out,
 	const git_diff_delta *delta)
 {
@@ -288,7 +288,7 @@ int git_diff_stats_to_buf(
 			if ((delta = git_diff_get_delta(stats->diff, i)) == NULL)
 				continue;
 
-			error = git_diff_file_stats__number_to_buf(
+			error = diff_file_stats_number_to_buf(
 				out, delta, &stats->filestats[i]);
 			if (error < 0)
 				return error;
@@ -309,7 +309,7 @@ int git_diff_stats_to_buf(
 			if ((delta = git_diff_get_delta(stats->diff, i)) == NULL)
 				continue;
 
-			error = git_diff_file_stats__full_to_buf(
+			error = diff_file_stats_full_to_buf(
 				out, delta, &stats->filestats[i], stats, width);
 			if (error < 0)
 				return error;
@@ -342,7 +342,7 @@ int git_diff_stats_to_buf(
 			if ((delta = git_diff_get_delta(stats->diff, i)) == NULL)
 				continue;
 
-			error = git_diff_file_stats__summary_to_buf(out, delta);
+			error = diff_file_stats_summary_to_buf(out, delta);
 			if (error < 0)
 				return error;
 		}
diff --git a/src/filter.c b/src/filter.c
index bb9d66a..09b57dc 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -941,7 +941,7 @@ out:
 	return error;
 }
 
-void stream_list_free(git_vector *streams)
+static void filter_streams_free(git_vector *streams)
 {
 	git_writestream *stream;
 	size_t i;
@@ -990,7 +990,7 @@ done:
 
 	if (fd >= 0)
 		p_close(fd);
-	stream_list_free(&filter_streams);
+	filter_streams_free(&filter_streams);
 	git_buf_dispose(&abspath);
 	return error;
 }
@@ -1018,7 +1018,7 @@ out:
 	if (initialized)
 		error |= stream_start->close(stream_start);
 
-	stream_list_free(&filter_streams);
+	filter_streams_free(&filter_streams);
 	return error;
 }
 
diff --git a/src/merge.c b/src/merge.c
index 6e3a6c6..652b7ea 100644
--- a/src/merge.c
+++ b/src/merge.c
@@ -80,7 +80,7 @@ static int cache_invalid_marker;
 
 /* Merge base computation */
 
-int merge_bases_many(git_commit_list **out, git_revwalk **walk_out, git_repository *repo, size_t length, const git_oid input_array[])
+static int merge_bases_many(git_commit_list **out, git_revwalk **walk_out, git_repository *repo, size_t length, const git_oid input_array[])
 {
 	git_revwalk *walk = NULL;
 	git_vector list;
@@ -2845,7 +2845,7 @@ on_error:
 	return error;
 }
 
-const char *merge_their_label(const char *branchname)
+static const char *merge_their_label(const char *branchname)
 {
 	const char *slash;
 
diff --git a/src/merge_file.c b/src/merge_file.c
index 23daa84..755340f 100644
--- a/src/merge_file.c
+++ b/src/merge_file.c
@@ -28,7 +28,7 @@
 
 #define GIT_MERGE_FILE_SIDE_EXISTS(X)	((X)->mode != 0)
 
-int git_merge_file__input_from_index(
+static int merge_file_input_from_index(
 	git_merge_file_input *input_out,
 	git_odb_object **odb_object_out,
 	git_odb *odb,
@@ -276,17 +276,15 @@ int git_merge_file_from_index(
 		goto done;
 
 	if (ancestor) {
-		if ((error = git_merge_file__input_from_index(
+		if ((error = merge_file_input_from_index(
 			&ancestor_input, &odb_object[0], odb, ancestor)) < 0)
 			goto done;
 
 		ancestor_ptr = &ancestor_input;
 	}
 
-	if ((error = git_merge_file__input_from_index(
-			&our_input, &odb_object[1], odb, ours)) < 0 ||
-		(error = git_merge_file__input_from_index(
-			&their_input, &odb_object[2], odb, theirs)) < 0)
+	if ((error = merge_file_input_from_index(&our_input, &odb_object[1], odb, ours)) < 0 ||
+	    (error = merge_file_input_from_index(&their_input, &odb_object[2], odb, theirs)) < 0)
 		goto done;
 
 	error = merge_file__from_inputs(out,
diff --git a/src/pack-objects.c b/src/pack-objects.c
index 1ac618a..cf10e6c 100644
--- a/src/pack-objects.c
+++ b/src/pack-objects.c
@@ -1642,7 +1642,7 @@ static int mark_edges_uninteresting(git_packbuilder *pb, git_commit_list *commit
 	return 0;
 }
 
-int insert_tree(git_packbuilder *pb, git_tree *tree)
+static int pack_objects_insert_tree(git_packbuilder *pb, git_tree *tree)
 {
 	size_t i;
 	int error;
@@ -1669,7 +1669,7 @@ int insert_tree(git_packbuilder *pb, git_tree *tree)
 			if ((error = git_tree_lookup(&subtree, pb->repo, entry_id)) < 0)
 				return error;
 
-			error = insert_tree(pb, subtree);
+			error = pack_objects_insert_tree(pb, subtree);
 			git_tree_free(subtree);
 
 			if (error < 0)
@@ -1695,7 +1695,7 @@ int insert_tree(git_packbuilder *pb, git_tree *tree)
 	return error;
 }
 
-int insert_commit(git_packbuilder *pb, struct walk_object *obj)
+static int pack_objects_insert_commit(git_packbuilder *pb, struct walk_object *obj)
 {
 	int error;
 	git_commit *commit = NULL;
@@ -1712,7 +1712,7 @@ int insert_commit(git_packbuilder *pb, struct walk_object *obj)
 	if ((error = git_tree_lookup(&tree, pb->repo, git_commit_tree_id(commit))) < 0)
 		goto cleanup;
 
-	if ((error = insert_tree(pb, tree)) < 0)
+	if ((error = pack_objects_insert_tree(pb, tree)) < 0)
 		goto cleanup;
 
 cleanup:
@@ -1747,7 +1747,7 @@ int git_packbuilder_insert_walk(git_packbuilder *pb, git_revwalk *walk)
 		if (obj->seen || obj->uninteresting)
 			continue;
 
-		if ((error = insert_commit(pb, obj)) < 0)
+		if ((error = pack_objects_insert_commit(pb, obj)) < 0)
 			return error;
 	}
 
diff --git a/src/patch_parse.c b/src/patch_parse.c
index 0e251cb..9185753 100644
--- a/src/patch_parse.c
+++ b/src/patch_parse.c
@@ -941,7 +941,7 @@ static int parse_patch_body(
 		return parse_patch_hunks(patch, ctx);
 }
 
-int check_header_names(
+static int check_header_names(
 	const char *one,
 	const char *two,
 	const char *old_or_new,
diff --git a/src/path.c b/src/path.c
index 625b95c..0d0b40f 100644
--- a/src/path.c
+++ b/src/path.c
@@ -322,7 +322,7 @@ int git_path_root(const char *path)
 	return -1;	/* Not a real error - signals that path is not rooted */
 }
 
-void git_path_trim_slashes(git_buf *path)
+static void path_trim_slashes(git_buf *path)
 {
 	int ceiling = git_path_root(path->ptr) + 1;
 	assert(ceiling >= 0);
@@ -1219,7 +1219,7 @@ int git_path_diriter_init(
 	if (git_buf_puts(&diriter->path_utf8, path) < 0)
 		return -1;
 
-	git_path_trim_slashes(&diriter->path_utf8);
+	path_trim_slashes(&diriter->path_utf8);
 
 	if (diriter->path_utf8.size == 0) {
 		git_error_set(GIT_ERROR_FILESYSTEM, "could not open directory '%s'", path);
@@ -1368,7 +1368,7 @@ int git_path_diriter_init(
 	if (git_buf_puts(&diriter->path, path) < 0)
 		return -1;
 
-	git_path_trim_slashes(&diriter->path);
+	path_trim_slashes(&diriter->path);
 
 	if (diriter->path.size == 0) {
 		git_error_set(GIT_ERROR_FILESYSTEM, "could not open directory '%s'", path);
diff --git a/src/pool.c b/src/pool.c
index baae918..cb98f1a 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -21,7 +21,7 @@ struct git_pool_page {
 
 static void *pool_alloc_page(git_pool *pool, size_t size);
 
-size_t git_pool__system_page_size(void)
+static size_t pool_system_page_size(void)
 {
 	static size_t size = 0;
 
@@ -44,7 +44,7 @@ int git_pool_init(git_pool *pool, size_t item_size)
 
 	memset(pool, 0, sizeof(git_pool));
 	pool->item_size = item_size;
-	pool->page_size = git_pool__system_page_size();
+	pool->page_size = pool_system_page_size();
 
 	return 0;
 }
diff --git a/src/refs.c b/src/refs.c
index 633d83a..c5d69c1 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -480,7 +480,7 @@ static int reference__create(
 	return 0;
 }
 
-int configured_ident(git_signature **out, const git_repository *repo)
+static int refs_configured_ident(git_signature **out, const git_repository *repo)
 {
 	if (repo->ident_name && repo->ident_email)
 		return git_signature_now(out, repo->ident_name, repo->ident_email);
@@ -494,7 +494,7 @@ int git_reference__log_signature(git_signature **out, git_repository *repo)
 	int error;
 	git_signature *who;
 
-	if(((error = configured_ident(&who, repo)) < 0) &&
+	if(((error = refs_configured_ident(&who, repo)) < 0) &&
 	   ((error = git_signature_default(&who, repo)) < 0) &&
 	   ((error = git_signature_now(&who, "unknown", "unknown")) < 0))
 		return error;
diff --git a/src/remote.c b/src/remote.c
index b0ccf03..78e056a 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -686,7 +686,7 @@ int git_remote__urlfordirection(git_buf *url_out, struct git_remote *remote, int
 	return resolve_url(url_out, url, direction, callbacks);
 }
 
-int set_transport_callbacks(git_transport *t, const git_remote_callbacks *cbs)
+static int remote_transport_set_callbacks(git_transport *t, const git_remote_callbacks *cbs)
 {
 	if (!t->set_callbacks || !cbs)
 		return 0;
@@ -744,7 +744,7 @@ int git_remote__connect(git_remote *remote, git_direction direction, const git_r
 	if ((error = set_transport_custom_headers(t, conn->custom_headers)) != 0)
 		goto on_error;
 
-	if ((error = set_transport_callbacks(t, callbacks)) < 0 ||
+	if ((error = remote_transport_set_callbacks(t, callbacks)) < 0 ||
 	    (error = t->connect(t, url.ptr, credentials, payload, conn->proxy, direction, flags)) != 0)
 		goto on_error;
 
diff --git a/src/revparse.c b/src/revparse.c
index c627de6..9e0790f 100644
--- a/src/revparse.c
+++ b/src/revparse.c
@@ -659,7 +659,7 @@ static int ensure_left_hand_identifier_is_not_known_yet(git_object *object, git_
 	return GIT_EINVALIDSPEC;
 }
 
-int revparse__ext(
+static int revparse(
 	git_object **object_out,
 	git_reference **reference_out,
 	size_t *identifier_len_out,
@@ -835,7 +835,7 @@ int git_revparse_ext(
 	git_object *obj = NULL;
 	git_reference *ref = NULL;
 
-	if ((error = revparse__ext(&obj, &ref, &identifier_len, repo, spec)) < 0)
+	if ((error = revparse(&obj, &ref, &identifier_len, repo, spec)) < 0)
 		goto cleanup;
 
 	*object_out = obj;
diff --git a/src/submodule.c b/src/submodule.c
index 1690e08..7ae78c1 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -958,7 +958,7 @@ cleanup:
 	return error;
 }
 
-const char *git_submodule_update_to_str(git_submodule_update_t update)
+static const char *submodule_update_to_str(git_submodule_update_t update)
 {
 	int i;
 	for (i = 0; i < (int)ARRAY_SIZE(_sm_update_map); ++i)
@@ -1401,7 +1401,7 @@ int git_submodule_init(git_submodule *sm, int overwrite)
 	/* write "submodule.NAME.update" if not default */
 
 	val = (sm->update == GIT_SUBMODULE_UPDATE_CHECKOUT) ?
-		NULL : git_submodule_update_to_str(sm->update);
+		NULL : submodule_update_to_str(sm->update);
 
 	if ((error = git_buf_printf(&key, "submodule.%s.update", sm->name)) < 0 ||
 		(error = git_config__update_entry(
@@ -1838,7 +1838,7 @@ int git_submodule_parse_update(git_submodule_update_t *out, const char *value)
 	return 0;
 }
 
-int git_submodule_parse_recurse(git_submodule_recurse_t *out, const char *value)
+static int submodule_parse_recurse(git_submodule_recurse_t *out, const char *value)
 {
 	int val;
 
@@ -1934,7 +1934,7 @@ static int submodule_read_config(git_submodule *sm, git_config *cfg)
 
 	if ((error = get_value(&value, cfg, &key, sm->name, "fetchRecurseSubmodules")) == 0) {
 		in_config = 1;
-		if ((error = git_submodule_parse_recurse(&sm->fetch_recurse, value)) < 0)
+		if ((error = submodule_parse_recurse(&sm->fetch_recurse, value)) < 0)
 			goto cleanup;
 		sm->fetch_recurse_default = sm->fetch_recurse;
 	} else if (error != GIT_ENOTFOUND) {
diff --git a/src/transports/httpclient.c b/src/transports/httpclient.c
index 010baa6..dda2678 100644
--- a/src/transports/httpclient.c
+++ b/src/transports/httpclient.c
@@ -445,7 +445,7 @@ GIT_INLINE(int) client_write_request(git_http_client *client)
 				      0);
 }
 
-const char *name_for_method(git_http_method method)
+static const char *name_for_method(git_http_method method)
 {
 	switch (method) {
 	case GIT_HTTP_METHOD_GET:
diff --git a/src/util.c b/src/util.c
index c4e322d..2efb212 100644
--- a/src/util.c
+++ b/src/util.c
@@ -777,7 +777,7 @@ static const int8_t utf8proc_utf8class[256] = {
 	4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0
 };
 
-int git__utf8_charlen(const uint8_t *str, size_t str_len)
+static int util_utf8_charlen(const uint8_t *str, size_t str_len)
 {
 	size_t length, i;
 
@@ -802,7 +802,7 @@ int git__utf8_iterate(const uint8_t *str, int str_len, int32_t *dst)
 	int32_t uc = -1;
 
 	*dst = -1;
-	length = git__utf8_charlen(str, str_len);
+	length = util_utf8_charlen(str, str_len);
 	if (length < 0)
 		return -1;
 
@@ -839,7 +839,7 @@ size_t git__utf8_valid_buf_length(const uint8_t *str, size_t str_len)
 	size_t offset = 0;
 
 	while (offset < str_len) {
-		int length = git__utf8_charlen(str + offset, str_len - offset);
+		int length = util_utf8_charlen(str + offset, str_len - offset);
 
 		if (length < 0)
 			break;
diff --git a/src/win32/path_w32.c b/src/win32/path_w32.c
index 18b43e7..9faddcf 100644
--- a/src/win32/path_w32.c
+++ b/src/win32/path_w32.c
@@ -151,7 +151,7 @@ int git_win32_path_canonicalize(git_win32_path path)
 	return (int)(to - path);
 }
 
-int git_win32_path__cwd(wchar_t *out, size_t len)
+static int win32_path_cwd(wchar_t *out, size_t len)
 {
 	int cwd_len;
 
@@ -241,7 +241,7 @@ int git_win32_path_from_utf8(git_win32_path out, const char *src)
 	else {
 		int cwd_len;
 
-		if ((cwd_len = git_win32_path__cwd(dest, MAX_PATH)) < 0)
+		if ((cwd_len = win32_path_cwd(dest, MAX_PATH)) < 0)
 			goto on_error;
 
 		dest[cwd_len++] = L'\\';