Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
VILLASframework
VILLAScommon
Commits
d24bc4a4
Commit
d24bc4a4
authored
Nov 11, 2020
by
Steffen Vogel
🎅🏼
Browse files
musl compatability fixes
parent
013af9cb
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/kernel/kernel.cpp
View file @
d24bc4a4
...
...
@@ -59,7 +59,7 @@ Version villas::kernel::getVersion()
int
villas
::
kernel
::
get_cacheline_size
()
{
#if defined(__linux__) && defined(__x86_64__)
#if defined(__linux__) && defined(__x86_64__)
&& defined(__GLIBC__)
return
sysconf
(
_SC_LEVEL1_ICACHE_LINESIZE
);
#elif defined(__MACH__)
/* Open the command for reading. */
...
...
lib/list.cpp
View file @
d24bc4a4
...
...
@@ -22,22 +22,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
#include
<array>
#include
<algorithm>
#include
<cstdlib>
#include
<cstring>
#include
<villas/list.h>
#include
<villas/utils.hpp>
#ifdef __APPLE__
static
int
cmp_sort
(
void
*
thunk
,
const
void
*
a
,
const
void
*
b
)
{
#else
static
int
cmp_sort
(
const
void
*
a
,
const
void
*
b
,
void
*
thunk
)
{
#endif
cmp_cb_t
cmp
=
(
cmp_cb_t
)
thunk
;
return
cmp
(
*
(
const
void
**
)
a
,
*
(
const
void
**
)
b
);
}
int
vlist_init
(
struct
vlist
*
l
)
{
pthread_mutex_init
(
&
l
->
lock
,
nullptr
);
...
...
@@ -231,11 +224,13 @@ void vlist_sort(struct vlist *l, cmp_cb_t cmp)
assert
(
l
->
state
==
State
::
INITIALIZED
);
#ifdef __APPLE__
qsort_r
(
l
->
array
,
l
->
length
,
sizeof
(
void
*
),
(
void
*
)
cmp
,
cmp_sort
);
#else
qsort_r
(
l
->
array
,
l
->
length
,
sizeof
(
void
*
),
cmp_sort
,
(
void
*
)
cmp
);
#endif
auto
array
=
std
::
vector
<
void
*>
(
l
->
array
,
l
->
array
+
l
->
length
);
std
::
sort
(
array
.
begin
(),
array
.
end
(),
[
cmp
](
void
*&
a
,
void
*&
b
)
->
bool
{
return
cmp
(
a
,
b
)
<
0
;
});
std
::
copy
(
array
.
begin
(),
array
.
end
(),
l
->
array
);
pthread_mutex_unlock
(
&
l
->
lock
);
}
...
...
@@ -310,4 +305,4 @@ int vlist_init_and_push(struct vlist *l, void *p)
vlist_push
(
l
,
p
);
return
0
;
}
\ No newline at end of file
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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