summaryrefslogtreecommitdiff
path: root/src/tsort.c
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2011-07-07 10:11:00 +0200
committerVicent Marti <tanoku@gmail.com>2011-07-07 12:12:34 +0200
commitbdcc46111c17b3a59d70ce197e44443f5ffba616 (patch)
tree6bc54b7af7902daa8e4f715721172a8c02d4f9c3 /src/tsort.c
parentde18f276683a5cf3d85d001f6521e52c8c802e60 (diff)
downloadlibgit2-bdcc46111c17b3a59d70ce197e44443f5ffba616.tar.gz
Fix MSVC compilation warnings
Diffstat (limited to 'src/tsort.c')
-rw-r--r--src/tsort.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/tsort.c b/src/tsort.c
index eda9a2fd2..70ed58901 100644
--- a/src/tsort.c
+++ b/src/tsort.c
@@ -3,6 +3,9 @@
#include <stdint.h>
#include <stdlib.h>
+#ifndef GIT_WIN32
+#include <common.h>
+#endif
/**
* An array-of-pointers implementation of Python's Timsort
* Based on code by Christopher Swenson under the MIT license
@@ -89,6 +92,8 @@ static int binsearch(void **dst, const void *x, size_t size, cmp_ptr_t cmp)
static void bisort(void **dst, size_t start, size_t size, cmp_ptr_t cmp)
{
size_t i;
+ void *x;
+ int location;
for (i = start; i < size; i++) {
int j;
@@ -97,8 +102,8 @@ static void bisort(void **dst, size_t start, size_t size, cmp_ptr_t cmp)
continue;
/* Else we need to find the right place, shift everything over, and squeeze in */
- void *x = dst[i];
- int location = binsearch(dst, x, i, cmp);
+ x = dst[i];
+ location = binsearch(dst, x, i, cmp);
for (j = i - 1; j >= location; j--) {
dst[j + 1] = dst[j];
}
@@ -323,7 +328,8 @@ static ssize_t collapse(void **dst, struct tsort_run *stack, ssize_t stack_curr,
bisort(&dst[curr], len, run, cmp);\
len = run;\
}\
- run_stack[stack_curr++] = (struct tsort_run) {curr, len};\
+ run_stack[stack_curr].start = curr;\
+ run_stack[stack_curr++].length = len;\
curr += len;\
if (curr == (ssize_t)size) {\
/* finish up */ \
@@ -341,7 +347,6 @@ static ssize_t collapse(void **dst, struct tsort_run *stack, ssize_t stack_curr,
}\
while (0)
-
void git__tsort(void **dst, size_t size, cmp_ptr_t cmp)
{
struct tsort_store _store, *store = &_store;