mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-08 22:08:56 +00:00
Add GIT_STDLIB_CALL
This removes the one-off GIT_CDECL and adds a new standard way of doing this named GIT_STDLIB_CALL with a src/win32 specific def when on the Windows platform.
This commit is contained in:
parent
f708c89fa6
commit
97b7137459
@ -41,6 +41,8 @@
|
|||||||
# ifdef GIT_THREADS
|
# ifdef GIT_THREADS
|
||||||
# include <pthread.h>
|
# include <pthread.h>
|
||||||
# endif
|
# endif
|
||||||
|
#define GIT_STDLIB_CALL
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "git2/types.h"
|
#include "git2/types.h"
|
||||||
|
@ -19,14 +19,7 @@ typedef uint64_t hashsig_state;
|
|||||||
|
|
||||||
#define HASHSIG_HEAP_SIZE ((1 << 7) - 1)
|
#define HASHSIG_HEAP_SIZE ((1 << 7) - 1)
|
||||||
|
|
||||||
/* going to use qsort so jump through some Windows hoops */
|
typedef int (GIT_STDLIB_CALL *hashsig_cmp)(const void *a, const void *b);
|
||||||
#ifdef GIT_WIN32
|
|
||||||
#define GIT_CDECL __cdecl
|
|
||||||
#else
|
|
||||||
#define GIT_CDECL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef int (GIT_CDECL *hashsig_cmp)(const void *a, const void *b);
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int size, asize;
|
int size, asize;
|
||||||
@ -60,13 +53,13 @@ static void hashsig_heap_init(hashsig_heap *h, hashsig_cmp cmp)
|
|||||||
h->cmp = cmp;
|
h->cmp = cmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int GIT_CDECL hashsig_cmp_max(const void *a, const void *b)
|
static int GIT_STDLIB_CALL hashsig_cmp_max(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
hashsig_t av = *(const hashsig_t *)a, bv = *(const hashsig_t *)b;
|
hashsig_t av = *(const hashsig_t *)a, bv = *(const hashsig_t *)b;
|
||||||
return (av < bv) ? -1 : (av > bv) ? 1 : 0;
|
return (av < bv) ? -1 : (av > bv) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int GIT_CDECL hashsig_cmp_min(const void *a, const void *b)
|
static int GIT_STDLIB_CALL hashsig_cmp_min(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
hashsig_t av = *(const hashsig_t *)a, bv = *(const hashsig_t *)b;
|
hashsig_t av = *(const hashsig_t *)a, bv = *(const hashsig_t *)b;
|
||||||
return (av > bv) ? -1 : (av < bv) ? 1 : 0;
|
return (av > bv) ? -1 : (av < bv) ? 1 : 0;
|
||||||
|
@ -39,4 +39,6 @@ typedef SSIZE_T ssize_t;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define GIT_STDLIB_CALL __cdecl
|
||||||
|
|
||||||
#endif /* INCLUDE_msvc_compat__ */
|
#endif /* INCLUDE_msvc_compat__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user