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
e683d152
Commit
e683d152
authored
Sep 30, 2015
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qsort_r/qsort_s: detect their support
parent
8649dfd8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
18 deletions
+23
-18
CMakeLists.txt
+15
-5
src/util.c
+8
-13
No files found.
CMakeLists.txt
View file @
e683d152
...
...
@@ -432,11 +432,6 @@ ELSE ()
ADD_C_FLAG_IF_SUPPORTED
(
-Wno-unused-const-variable
)
ADD_C_FLAG_IF_SUPPORTED
(
-Wno-unused-function
)
CHECK_FUNCTION_EXISTS
(
futimens HAVE_FUTIMENS
)
IF
(
HAVE_FUTIMENS
)
ADD_DEFINITIONS
(
-DHAVE_FUTIMENS
)
ENDIF
()
IF
(
APPLE
)
# Apple deprecated OpenSSL
ADD_C_FLAG_IF_SUPPORTED
(
-Wno-deprecated-declarations
)
ENDIF
()
...
...
@@ -447,6 +442,21 @@ ELSE ()
ENDIF
()
ENDIF
()
CHECK_FUNCTION_EXISTS
(
futimens HAVE_FUTIMENS
)
IF
(
HAVE_FUTIMENS
)
ADD_DEFINITIONS
(
-DHAVE_FUTIMENS
)
ENDIF
()
CHECK_FUNCTION_EXISTS
(
qsort_r HAVE_QSORT_R
)
IF
(
HAVE_QSORT_R
)
ADD_DEFINITIONS
(
-DHAVE_QSORT_R
)
ENDIF
()
CHECK_FUNCTION_EXISTS
(
qsort_s HAVE_QSORT_S
)
IF
(
HAVE_QSORT_S
)
ADD_DEFINITIONS
(
-DHAVE_QSORT_S
)
ENDIF
()
IF
(
NOT CMAKE_CONFIGURATION_TYPES
)
# Build Debug by default
IF
(
NOT CMAKE_BUILD_TYPE
)
...
...
src/util.c
View file @
e683d152
...
...
@@ -611,7 +611,7 @@ size_t git__unescape(char *str)
return
(
pos
-
str
);
}
#if defined(
GIT_WIN32) || defined(BSD
)
#if defined(
HAVE_QSORT_S) || (defined(HAVE_QSORT_R) && defined(BSD)
)
typedef
struct
{
git__sort_r_cmp
cmp
;
void
*
payload
;
...
...
@@ -628,21 +628,16 @@ static int GIT_STDLIB_CALL git__qsort_r_glue_cmp(
void
git__qsort_r
(
void
*
els
,
size_t
nel
,
size_t
elsize
,
git__sort_r_cmp
cmp
,
void
*
payload
)
{
#if defined(__MINGW32__) || defined(AMIGA) || \
defined(__OpenBSD__) || defined(__NetBSD__) || \
defined(__gnu_hurd__) || defined(__ANDROID_API__) || \
defined(__sun) || defined(__CYGWIN__) || \
(__GLIBC__ == 2 && __GLIBC_MINOR__ < 8) || \
(defined(_MSC_VER) && _MSC_VER < 1500)
git__insertsort_r
(
els
,
nel
,
elsize
,
NULL
,
cmp
,
payload
);
#elif defined(GIT_WIN32)
git__qsort_r_glue
glue
=
{
cmp
,
payload
};
qsort_s
(
els
,
nel
,
elsize
,
git__qsort_r_glue_cmp
,
&
glue
);
#elif defined(BSD)
#if defined(HAVE_QSORT_R) && defined(BSD)
git__qsort_r_glue
glue
=
{
cmp
,
payload
};
qsort_r
(
els
,
nel
,
elsize
,
&
glue
,
git__qsort_r_glue_cmp
);
#el
se
#el
if defined(HAVE_QSORT_R) && defined(__GLIBC__)
qsort_r
(
els
,
nel
,
elsize
,
cmp
,
payload
);
#elif defined(HAVE_QSORT_S)
git__qsort_r_glue
glue
=
{
cmp
,
payload
};
qsort_s
(
els
,
nel
,
elsize
,
git__qsort_r_glue_cmp
,
&
glue
);
#else
git__insertsort_r
(
els
,
nel
,
elsize
,
NULL
,
cmp
,
payload
);
#endif
}
...
...
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