Skip to content

Commit

Permalink
refactor(capi): redesign the C API using callbacks (#198)
Browse files Browse the repository at this point in the history
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 17, 2024
1 parent e3a1003 commit 92651c7
Show file tree
Hide file tree
Showing 14 changed files with 1,073 additions and 957 deletions.
374 changes: 205 additions & 169 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 @@ -423,5 +423,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 92651c7

Please sign in to comment.