Skip to content

Commit

Permalink
fix: add missing #[no_mangle] decorator to yrx_rule_metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
plusvic committed May 24, 2024
1 parent 497c678 commit caccbce
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions capi/include/yara_x.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,15 @@ enum YRX_RESULT yrx_rule_namespace(const struct YRX_RULE *rule,
const uint8_t **ns,
size_t *len);

// Returns the metadata associated to a rule.
//
// The metadata is represented by a [`YRX_METADATA`] object that must be
// destroyed with [`yrx_metadata_destroy`] when not needed anymore.
//
// This function returns a null pointer when `rule` is null or the
// rule doesn't have any metadata.
struct YRX_METADATA *yrx_rule_metadata(const struct YRX_RULE *rule);

// Destroys a [`YRX_METADATA`] object.
void yrx_metadata_destroy(struct YRX_METADATA *metadata);

Expand Down
1 change: 1 addition & 0 deletions capi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ pub unsafe extern "C" fn yrx_rule_namespace(
///
/// This function returns a null pointer when `rule` is null or the
/// rule doesn't have any metadata.
#[no_mangle]
pub unsafe extern "C" fn yrx_rule_metadata(
rule: *const YRX_RULE,
) -> *mut YRX_METADATA {
Expand Down
9 changes: 9 additions & 0 deletions site/content/docs/api/c.md
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,15 @@ The `*ns` pointer will be valid as long as the [YRX_RULES](#yrx_rules) object
that contains the rule is not destroyed. The namespace is guaranteed to be a
valid UTF-8 string.

#### yrx_rule_metadata

```c
enum YRX_RESULT yrx_rule_namespace(
const struct YRX_RULE *rule,
const uint8_t **ns,
size_t *len);
```
#### yrx_rule_patterns
```c
Expand Down

0 comments on commit caccbce

Please sign in to comment.