Dispatcher fixes: user callback arg, changing handler to NULL
This commit is contained in:
parent
fccf315235
commit
a74fbdecdb
4 changed files with 5 additions and 14 deletions
|
|
@ -489,7 +489,7 @@ clixon_pagination_cb_register(clicon_handle h,
|
||||||
void *arg)
|
void *arg)
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
dispatcher_definition x = {xpath, fn};
|
dispatcher_definition x = {xpath, fn, arg};
|
||||||
dispatcher_entry_t *htable = NULL;
|
dispatcher_entry_t *htable = NULL;
|
||||||
|
|
||||||
clicon_ptr_get(h, "pagination-entries", (void**)&htable);
|
clicon_ptr_get(h, "pagination-entries", (void**)&htable);
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ typedef int (*handler_function)(void *handle, char *path, void *userargs, void *
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *dd_path;
|
char *dd_path;
|
||||||
handler_function dd_handler;
|
handler_function dd_handler;
|
||||||
|
void *dd_arg;
|
||||||
} dispatcher_definition;
|
} dispatcher_definition;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -366,7 +366,6 @@ dispatcher_register_handler(dispatcher_entry_t **root,
|
||||||
|
|
||||||
if (*x->dd_path != '/') {
|
if (*x->dd_path != '/') {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
// fprintf(stderr, "%s: part '%s' must start at root\n", __func__, x->dd_path);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -394,17 +393,8 @@ dispatcher_register_handler(dispatcher_entry_t **root,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* when we get here, ptr points at last entry added */
|
/* when we get here, ptr points at last entry added */
|
||||||
if (x->dd_handler != NULL) {
|
ptr->handler = x->dd_handler;
|
||||||
/*
|
ptr->arg = x->dd_arg;
|
||||||
* we're adding/changing a handler
|
|
||||||
* you could make this an error optionally
|
|
||||||
*/
|
|
||||||
if (ptr->handler != NULL) {
|
|
||||||
// fprintf(stderr, "%s: warning: replacing existing handler: (%s) %p -> %p\n", __func__,
|
|
||||||
// ptr->node_name, ptr->handler, x->dd_handler);
|
|
||||||
}
|
|
||||||
ptr->handler = x->dd_handler;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* clean up */
|
/* clean up */
|
||||||
split_path_free(split_path_list, split_path_len);
|
split_path_free(split_path_list, split_path_len);
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ testrun_stop
|
||||||
|
|
||||||
#----------------------------
|
#----------------------------
|
||||||
|
|
||||||
echo "...skipped: Must run interactvely"
|
echo "...skipped: Must run interactively"
|
||||||
if false; then
|
if false; then
|
||||||
testrun_start "/es:audit-logs/es:audit-log"
|
testrun_start "/es:audit-logs/es:audit-log"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue