mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 09:08:20 +00:00
add comparator functor to the info maps of readerbackend and readerwriteend.
This is required, because after the recent changes the info map containst a char* as key. Without the comparator the map will compare the char addresses for all operations - which is not really what we want.
This commit is contained in:
parent
3f21764d00
commit
13952154a1
3 changed files with 13 additions and 2 deletions
11
src/util.h
11
src/util.h
|
@ -345,4 +345,15 @@ inline int safe_vsnprintf(char* str, size_t size, const char* format, va_list al
|
|||
extern void get_memory_usage(unsigned int* total,
|
||||
unsigned int* malloced);
|
||||
|
||||
// class to be used as a third argument for stl maps to be able to use
|
||||
// char*'s as keys. Otherwise the pointer values will be compared instead
|
||||
// of the actual string values.
|
||||
struct CompareString
|
||||
{
|
||||
bool operator()(char const *a, char const *b) const
|
||||
{
|
||||
return std::strcmp(a, b) < 0;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue