Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
19e99de0
Commit
19e99de0
authored
Nov 10, 2021
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmake: qsort detection in features.h
parent
d3a7a352
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
20 deletions
+15
-20
src/CMakeLists.txt
+3
-12
src/features.h.in
+4
-0
src/util.c
+8
-8
No files found.
src/CMakeLists.txt
View file @
19e99de0
...
@@ -50,22 +50,13 @@ add_feature_info(futimens GIT_USE_FUTIMENS "futimens support")
...
@@ -50,22 +50,13 @@ add_feature_info(futimens GIT_USE_FUTIMENS "futimens support")
check_prototype_definition
(
qsort_r
check_prototype_definition
(
qsort_r
"void qsort_r(void *base, size_t nmemb, size_t size, void *thunk, int (*compar)(void *, const void *, const void *))"
"void qsort_r(void *base, size_t nmemb, size_t size, void *thunk, int (*compar)(void *, const void *, const void *))"
""
"stdlib.h"
HAVE_QSORT_R_BSD
)
""
"stdlib.h"
GIT_QSORT_R_BSD
)
if
(
HAVE_QSORT_R_BSD
)
target_compile_definitions
(
git2internal PRIVATE HAVE_QSORT_R_BSD
)
endif
()
check_prototype_definition
(
qsort_r
check_prototype_definition
(
qsort_r
"void qsort_r(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *arg)"
"void qsort_r(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *arg)"
""
"stdlib.h"
HAVE_QSORT_R_GNU
)
""
"stdlib.h"
GIT_QSORT_R_GNU
)
if
(
HAVE_QSORT_R_GNU
)
target_compile_definitions
(
git2internal PRIVATE HAVE_QSORT_R_GNU
)
endif
()
check_function_exists
(
qsort_s HAVE_QSORT_S
)
check_function_exists
(
qsort_s GIT_QSORT_S
)
if
(
HAVE_QSORT_S
)
target_compile_definitions
(
git2internal PRIVATE HAVE_QSORT_S
)
endif
()
# Find required dependencies
# Find required dependencies
...
...
src/features.h.in
View file @
19e99de0
...
@@ -24,6 +24,10 @@
...
@@ -24,6 +24,10 @@
#cmakedefine GIT_REGEX_PCRE2
#cmakedefine GIT_REGEX_PCRE2
#cmakedefine GIT_REGEX_BUILTIN 1
#cmakedefine GIT_REGEX_BUILTIN 1
#cmakedefine GIT_QSORT_R_BSD
#cmakedefine GIT_QSORT_R_GNU
#cmakedefine GIT_QSORT_S
#cmakedefine GIT_SSH 1
#cmakedefine GIT_SSH 1
#cmakedefine GIT_SSH_MEMORY_CREDENTIALS 1
#cmakedefine GIT_SSH_MEMORY_CREDENTIALS 1
...
...
src/util.c
View file @
19e99de0
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
# endif
# endif
# include <windows.h>
# include <windows.h>
# ifdef
HAVE
_QSORT_S
# ifdef
GIT
_QSORT_S
# include <search.h>
# include <search.h>
# endif
# endif
#endif
#endif
...
@@ -673,7 +673,7 @@ size_t git__unescape(char *str)
...
@@ -673,7 +673,7 @@ size_t git__unescape(char *str)
return
(
pos
-
str
);
return
(
pos
-
str
);
}
}
#if defined(
HAVE_QSORT_S) || defined(HAVE
_QSORT_R_BSD)
#if defined(
GIT_QSORT_S) || defined(GIT
_QSORT_R_BSD)
typedef
struct
{
typedef
struct
{
git__sort_r_cmp
cmp
;
git__sort_r_cmp
cmp
;
void
*
payload
;
void
*
payload
;
...
@@ -688,9 +688,9 @@ static int GIT_LIBGIT2_CALL git__qsort_r_glue_cmp(
...
@@ -688,9 +688,9 @@ static int GIT_LIBGIT2_CALL git__qsort_r_glue_cmp(
#endif
#endif
#if !defined(
HAVE
_QSORT_R_BSD) && \
#if !defined(
GIT
_QSORT_R_BSD) && \
!defined(
HAVE
_QSORT_R_GNU) && \
!defined(
GIT
_QSORT_R_GNU) && \
!defined(
HAVE
_QSORT_S)
!defined(
GIT
_QSORT_S)
static
void
swap
(
uint8_t
*
a
,
uint8_t
*
b
,
size_t
elsize
)
static
void
swap
(
uint8_t
*
a
,
uint8_t
*
b
,
size_t
elsize
)
{
{
char
tmp
[
256
];
char
tmp
[
256
];
...
@@ -721,12 +721,12 @@ static void insertsort(
...
@@ -721,12 +721,12 @@ static void insertsort(
void
git__qsort_r
(
void
git__qsort_r
(
void
*
els
,
size_t
nel
,
size_t
elsize
,
git__sort_r_cmp
cmp
,
void
*
payload
)
void
*
els
,
size_t
nel
,
size_t
elsize
,
git__sort_r_cmp
cmp
,
void
*
payload
)
{
{
#if defined(
HAVE
_QSORT_R_BSD)
#if defined(
GIT
_QSORT_R_BSD)
git__qsort_r_glue
glue
=
{
cmp
,
payload
};
git__qsort_r_glue
glue
=
{
cmp
,
payload
};
qsort_r
(
els
,
nel
,
elsize
,
&
glue
,
git__qsort_r_glue_cmp
);
qsort_r
(
els
,
nel
,
elsize
,
&
glue
,
git__qsort_r_glue_cmp
);
#elif defined(
HAVE
_QSORT_R_GNU)
#elif defined(
GIT
_QSORT_R_GNU)
qsort_r
(
els
,
nel
,
elsize
,
cmp
,
payload
);
qsort_r
(
els
,
nel
,
elsize
,
cmp
,
payload
);
#elif defined(
HAVE
_QSORT_S)
#elif defined(
GIT
_QSORT_S)
git__qsort_r_glue
glue
=
{
cmp
,
payload
};
git__qsort_r_glue
glue
=
{
cmp
,
payload
};
qsort_s
(
els
,
nel
,
elsize
,
git__qsort_r_glue_cmp
,
&
glue
);
qsort_s
(
els
,
nel
,
elsize
,
git__qsort_r_glue_cmp
,
&
glue
);
#else
#else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment