1 #include "../include/filter.hpp"
2 #include "../include/util.hpp"
99 throw exception(
"invalid argument: expr (=%p)", expr);
102 i32 flags = REG_EXTENDED | REG_NOSUB;
107 i32 retval = regcomp(&
m_expr, expr, flags);
108 if (
likely(retval == 0) )
112 i32 len = regerror(retval, &
m_expr, NULL, 0);
114 regerror(retval, &
m_expr, errbuf, len);
118 "failed to compile filter '%s' (regex errno %d - %s)",
153 return !regexec(&
m_expr, target, 0, NULL, 0);
static void * memset(void *, u8, u32)
Fill a memory block with a constant byte.
char i8
8-bit signed integer
filter(const filter &)
Object copy constructor.
virtual ~filter()
Object destructor.
virtual filter & set_expr(const i8 *, bool)
Set the filter expression.
#define likely(expr)
Offer a hint (positive) to the pipeline branch predictor.
bool m_mode
Filter type switch.
virtual bool mode() const
Get the filter type.
virtual filter & operator=(const filter &)
Assignment operator.
virtual bool apply(const i8 *) const
Apply the filter to a function signature or a module absolute path.
virtual filter * clone() const
Object virtual copy constructor.
regex_t m_expr
Filter expression.
int i32
32-bit signed integer
virtual filter & set_mode(bool)
Set the filter type.
This class is a throwable with a textual description of an error.
#define unlikely(expr)
Offer a hint (negative) to the pipeline branch predictor.
#define __D_ASSERT(x)
Assertion macro.