New upstream version 24.0.1+dfsg1
This commit is contained in:
parent
b14f9eae6d
commit
5a730d6ec3
842 changed files with 42245 additions and 33385 deletions
|
|
@ -20,8 +20,8 @@
|
|||
#include "proc.h"
|
||||
|
||||
struct proc_info {
|
||||
struct decl_info func;
|
||||
void *data;
|
||||
struct decl_info func;
|
||||
void *data;
|
||||
proc_handler_proc_t callback;
|
||||
};
|
||||
|
||||
|
|
@ -46,39 +46,41 @@ void proc_handler_destroy(proc_handler_t *handler)
|
|||
{
|
||||
if (handler) {
|
||||
for (size_t i = 0; i < handler->procs.num; i++)
|
||||
proc_info_free(handler->procs.array+i);
|
||||
proc_info_free(handler->procs.array + i);
|
||||
da_free(handler->procs);
|
||||
bfree(handler);
|
||||
}
|
||||
}
|
||||
|
||||
void proc_handler_add(proc_handler_t *handler, const char *decl_string,
|
||||
proc_handler_proc_t proc, void *data)
|
||||
proc_handler_proc_t proc, void *data)
|
||||
{
|
||||
if (!handler) return;
|
||||
if (!handler)
|
||||
return;
|
||||
|
||||
struct proc_info pi;
|
||||
memset(&pi, 0, sizeof(struct proc_info));
|
||||
|
||||
if (!parse_decl_string(&pi.func, decl_string)) {
|
||||
blog(LOG_ERROR, "Function declaration invalid: %s",
|
||||
decl_string);
|
||||
decl_string);
|
||||
return;
|
||||
}
|
||||
|
||||
pi.callback = proc;
|
||||
pi.data = data;
|
||||
pi.data = data;
|
||||
|
||||
da_push_back(handler->procs, &pi);
|
||||
}
|
||||
|
||||
bool proc_handler_call(proc_handler_t *handler, const char *name,
|
||||
calldata_t *params)
|
||||
calldata_t *params)
|
||||
{
|
||||
if (!handler) return false;
|
||||
if (!handler)
|
||||
return false;
|
||||
|
||||
for (size_t i = 0; i < handler->procs.num; i++) {
|
||||
struct proc_info *info = handler->procs.array+i;
|
||||
struct proc_info *info = handler->procs.array + i;
|
||||
|
||||
if (strcmp(info->func.name, name) == 0) {
|
||||
info->callback(info->data, params);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue