summaryrefslogtreecommitdiff
path: root/monkey/dispatch.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-10-26 12:42:53 +0000
committerVincent Sanders <vince@kyllikki.org>2014-10-26 12:42:53 +0000
commit14e282948996f75e87a14ab90f4b3ed54d9d6ad7 (patch)
tree7f78ad2cc5c9965f6a329c81c025d1c240eb4f87 /monkey/dispatch.c
parenta913af5cf54400b441f3b1fbfc5d508cf85fea43 (diff)
downloadnetsurf-14e282948996f75e87a14ab90f4b3ed54d9d6ad7.tar.gz
netsurf-14e282948996f75e87a14ab90f4b3ed54d9d6ad7.tar.bz2
remove the die API from the core.
The die() API for abnormal termination does not belong within the core of netsurf and instead errors are propogated back to the callers. This is the final part of this change and the API is now only used within some parts of the frontends
Diffstat (limited to 'monkey/dispatch.c')
-rw-r--r--monkey/dispatch.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/monkey/dispatch.c b/monkey/dispatch.c
index 9d022560c..c70070d4e 100644
--- a/monkey/dispatch.c
+++ b/monkey/dispatch.c
@@ -35,15 +35,18 @@ typedef struct cmdhandler {
static monkey_cmdhandler_t *handler_ring = NULL;
-void
+nserror
monkey_register_handler(const char *cmd, handle_command_fn fn)
{
monkey_cmdhandler_t *ret = calloc(sizeof(*ret), 1);
- if (ret == NULL)
- die("Unable to allocate handler");
+ if (ret == NULL) {
+ LOG(("Unable to allocate handler"));
+ return NSERROR_NOMEM;
+ }
ret->cmd = strdup(cmd);
ret->fn = fn;
RING_INSERT(handler_ring, ret);
+ return NSERROR_OK;
}
void