Skip to content

Commit

Permalink
query: Remove string and symbol capabilities to convert flags of EvtQ…
Browse files Browse the repository at this point in the history
…uery

Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 committed May 13, 2024
1 parent c1f85b7 commit 5d5ce87
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions ext/winevt/winevt_query.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,26 +71,6 @@ rb_winevt_query_alloc(VALUE klass)
return obj;
}

static DWORD
get_evt_query_flag_from_cstr(char* flag_str)
{
if (strcmp(flag_str, "channel") == 0)
return EvtQueryChannelPath;
else if (strcmp(flag_str, "file") == 0)
return EvtQueryFilePath;
else if (strcmp(flag_str, "forward") == 0)
return EvtQueryForwardDirection;
else if (strcmp(flag_str, "reverse") == 0)
return EvtQueryReverseDirection;
else if (strcmp(flag_str, "tolerate_query_errors") == 0 ||
strcmp(flag_str, "tolerate_errors") == 0)
return EvtQueryTolerateQueryErrors;
else
rb_raise(rb_eArgError, "Unknown query flag: %s", flag_str);

return 0;
}

/*
* Initalize Query class.
*
Expand Down Expand Up @@ -132,12 +112,6 @@ rb_winevt_query_initialize(VALUE argc, VALUE *argv, VALUE self)
}

switch (TYPE(rb_flags)) {
case T_SYMBOL:
flags = get_evt_query_flag_from_cstr(RSTRING_PTR(rb_sym2str(rb_flags)));
break;
case T_STRING:
flags = get_evt_query_flag_from_cstr(StringValuePtr(rb_flags));
break;
case T_FIXNUM:
flags = NUM2LONG(rb_flags);
break;
Expand Down

0 comments on commit 5d5ce87

Please sign in to comment.