mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Add ifdef'd implementation of setvbuf to zeek::util
This commit is contained in:
parent
71731ffcb1
commit
f2a3e23dfa
2 changed files with 14 additions and 0 deletions
12
src/util.cc
12
src/util.cc
|
@ -996,6 +996,18 @@ void set_thread_name(const char* name, pthread_t tid)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int setvbuf(FILE* stream, char* buf, int type, size_t size)
|
||||||
|
{
|
||||||
|
#ifndef _MSC_VER
|
||||||
|
return ::setvbuf(stream, NULL, type, size);
|
||||||
|
#else
|
||||||
|
// TODO: this turns off buffering altogether because Windows wants us to pass a valid
|
||||||
|
// buffer and length if we're going to pass one of the other modes. We need to
|
||||||
|
// investigate the performance ramifications of this.
|
||||||
|
return ::setvbuf(stream, NULL, _IONBF, 0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
TEST_CASE("util get_unescaped_string")
|
TEST_CASE("util get_unescaped_string")
|
||||||
|
|
|
@ -305,6 +305,8 @@ double parse_rotate_base_time(const char* rotate_base_time);
|
||||||
// This function is thread-safe.
|
// This function is thread-safe.
|
||||||
double calc_next_rotate(double current, double rotate_interval, double base);
|
double calc_next_rotate(double current, double rotate_interval, double base);
|
||||||
|
|
||||||
|
int setvbuf(FILE* stream, char* buf, int type, size_t size);
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
template <class T> void delete_each(T* t)
|
template <class T> void delete_each(T* t)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue