Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
RedisLabs Raft
Commits
846127fe
Unverified
Commit
846127fe
authored
Jul 07, 2022
by
Ozan Tezcan
Committed by
GitHub
Jul 07, 2022
Browse files
Add #include stddef.h to raft.h for size_t (#110)
parent
03e2f294
Changes
2
Show whitespace changes
Inline
Side-by-side
include/raft.h
View file @
846127fe
...
...
@@ -10,6 +10,8 @@
#ifndef RAFT_H_
#define RAFT_H_
#include <stddef.h>
#include "raft_types.h"
typedef
enum
{
...
...
tests/raft_cffi_builder.py
View file @
846127fe
import
argparse
import
os
import
subprocess
import
cffi
def
load
(
fname
):
return
'
\n
'
.
join
(
[
line
for
line
in
subprocess
.
check_output
(
[
"gcc"
,
"-E"
,
fname
]).
decode
(
'utf-8'
).
split
(
'
\n
'
)])
tmpfile
=
'tests/raft_cffi_tmp.h'
# Strip C standard library headers as cffi cannot parse them
with
open
(
fname
,
"r"
)
as
f
:
lines
=
f
.
readlines
()
with
open
(
tmpfile
,
"w+"
)
as
f
:
for
line
in
lines
:
if
'#include <std'
not
in
line
:
f
.
write
(
line
)
output
=
subprocess
.
check_output
([
"gcc"
,
"-Iinclude/"
,
"-E"
,
tmpfile
])
os
.
unlink
(
tmpfile
)
return
'
\n
'
.
join
([
line
for
line
in
output
.
decode
(
'utf-8'
).
split
(
'
\n
'
)])
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'--libdir'
,
type
=
str
,
default
=
'.'
)
parser
.
add_argument
(
'--libname'
,
type
=
str
,
default
=
'raft'
)
...
...
@@ -50,7 +61,6 @@ if __name__ == '__main__':
extra_link_args
=
[
"-L{}"
.
format
(
args
.
libdir
)]
)
ffibuilder
.
cdef
(
'void *malloc(size_t __size);'
)
ffibuilder
.
cdef
(
load
(
'include/raft.h'
))
ffibuilder
.
cdef
(
load
(
'include/raft_private.h'
))
...
...
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