Files
palladum-lightning/common/autodata.h
Rusty Russell f6a4e79420 global: remove unnecessary includes from headers.
Each header should only include the other headers it needs to compile;
`devtools/reduce-includes.sh */*.h` does this.  The C files then need
additional includes if they don't compile.

And remove the entirely useless wire/onion_wire.h, which only serves to include wire/onion_wiregen.h.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-10-23 06:44:04 +10:30

28 lines
882 B
C

#ifndef LIGHTNING_COMMON_AUTODATA_H
#define LIGHTNING_COMMON_AUTODATA_H
#include "config.h"
#include <stddef.h>
#define AUTODATA_TYPE(name, type) \
static inline void register_autotype_##name(const type *t) { \
autodata_register_(#name, t); \
} \
typedef type autodata_##name##_
/* This uses GCC's constructor attribute */
#define AUTODATA(name, ptr) \
static __attribute__((constructor)) NEEDED \
void CPPMAGIC_GLUE2(register_one_##name,__COUNTER__)(void) { \
register_autotype_##name(ptr); \
}
#define autodata_get(name, nump) \
((autodata_##name##_ **)autodata_get_(#name, (nump)))
void autodata_register_(const char *typename, const void *ptr);
void *autodata_get_(const char *typename, size_t *nump);
/* Call on shutdown to keep valgrind leak detection happy. */
void autodata_cleanup(void);
#endif /* LIGHTNING_COMMON_AUTODATA_H */