Skip to content

Commit

Permalink
refactor(capi): redesign the C API and use callback functions for acc…
Browse files Browse the repository at this point in the history
…essing rule's patterns and matches.

Instead of allocating a `YRX_PATTERNS` structure with patterns and matches, the API offers functions that allow iterating over the patterns using callback functions. With this design the allocation of memory is not necessary.

The implementation is also split into more files for making the code easier to maintain.
  • Loading branch information
plusvic committed Sep 16, 2024
1 parent 55aa752 commit 0778264
Show file tree
Hide file tree
Showing 12 changed files with 874 additions and 753 deletions.
305 changes: 162 additions & 143 deletions capi/include/yara_x.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion capi/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -492,5 +492,5 @@ pub unsafe extern "C" fn yrx_compiler_build(
_yrx_compiler_create(compiler.flags),
);

Box::into_raw(Box::new(YRX_RULES(compiler.build())))
Box::into_raw(YRX_RULES::boxed(compiler.build()))
}
Loading

0 comments on commit 0778264

Please sign in to comment.