Skip to content

Commit 65e9dc6

Browse files
author
Vicent Marti
committed
Merge pull request #1996 from ethomson/warnings
Clean up warnings
2 parents 07c5dc8 + 5588f07 commit 65e9dc6

File tree

10 files changed

+32
-41
lines changed

10 files changed

+32
-41
lines changed

deps/regex/regex.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,17 @@
6767
#include "regex_internal.h"
6868

6969
#include "regex_internal.c"
70+
7071
#ifdef GAWK
71-
#define bool int
72-
#define true (1)
73-
#define false (0)
72+
# define bool int
73+
74+
# ifndef true
75+
# define true (1)
76+
# endif
77+
78+
# ifndef false
79+
# define false (0)
80+
# endif
7481
#endif
7582
#include "regcomp.c"
7683
#include "regexec.c"

src/buffer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
#ifndef INCLUDE_buffer_h__
88
#define INCLUDE_buffer_h__
99

10+
#include <stdarg.h>
11+
1012
#include "common.h"
1113
#include "git2/strarray.h"
1214
#include "git2/buffer.h"
13-
#include <stdarg.h>
1415

1516
/* typedef struct {
1617
* char *ptr;

src/common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
# endif
4343
#define GIT_STDLIB_CALL
4444

45+
# include <arpa/inet.h>
46+
4547
#endif
4648

4749
#include "git2/types.h"

src/merge.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2306,8 +2306,8 @@ static int merge_check_workdir(size_t *conflicts, git_repository *repo, git_inde
23062306

23072307
int git_merge__indexes(git_repository *repo, git_index *index_new)
23082308
{
2309-
git_index *index_repo;
2310-
unsigned int index_repo_caps;
2309+
git_index *index_repo = NULL;
2310+
unsigned int index_repo_caps = 0;
23112311
git_vector paths = GIT_VECTOR_INIT;
23122312
size_t index_conflicts = 0, wd_conflicts = 0, conflicts, i;
23132313
char *path;

src/revert.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,12 @@
2020

2121
static int write_revert_head(
2222
git_repository *repo,
23-
const git_commit *commit,
2423
const char *commit_oidstr)
2524
{
2625
git_filebuf file = GIT_FILEBUF_INIT;
2726
git_buf file_path = GIT_BUF_INIT;
2827
int error = 0;
2928

30-
assert(repo && commit);
31-
3229
if ((error = git_buf_joinpath(&file_path, repo->path_repository, GIT_REVERT_HEAD_FILE)) >= 0 &&
3330
(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_REVERT_FILE_MODE)) >= 0 &&
3431
(error = git_filebuf_printf(&file, "%s\n", commit_oidstr)) >= 0)
@@ -44,16 +41,13 @@ static int write_revert_head(
4441

4542
static int write_merge_msg(
4643
git_repository *repo,
47-
const git_commit *commit,
4844
const char *commit_oidstr,
4945
const char *commit_msgline)
5046
{
5147
git_filebuf file = GIT_FILEBUF_INIT;
5248
git_buf file_path = GIT_BUF_INIT;
5349
int error = 0;
5450

55-
assert(repo && commit);
56-
5751
if ((error = git_buf_joinpath(&file_path, repo->path_repository, GIT_MERGE_MSG_FILE)) < 0 ||
5852
(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_REVERT_FILE_MODE)) < 0 ||
5953
(error = git_filebuf_printf(&file, "Revert \"%s\"\n\nThis reverts commit %s.\n",
@@ -198,8 +192,8 @@ int git_revert(
198192

199193
if ((error = git_buf_printf(&their_label, "parent of %.7s... %s", commit_oidstr, commit_msg)) < 0 ||
200194
(error = revert_normalize_opts(repo, &opts, given_opts, git_buf_cstr(&their_label))) < 0 ||
201-
(error = write_revert_head(repo, commit, commit_oidstr)) < 0 ||
202-
(error = write_merge_msg(repo, commit, commit_oidstr, commit_msg)) < 0 ||
195+
(error = write_revert_head(repo, commit_oidstr)) < 0 ||
196+
(error = write_merge_msg(repo, commit_oidstr, commit_msg)) < 0 ||
203197
(error = git_repository_head(&our_ref, repo)) < 0 ||
204198
(error = git_reference_peel((git_object **)&our_commit, our_ref, GIT_OBJ_COMMIT)) < 0 ||
205199
(error = git_revert_commit(&index_new, repo, commit, our_commit, opts.mainline, &opts.merge_tree_opts)) < 0 ||

src/win32/precompiled.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#include "git2.h"
2-
#include "common.h"
3-
41
#include <assert.h>
52
#include <errno.h>
63
#include <limits.h>
@@ -9,6 +6,7 @@
96
#include <string.h>
107
#include <fcntl.h>
118
#include <time.h>
9+
#include <stdarg.h>
1210

1311
#include <sys/types.h>
1412
#include <sys/stat.h>
@@ -20,3 +18,6 @@
2018
#ifdef GIT_THREADS
2119
#include "win32/pthread.h"
2220
#endif
21+
22+
#include "git2.h"
23+
#include "common.h"

tests/blame/harder.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ void test_blame_harder__m(void)
3636
/* TODO */
3737
git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
3838

