mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-03-23 04:15:18 +00:00
shorten section names (and precursors) to keep in the 16 char limit
of the O-MACH assembler on OSX.
This commit is contained in:
parent
c2a47c7960
commit
dab244d92f
@ -237,7 +237,7 @@ int parseCommandLine(struct cli_context *context, const char *argv0, int argc, c
|
||||
IN();
|
||||
|
||||
struct cli_parsed parsed;
|
||||
int result = cli_parse(argc, args, __start_commands, __stop_commands, &parsed);
|
||||
int result = cli_parse(argc, args, SECTION_START(commands), SECTION_END(commands), &parsed);
|
||||
switch (result) {
|
||||
case 0:
|
||||
// Do not run the command if the configuration does not load ok.
|
||||
|
@ -41,10 +41,9 @@ struct cli_context;
|
||||
.description = HELP \
|
||||
}
|
||||
|
||||
extern struct cli_schema __start_commands[] SECTION_START(commands);
|
||||
extern struct cli_schema __stop_commands[] SECTION_STOP(commands);
|
||||
DECLARE_SECTION(struct cli_schema, commands);
|
||||
|
||||
#define CMD_COUNT (__stop_commands - __start_commands)
|
||||
#define CMD_COUNT (SECTION_START(commands) - SECTION_END(commands))
|
||||
|
||||
void cli_flush(struct cli_context *context);
|
||||
int cli_delim(struct cli_context *context, const char *opt);
|
||||
|
2
httpd.c
2
httpd.c
@ -341,7 +341,7 @@ static void trigger_rhizome_bundle_added(rhizome_manifest *m)
|
||||
}
|
||||
}
|
||||
|
||||
DEFINE_TRIGGER(rhizome_bundle_added, trigger_rhizome_bundle_added)
|
||||
DEFINE_TRIGGER(bundle_add, trigger_rhizome_bundle_added)
|
||||
|
||||
int is_http_header_complete(const char *buf, size_t len, size_t read_since_last_call)
|
||||
{
|
||||
|
@ -925,6 +925,6 @@ DECLARE_ALARM(rhizome_fetch_status);
|
||||
|
||||
/* Rhizome triggers */
|
||||
|
||||
DECLARE_TRIGGER(rhizome_bundle_added, rhizome_manifest*)
|
||||
DECLARE_TRIGGER(bundle_add, rhizome_manifest*)
|
||||
|
||||
#endif //__SERVAL_DNA__RHIZOME_H
|
||||
|
@ -1351,7 +1351,7 @@ int rhizome_store_manifest(rhizome_manifest *m)
|
||||
alloca_tohex_rhizome_bid_t(m->cryptoSignPublic),
|
||||
m->version
|
||||
);
|
||||
CALL_TRIGGER(rhizome_bundle_added, m);
|
||||
CALL_TRIGGER(bundle_add, m);
|
||||
monitor_announce_bundle(m);
|
||||
if (serverMode){
|
||||
time_ms_t now = gettime_ms();
|
||||
@ -1376,7 +1376,7 @@ static void trigger_rhizome_bundle_added_debug(rhizome_manifest *m)
|
||||
);
|
||||
}
|
||||
|
||||
DEFINE_TRIGGER(rhizome_bundle_added, trigger_rhizome_bundle_added_debug)
|
||||
DEFINE_TRIGGER(bundle_add, trigger_rhizome_bundle_added_debug)
|
||||
|
||||
/* The cursor struct must be zerofilled and the query parameters optionally filled in prior to
|
||||
* calling this function.
|
||||
|
17
section.h
17
section.h
@ -22,16 +22,23 @@
|
||||
/* Macros for creating named linkage sections.
|
||||
*/
|
||||
|
||||
#define SECTION_START(X) __start_##X
|
||||
#define SECTION_END(X) __stop_##X
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define _SECTION_ATTRIBUTE(X) section("__DATA,__" #X )
|
||||
#define SECTION_START(X) __asm("section$start$__DATA$__" #X)
|
||||
#define SECTION_STOP(X) __asm("section$end$__DATA$__" #X)
|
||||
|
||||
#define _SECTION_ATTRIBUTE(X) section("__DATA,__"#X)
|
||||
#define DECLARE_SECTION(TYPE, X) \
|
||||
extern TYPE SECTION_START(X)[] __asm("section$start$__DATA$__" #X);\
|
||||
extern TYPE SECTION_END(X)[] __asm("section$end$__DATA$__" #X)
|
||||
#else
|
||||
#define _SECTION_ATTRIBUTE(X) section(#X)
|
||||
#define SECTION_START(X)
|
||||
#define SECTION_STOP(X)
|
||||
#define DECLARE_SECTION(TYPE, X) \
|
||||
extern TYPE SECTION_START(X)[];\
|
||||
extern TYPE SECTION_END(X)[]
|
||||
#endif
|
||||
|
||||
|
||||
#define IN_SECTION(name) __attribute__((used,aligned(sizeof(void *)),_SECTION_ATTRIBUTE(name)))
|
||||
|
||||
#endif // __SERVAL_DNA__SECTION_H
|
||||
|
@ -26,16 +26,15 @@
|
||||
|
||||
#define DECLARE_TRIGGER(TRIG, ...) \
|
||||
typedef void TRIGGER_FUNC_##TRIG (__VA_ARGS__); \
|
||||
extern TRIGGER_FUNC_##TRIG *__start___trigger_section_##TRIG[] SECTION_START(trigger_##TRIG); \
|
||||
extern TRIGGER_FUNC_##TRIG *__stop___trigger_section_##TRIG[] SECTION_STOP(trigger_##TRIG);
|
||||
DECLARE_SECTION(TRIGGER_FUNC_##TRIG *, tr_##TRIG);
|
||||
|
||||
#define DEFINE_TRIGGER(TRIG, FUNC) \
|
||||
TRIGGER_FUNC_##TRIG * __trigger_##FUNC IN_SECTION(__trigger_section_##TRIG) = FUNC;
|
||||
TRIGGER_FUNC_##TRIG * __trigger_##FUNC IN_SECTION(tr_##TRIG) = FUNC;
|
||||
|
||||
#define CALL_TRIGGER(TRIG, ...) \
|
||||
do { \
|
||||
TRIGGER_FUNC_##TRIG **__trig; \
|
||||
for (__trig = __start___trigger_section_##TRIG; __trig < __stop___trigger_section_##TRIG; ++__trig) \
|
||||
for (__trig = SECTION_START(tr_##TRIG); __trig < SECTION_END(tr_##TRIG); ++__trig) \
|
||||
(**__trig)(__VA_ARGS__); \
|
||||
} while (0);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user