summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRamsay Jones <ramsay@ramsay1.demon.co.uk>2010-01-11 22:51:42 +0000
committerRamsay Jones <ramsay@ramsay1.demon.co.uk>2010-01-20 20:19:55 +0000
commit1a7bae4d0f9d9314b905109b5b321219b7e6be3b (patch)
tree81723c22eae0570f3774ac588b572636f34a7467
parente3fe32b6a4ecb340fa7c9802285711cc52b8a101 (diff)
downloadlibgit2-1a7bae4d0f9d9314b905109b5b321219b7e6be3b.tar.gz
Fix some "unused parameter" warnings with -Wextra
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
-rw-r--r--src/cc-compat.h10
-rw-r--r--src/fileops.h4
-rw-r--r--src/odb.c8
-rw-r--r--tests/t0020-dirent.c2
4 files changed, 21 insertions, 3 deletions
diff --git a/src/cc-compat.h b/src/cc-compat.h
index 488de7f11..aefe66d19 100644
--- a/src/cc-compat.h
+++ b/src/cc-compat.h
@@ -30,6 +30,16 @@
# define GIT_TYPEOF(x)
#endif
+#ifdef __cplusplus
+# define GIT_UNUSED(x)
+#else
+# ifdef __GNUC__
+# define GIT_UNUSED(x) x __attribute__ ((__unused__))
+# else
+# define GIT_UNUSED(x) x
+# endif
+#endif
+
/*
* Does our compiler/platform support the C99 <inttypes.h> and
* <stdint.h> header files. (C99 requires that <inttypes.h>
diff --git a/src/fileops.h b/src/fileops.h
index b5cc24e62..c5c58a0da 100644
--- a/src/fileops.h
+++ b/src/fileops.h
@@ -13,13 +13,13 @@
#include <time.h>
#ifdef GIT_WIN32
-GIT_INLINE(int) link(const char *old, const char *new)
+GIT_INLINE(int) link(const char *GIT_UNUSED(old), const char *GIT_UNUSED(new))
{
errno = ENOSYS;
return -1;
}
-GIT_INLINE(int) git__mkdir(const char *path, int mode)
+GIT_INLINE(int) git__mkdir(const char *path, int GIT_UNUSED(mode))
{
return mkdir(path);
}
diff --git a/src/odb.c b/src/odb.c
index 92ff64641..afadc73a3 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -1110,6 +1110,8 @@ static int read_packed(git_obj *out, git_pack *p, const git_oid *id)
off_t pos;
int res;
+ assert(out && p && id);
+
if (pack_openidx(p))
return GIT_ERROR;
res = p->idx_search(&pos, p, id);
@@ -1128,6 +1130,12 @@ int git_odb__read_packed(git_obj *out, git_odb *db, const git_oid *id)
git_packlist *pl = packlist_get(db);
size_t j;
+ assert(out && db && id);
+
+ out->data = NULL;
+ out->len = 0;
+ out->type = GIT_OBJ_BAD;
+
if (!pl)
return GIT_ENOTFOUND;
diff --git a/tests/t0020-dirent.c b/tests/t0020-dirent.c
index a2e130b3f..334fff149 100644
--- a/tests/t0020-dirent.c
+++ b/tests/t0020-dirent.c
@@ -184,7 +184,7 @@ static walk_data empty = {
empty_names
};
-static int dont_call_me(void *state, char *path)
+static int dont_call_me(void *GIT_UNUSED(state), char *GIT_UNUSED(path))
{
test_die("dont_call_me: unexpected callback!");
}