diff src/c/urweb.c @ 2001:16f5f136a807

uw_register_transactional() can return error codes
author Adam Chlipala <adam@chlipala.net>
date Thu, 17 Apr 2014 17:41:24 -0400
parents bddee3af70c4
children 93ff76058825
line wrap: on
line diff
--- a/src/c/urweb.c	Tue Apr 15 19:12:49 2014 -0400
+++ b/src/c/urweb.c	Thu Apr 17 17:41:24 2014 -0400
@@ -3469,11 +3469,12 @@
 
 size_t uw_transactionals_max = SIZE_MAX;
 
-void uw_register_transactional(uw_context ctx, void *data, uw_callback commit, uw_callback rollback,
+int uw_register_transactional(uw_context ctx, void *data, uw_callback commit, uw_callback rollback,
                                uw_callback_with_retry free) {
   if (ctx->used_transactionals >= ctx->n_transactionals) {
     if (ctx->used_transactionals+1 > uw_transactionals_max)
-      uw_error(ctx, FATAL, "Exceeded limit on number of transactionals");
+      // Exceeded limit on number of transactionals.
+      return -1;
     ctx->transactionals = realloc(ctx->transactionals, sizeof(transactional) * (ctx->used_transactionals+1));
     ++ctx->n_transactionals;
   }
@@ -3482,6 +3483,8 @@
   ctx->transactionals[ctx->used_transactionals].commit = commit;
   ctx->transactionals[ctx->used_transactionals].rollback = rollback;
   ctx->transactionals[ctx->used_transactionals++].free = free;
+
+  return 0;
 }