Eliminate std::function: fn-pointer callbacks, per-test test_state structs, udp.cpp with link-time udp::client::handler, udp::address
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
#include <cstdarg>
|
||||
#include <cstdio>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
@@ -29,7 +28,8 @@ inline void dlogf(const char* fmt, ...) {
|
||||
dlog(buf);
|
||||
}
|
||||
|
||||
inline void dlog_if_slow(std::string_view label, uint32_t threshold_us, std::function<void()> fn) {
|
||||
template <typename F>
|
||||
inline void dlog_if_slow(std::string_view label, uint32_t threshold_us, F&& fn) {
|
||||
uint32_t t0 = time_us_32();
|
||||
fn();
|
||||
uint32_t elapsed = time_us_32() - t0;
|
||||
|
||||
Reference in New Issue
Block a user