Skip to content

Commit e5077fd

Browse files
committed
remove hardcoded dependency on header size
1 parent cbb1374 commit e5077fd

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

libqretprop/_build_qlcp.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
_PROTOCOL_DIR = _ROOT / "libqretprop" / "_protocol"
1717

1818
ffi = cffi.FFI()
19-
ffi.cdef((_LIB_DIR / "qlcp_lib_expanded.h").read_text())
19+
ffi.cdef(
20+
(_LIB_DIR / "qlcp_lib_expanded.h").read_text()
21+
+ "\n#define QLCP_HEADER_SIZE ..." # Tells cffi to treat this #define as a constant pulled from the header
22+
)
2023
ffi.set_source(
2124
"_qlcp", # flat name — no dots
2225
'#include "qlcp_lib.h"',

libqretprop/protocol.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
_MAX_CONFIG = 4096
1414
_ENCODE_BUF_SIZE = 4096
1515

16-
# HEADER_SIZE cannot be sourced from the C header via cffi since it's a #define
17-
# This must be kept in sync with the actual header size in qlcp_lib.h
18-
HEADER_SIZE = 9
16+
HEADER_SIZE = _lib.QLCP_HEADER_SIZE
1917

2018
# ============================================================================
2119
# UTILS

0 commit comments

Comments
 (0)