39+
GIT_UNUSED(opts);
40+
3941
opts.flags = GIT_BLAME_TRACK_COPIES_SAME_FILE;
4042
}
4143

@@ -44,6 +46,8 @@ void test_blame_harder__c(void)
4446
{
4547
git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
4648

49+
GIT_UNUSED(opts);
50+
4751
/* Attribute the first hunk in b.txt to (E), since it was cut/pasted from
4852
* a.txt in (D).
4953
*/
@@ -54,6 +58,8 @@ void test_blame_harder__cc(void)
5458
{
5559
git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
5660

61+
GIT_UNUSED(opts);
62+
5763
/* Attribute the second hunk in b.txt to (E), since it was copy/pasted from
5864
* a.txt in (C).
5965
*/
@@ -63,6 +69,8 @@ void test_blame_harder__cc(void)
6369
void test_blame_harder__ccc(void)
6470
{
6571
git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
72+
73+
GIT_UNUSED(opts);
6674

6775
/* Attribute the third hunk in b.txt to (E). This hunk was deleted from
6876
* a.txt in (D), but reintroduced in (B).

tests/merge/merge_helpers.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ int merge_commits_from_branches(
6060
git_commit *our_commit, *their_commit;
6161
git_oid our_oid, their_oid;
6262
git_buf branch_buf = GIT_BUF_INIT;
63-
int error;
6463

6564
git_buf_printf(&branch_buf, "%s%s", GIT_REFS_HEADS_DIR, ours_name);
6665
cl_git_pass(git_reference_name_to_id(&our_oid, repo, branch_buf.ptr));

tests/merge/trees/commits.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,6 @@ void test_merge_trees_commits__cleanup(void)
2929
cl_git_sandbox_cleanup();
3030
}
3131

32-
static void merge_commits(
33-
git_index **out,
34-
git_repository *repo,
35-
const char *our_oidstr,
36-
const char *their_oidstr,
37-
const git_merge_tree_opts *opts)
38-
{
39-
git_oid our_oid, their_oid;
40-
git_commit *our_commit, *their_commit;
41-
42-
cl_git_pass(git_oid_fromstr(&our_oid, our_oidstr));
43-
cl_git_pass(git_oid_fromstr(&their_oid, their_oidstr));
44-
45-
cl_git_pass(git_commit_lookup(&our_commit, repo, &our_oid));
46-
cl_git_pass(git_commit_lookup(&their_commit, repo, &their_oid));
47-
48-
cl_git_pass(git_merge_commits(out, repo, our_commit, their_commit, opts));
49-
50-
git_commit_free(our_commit);
51-
git_commit_free(their_commit);
52-
}
53-
5432
void test_merge_trees_commits__automerge(void)
5533
{
5634
git_index *index;

tests/refs/branches/create.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,5 @@ void test_refs_branches_create__creating_a_branch_with_an_invalid_name_returns_E
7373

7474
cl_assert_equal_i(GIT_EINVALIDSPEC,
7575
git_branch_create(&branch, repo, "inv@{id", target, 0));
76-
}
76+
}
77+

0 commit comments

Comments
 (0)