mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2025-02-27 12:47:17 +02:00

See https://github.com/NixOS/nix/pull/8699#discussion_r1554312181 Casting a function pointer to `void*` is undefined behavior in the C spec, since there are platforms with different sizes for these two kinds of pointers. A safe alternative might be `void (*callback)()`
10 lines
185 B
C++
10 lines
185 B
C++
#include "string_callback.hh"
|
|
|
|
namespace nix::testing {
|
|
|
|
void observe_string_cb(const char * start, unsigned int n, std::string * user_data)
|
|
{
|
|
*user_data = std::string(start);
|
|
}
|
|
|
|
}
|