Skip to content

Commit

Permalink
Store qualified rule name instead of Rule object from compiler callback
Browse files Browse the repository at this point in the history
Close: #142
  • Loading branch information
hillu committed Mar 24, 2024
1 parent f03acb3 commit cdcb978
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ static const char* rule_identifier(YR_RULE* r) {
return r->identifier;
}
// rule_namespace is a union accessor function.
static const char* rule_namespace(YR_RULE* r) {
return r->ns->name;
}
void compilerCallback(int, char*, int, YR_RULE*, char*, void*);
char* includeCallback(char*, char*, char*, void*);
void freeCallback(char*, void*);
Expand Down Expand Up @@ -46,7 +51,7 @@ func compilerCallback(errorLevel C.int, filename *C.char, linenumber C.int, rule
Text: text,
}
if rule != nil {
msg.Rule = C.GoString(rule_namespace(rule))
msg.Rule = C.GoString(C.rule_namespace(rule))
if msg.Rule == "default" {
msg.Rule = C.GoString(C.rule_identifier(rule))
} else {
Expand Down

0 comments on commit cdcb978

Please sign in to comment.