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
66956c50
Commit
66956c50
authored
Sep 30, 2015
by
Edward Thomson
Committed by
Carlos Martín Nieto
Nov 04, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qsort_r/qsort_s: detect their support
parent
cd768280
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 @
66956c50
...
@@ -448,11 +448,6 @@ ELSE ()
...
@@ -448,11 +448,6 @@ ELSE ()
ADD_C_FLAG_IF_SUPPORTED
(
-Wno-unused-const-variable
)
ADD_C_FLAG_IF_SUPPORTED
(
-Wno-unused-const-variable
)
ADD_C_FLAG_IF_SUPPORTED
(
-Wno-unused-function
)
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
IF
(
APPLE
)
# Apple deprecated OpenSSL
ADD_C_FLAG_IF_SUPPORTED
(
-Wno-deprecated-declarations
)
ADD_C_FLAG_IF_SUPPORTED
(
-Wno-deprecated-declarations
)
ENDIF
()
ENDIF
()
...
@@ -463,6 +458,21 @@ ELSE ()
...
@@ -463,6 +458,21 @@ ELSE ()
ENDIF
()
ENDIF
()
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
)
IF
(
NOT CMAKE_CONFIGURATION_TYPES
)
# Build Debug by default
# Build Debug by default
IF
(
NOT CMAKE_BUILD_TYPE
)
IF
(
NOT CMAKE_BUILD_TYPE
)
...
...
src/util.c
View file @
66956c50
...
@@ -607,7 +607,7 @@ size_t git__unescape(char *str)
...
@@ -607,7 +607,7 @@ size_t git__unescape(char *str)
return
(
pos
-
str
);
return
(
pos
-
str
);
}
}
#if defined(
GIT_WIN32) || defined(BSD
)
#if defined(
HAVE_QSORT_S) || (defined(HAVE_QSORT_R) && defined(BSD)
)
typedef
struct
{
typedef
struct
{
git__sort_r_cmp
cmp
;
git__sort_r_cmp
cmp
;
void
*
payload
;
void
*
payload
;
...
@@ -624,21 +624,16 @@ static int GIT_STDLIB_CALL git__qsort_r_glue_cmp(
...
@@ -624,21 +624,16 @@ static int GIT_STDLIB_CALL git__qsort_r_glue_cmp(
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(__MINGW32__) || defined(AMIGA) || \
#if defined(HAVE_QSORT_R) && defined(BSD)
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)
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
);
#el
se
#el
if defined(HAVE_QSORT_R) && defined(__GLIBC__)
qsort_r
(
els
,
nel
,
elsize
,
cmp
,
payload
);
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
#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