Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
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
Hide whitespace changes
Inline
Side-by-side
include/raft.h
View file @
846127fe
...
@@ -10,6 +10,8 @@
...
@@ -10,6 +10,8 @@
#ifndef RAFT_H_
#ifndef RAFT_H_
#define RAFT_H_
#define RAFT_H_
#include <stddef.h>
#include "raft_types.h"
#include "raft_types.h"
typedef
enum
{
typedef
enum
{
...
...
tests/raft_cffi_builder.py
View file @
846127fe
import
argparse
import
argparse
import
os
import
subprocess
import
subprocess
import
cffi
import
cffi
def
load
(
fname
):
def
load
(
fname
):
return
'
\n
'
.
join
(
tmpfile
=
'tests/raft_cffi_tmp.h'
[
line
for
line
in
subprocess
.
check_output
(
# Strip C standard library headers as cffi cannot parse them
[
"gcc"
,
"-E"
,
fname
]).
decode
(
'utf-8'
).
split
(
'
\n
'
)])
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
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'--libdir'
,
type
=
str
,
default
=
'.'
)
parser
.
add_argument
(
'--libdir'
,
type
=
str
,
default
=
'.'
)
parser
.
add_argument
(
'--libname'
,
type
=
str
,
default
=
'raft'
)
parser
.
add_argument
(
'--libname'
,
type
=
str
,
default
=
'raft'
)
...
@@ -48,8 +59,7 @@ if __name__ == '__main__':
...
@@ -48,8 +59,7 @@ if __name__ == '__main__':
include_dirs
=
[
args
.
includedir
],
include_dirs
=
[
args
.
includedir
],
extra_compile_args
=
[
"-UNDEBUG"
],
extra_compile_args
=
[
"-UNDEBUG"
],
extra_link_args
=
[
"-L{}"
.
format
(
args
.
libdir
)]
extra_link_args
=
[
"-L{}"
.
format
(
args
.
libdir
)]
)
)
ffibuilder
.
cdef
(
'void *malloc(size_t __size);'
)
ffibuilder
.
cdef
(
'void *malloc(size_t __size);'
)
ffibuilder
.
cdef
(
load
(
'include/raft.h'
))
ffibuilder
.
cdef
(
load
(
'include/raft.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