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
767a9a73
Commit
767a9a73
authored
May 12, 2023
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmake: simplify QSORT names
`QSORT_R` and `QSORT_S` -> `QSORT`
parent
3d9cb5e0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
18 deletions
+20
-18
src/CMakeLists.txt
+4
-4
src/util/git2_features.h.in
+4
-4
src/util/util.c
+12
-10
No files found.
src/CMakeLists.txt
View file @
767a9a73
...
@@ -69,25 +69,25 @@ disable_warnings(unused-parameter)
...
@@ -69,25 +69,25 @@ disable_warnings(unused-parameter)
# of the comparison function:
# of the comparison function:
check_prototype_definition
(
qsort_r
check_prototype_definition
(
qsort_r
"void (qsort_r)(void *base, size_t nmemb, size_t size, void *context, int (*compar)(void *, const void *, const void *))"
"void (qsort_r)(void *base, size_t nmemb, size_t size, void *context, int (*compar)(void *, const void *, const void *))"
""
"stdlib.h"
GIT_QSORT_
R_
BSD
)
""
"stdlib.h"
GIT_QSORT_BSD
)
# GNU or POSIX qsort_r() has the 'context' parameter as the last argument of the
# GNU or POSIX qsort_r() has the 'context' parameter as the last argument of the
# comparison function:
# comparison function:
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 *context)"
"void (qsort_r)(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *context)"
""
"stdlib.h"
GIT_QSORT_
R_
GNU
)
""
"stdlib.h"
GIT_QSORT_GNU
)
# C11 qsort_s() has the 'context' parameter as the last argument of the
# C11 qsort_s() has the 'context' parameter as the last argument of the
# comparison function, and returns an error status:
# comparison function, and returns an error status:
check_prototype_definition
(
qsort_s
check_prototype_definition
(
qsort_s
"errno_t (qsort_s)(void *base, rsize_t nmemb, rsize_t size, int (*compar)(const void *, const void *, void *), void *context)"
"errno_t (qsort_s)(void *base, rsize_t nmemb, rsize_t size, int (*compar)(const void *, const void *, void *), void *context)"
"0"
"stdlib.h"
GIT_QSORT_
S_
C11
)
"0"
"stdlib.h"
GIT_QSORT_C11
)
# MSC qsort_s() has the 'context' parameter as the first argument of the
# MSC qsort_s() has the 'context' parameter as the first argument of the
# comparison function, and as the last argument of qsort_s():
# comparison function, and as the last argument of qsort_s():
check_prototype_definition
(
qsort_s
check_prototype_definition
(
qsort_s
"void (qsort_s)(void *base, size_t num, size_t width, int (*compare )(void *, const void *, const void *), void *context)"
"void (qsort_s)(void *base, size_t num, size_t width, int (*compare )(void *, const void *, const void *), void *context)"
""
"stdlib.h"
GIT_QSORT_
S_
MSC
)
""
"stdlib.h"
GIT_QSORT_MSC
)
# restore CMAKE_C_FLAGS
# restore CMAKE_C_FLAGS
set
(
CMAKE_C_FLAGS
"
${
SAVED_CMAKE_C_FLAGS
}
"
)
set
(
CMAKE_C_FLAGS
"
${
SAVED_CMAKE_C_FLAGS
}
"
)
...
...
src/util/git2_features.h.in
View file @
767a9a73
...
@@ -24,10 +24,10 @@
...
@@ -24,10 +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_BSD
#cmakedefine GIT_QSORT_
R_
GNU
#cmakedefine GIT_QSORT_GNU
#cmakedefine GIT_QSORT_
S_
C11
#cmakedefine GIT_QSORT_C11
#cmakedefine GIT_QSORT_
S_
MSC
#cmakedefine GIT_QSORT_MSC
#cmakedefine GIT_SSH 1
#cmakedefine GIT_SSH 1
#cmakedefine GIT_SSH_MEMORY_CREDENTIALS 1
#cmakedefine GIT_SSH_MEMORY_CREDENTIALS 1
...
...
src/util/util.c
View file @
767a9a73
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
# endif
# endif
# include <windows.h>
# include <windows.h>
# ifdef GIT_QSORT_
S_
MSC
# ifdef GIT_QSORT_MSC
# 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(GIT_QSORT_
S_MSC) || defined(GIT_QSORT_R
_BSD)
#if defined(GIT_QSORT_
MSC) || defined(GIT_QSORT
_BSD)
typedef
struct
{
typedef
struct
{
git__sort_r_cmp
cmp
;
git__sort_r_cmp
cmp
;
void
*
payload
;
void
*
payload
;
...
@@ -688,10 +688,11 @@ static int GIT_LIBGIT2_CALL git__qsort_r_glue_cmp(
...
@@ -688,10 +688,11 @@ static int GIT_LIBGIT2_CALL git__qsort_r_glue_cmp(
#endif
#endif
#if !defined(GIT_QSORT_R_BSD) && \
#if !defined(GIT_QSORT_BSD) && \
!defined(GIT_QSORT_R_GNU) && \
!defined(GIT_QSORT_GNU) && \
!defined(GIT_QSORT_S_C11) && \
!defined(GIT_QSORT_C11) && \
!defined(GIT_QSORT_S_MSC)
!defined(GIT_QSORT_MSC)
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
];
...
@@ -717,19 +718,20 @@ static void insertsort(
...
@@ -717,19 +718,20 @@ static void insertsort(
for
(
j
=
i
;
j
>
base
&&
cmp
(
j
,
j
-
elsize
,
payload
)
<
0
;
j
-=
elsize
)
for
(
j
=
i
;
j
>
base
&&
cmp
(
j
,
j
-
elsize
,
payload
)
<
0
;
j
-=
elsize
)
swap
(
j
,
j
-
elsize
,
elsize
);
swap
(
j
,
j
-
elsize
,
elsize
);
}
}
#endif
#endif
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(GIT_QSORT_
R_
GNU)
#if defined(GIT_QSORT_GNU)
qsort_r
(
els
,
nel
,
elsize
,
cmp
,
payload
);
qsort_r
(
els
,
nel
,
elsize
,
cmp
,
payload
);
#elif defined(GIT_QSORT_
S_
C11)
#elif defined(GIT_QSORT_C11)
qsort_s
(
els
,
nel
,
elsize
,
cmp
,
payload
);
qsort_s
(
els
,
nel
,
elsize
,
cmp
,
payload
);
#elif defined(GIT_QSORT_
R_
BSD)
#elif defined(GIT_QSORT_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(GIT_QSORT_
S_
MSC)
#elif defined(GIT_QSORT_MSC)
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