aboutgitcodelistschat:MatrixIRC
diff options
context:
space:
mode:
-rw-r--r--actions.c10
-rw-r--r--gluten.h11
2 files changed, 19 insertions, 2 deletions
diff --git a/actions.c b/actions.c
index bb31732..0366916 100644
--- a/actions.c
+++ b/actions.c
@@ -198,7 +198,15 @@ int do_actions(struct action actions[], unsigned int n_actions, int pid,
resp.id = id;
resp.flags = 0;
resp.error = 0;
- resp.val = actions[i].ret.value;
+ if (actions[i].ret.type == IMMEDIATE) {
+ resp.val = actions[i].ret.value;
+ } else if (actions[i].ret.value_p != NULL) {
+ resp.val = *(actions[i].ret.value_p);
+ } else {
+ fprintf(stderr, "empty reference for the return value");
+ return -1;
+ }
+
if (send_target(&resp, notifyfd) == -1)
return -1;
break;
diff --git a/gluten.h b/gluten.h
index c6cac3c..ae5e212 100644
--- a/gluten.h
+++ b/gluten.h
@@ -52,6 +52,11 @@ enum action_type {
A_RETURN,
};
+enum value_type {
+ IMMEDIATE,
+ REFERENCE,
+};
+
struct act_call {
long nr;
void *args[6];
@@ -67,7 +72,11 @@ struct act_continue {
};
struct act_return {
- int64_t value;
+ enum value_type type;
+ union {
+ int64_t value;
+ int64_t *value_p;
+ };
};
struct act_inject {