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:
Ian Gulliver
2026-04-19 00:32:13 -07:00
parent 40f7fb5941
commit 32044a5cbd
11 changed files with 378 additions and 285 deletions

View File

@@ -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;