- Env::evaluate
- Environment variable names in Windows are case-insensitive, so in
the Windows build we use strcasecmp to ignore case when matching
variables in transaction->m_variableEnvs.
- If the variable is found, we use the expected variable name to
create the VariableValue instance, as further rule processing will
look for the variable using case-sensitive comparisons.
- This code is not limited to Windows to avoid another #ifdef block
because for other platforms, because the env variable names are
case-sensitive the value from either x.first and m_name will be the
same.
- In Windows build, avoid redefining environ, already defined by
including stdlib.h.
- Use after free issue detected with Address Sanitizer while running
the reading_logs_with_offset example.
- Keeps reference to last element in vars vector with vars.back(). Then
it removes the element from vars calling vars.pop_back() which
invalidates the reference, but it's accessed later in the function.
- RuleWithActions::evaluate(Transaction *transaction)
- Removed temporary rm local variable used to immediately create
std::shared_ptr<RuleMessage>.
- Leverage std::make_shared & auto to simplify code.
- expandEnv on Windows uses POCO C++ Libraries implementation of Glob
- Paths of matched files are adjusted to preserve UNIX path
separators for consistency with the rest of the code.
- Minor change to code shared with other platforms that removes
allocation of std::ifstream on the heap to check whether the file can
be opened, which can be done with local stack variable that closes
the file when out of scope.
- createDir uses _mkdir on Windows, which doesn't support configuring
the new directory's mode.
- added public domain implementation of clock_gettime for clock_id
CLOCK_PROCESS_CPUTIME_ID from mingw-w64's winpthreads to support
cpu_seconds on Windows.
- Updated included headers to support compilation on Windows (using
Visual C++)
- Updated included headers to support compilation on Windows (using
Visual C++)
- Minor change to use C++ default (zero) initialization instead of
calling memset.
- most of posix related functions and constants in unistd.h can be
found in io.h in Visual C++
- introduced src/compat/msvc.h to adjust for compiler differences (and
avoid updating code with #ifdef blocks for Windows support)
- removed some included headers that are not needed (both on Unix and
Windows builds)