erlang: Rename 'message' to something less generic.

It's not possible to define an action which takes a parameter called
'message' because the Erlang bindings use that as the name of an
internal variable.  Solve this by renaming the Erlang internal
variable.

Fixes commit 84763d7fca.
This commit is contained in:
Richard W.M. Jones
2017-03-02 11:35:38 +00:00
parent da6ea89371
commit 843d61c2d4

View File

@@ -192,7 +192,7 @@ and generate_erlang_actions_h () =
extern guestfs_h *g;
extern ETERM *dispatch (ETERM *message);
extern ETERM *dispatch (ETERM *args_tuple);
extern int atom_equals (ETERM *atom, const char *name);
extern ETERM *make_error (const char *funname);
extern ETERM *unknown_optarg (const char *funname, ETERM *optargname);
@@ -205,7 +205,7 @@ extern int get_bool (ETERM *term);
extern int get_int (ETERM *term);
extern int64_t get_int64 (ETERM *term);
#define ARG(i) (ERL_TUPLE_ELEMENT(message,(i)+1))
#define ARG(i) (ERL_TUPLE_ELEMENT(args_tuple,(i)+1))
";
@@ -229,7 +229,7 @@ extern int64_t get_int64 (ETERM *term);
List.iter (
fun { name = name } ->
pr "ETERM *run_%s (ETERM *message);\n" name
pr "ETERM *run_%s (ETERM *args_tuple);\n" name
) (actions |> external_functions |> sort);
pr "\n";
@@ -355,7 +355,7 @@ instead of erl_interface.
c_function = c_function; c_optarg_prefix = c_optarg_prefix } ->
pr "\n";
pr "ETERM *\n";
pr "run_%s (ETERM *message)\n" name;
pr "run_%s (ETERM *args_tuple)\n" name;
pr "{\n";
iteri (
@@ -546,11 +546,11 @@ instead of erl_interface.
#include \"actions.h\"
ETERM *
dispatch (ETERM *message)
dispatch (ETERM *args_tuple)
{
ETERM *fun;
fun = ERL_TUPLE_ELEMENT (message, 0);
fun = ERL_TUPLE_ELEMENT (args_tuple, 0);
/* XXX We should use gperf here. */
";
@@ -558,7 +558,7 @@ dispatch (ETERM *message)
List.iter (
fun { name = name; style = ret, args, optargs } ->
pr "if (atom_equals (fun, \"%s\"))\n" name;
pr " return run_%s (message);\n" name;
pr " return run_%s (args_tuple);\n" name;
pr " else ";
) (actions |> external_functions |> sort);