From 8c1d5d4839419e6dca0b3fd66f17864c5e7d60e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Sat, 6 Aug 2011 11:23:04 +0200 Subject: [PATCH 1/3] Use the internal sort in the local transport MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Carlos Martín Nieto --- src/transport_local.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/transport_local.c b/src/transport_local.c index 64ac183d1..bb3b10e10 100644 --- a/src/transport_local.c +++ b/src/transport_local.c @@ -14,14 +14,6 @@ typedef struct { git_vector *refs; } transport_local; -static int cmp_refs(const void *a, const void *b) -{ - const char *stra = *(const char * const *) a; - const char *strb = *(const char * const *) b; - - return strcmp(stra, strb); -} - /* * Try to open the url as a git directory. The direction doesn't * matter in this case because we're calulating the heads ourselves. @@ -148,7 +140,7 @@ static int local_ls(git_transport *transport, git_headarray *array) return error; /* Sort the references first */ - qsort(refs.strings, refs.count, sizeof(char *), cmp_refs); + git__tsort((void **)refs.strings, refs.count, (git_vector_cmp) strcmp); /* Add HEAD */ error = add_ref(GIT_HEAD_FILE, repo, vec); From 6e6ec54bebb41fd0c0f1171b04d13306937b9636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Sat, 6 Aug 2011 11:26:59 +0200 Subject: [PATCH 2/3] Force the test's main function to use cdecl under Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Carlos Martín Nieto --- tests/test_main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test_main.c b/tests/test_main.c index 1a35e6005..c9f8da3a4 100644 --- a/tests/test_main.c +++ b/tests/test_main.c @@ -69,7 +69,12 @@ static libgit2_suite suite_methods[]= { #define GIT_SUITE_COUNT (ARRAY_SIZE(suite_methods)) -int main(int GIT_UNUSED(argc), char *GIT_UNUSED(argv[])) +#ifdef GIT_WIN32 +int __cdecl +#else +int +#endif +main(int GIT_UNUSED(argc), char *GIT_UNUSED(argv[])) { unsigned int i, failures; From 1b5078f6b186b92c237e2148a9008be8d372f675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Sat, 6 Aug 2011 13:58:16 +0200 Subject: [PATCH 3/3] Use __stdcall by default on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Carlos Martín Nieto --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index cb9385210..0dbb6d13e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,10 +45,14 @@ SET(INSTALL_INC include CACHE PATH "Where to install headers to.") OPTION (BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" ON) OPTION (BUILD_TESTS "Build Tests" ON) OPTION (THREADSAFE "Build libgit2 as threadsafe" OFF) +OPTION (STDCALL "Buildl libgit2 with the __stdcall convention (Windows)" ON) # Platform specific compilation flags IF (MSVC) SET(CMAKE_C_FLAGS "/W4 /WX /nologo /Zi") + IF (STDCALL) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gz") + ENDIF () # TODO: bring back /RTC1 /RTCc SET(CMAKE_C_FLAGS_DEBUG "/Od /DEBUG /MTd") SET(CMAKE_C_FLAGS_RELEASE "/MT /O2")