[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH libguestfs 14/23] generator.ml: emit "const char *" for Device and String params



From: Jim Meyering <meyering redhat com>

* src/generator.ml: Emit "const char *", not "char *" for Device and
String params, now that the non-const code is hoisted into the calling
code in stubs.c.
---
 src/generator.ml |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/generator.ml b/src/generator.ml
index 0c9cf36..30fe41c 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -4680,11 +4680,9 @@ and generate_daemon_actions () =
            pr "  struct guestfs_%s_args args;\n" name;
            List.iter (
              function
-               (* Note we allow the string to be writable, in order to
-                * allow device name translation.  This is safe because
-                * we can modify the string (passed from RPC).
-                *)
-             | Device n | String n
+	     (* FIXME: eventually, make String "const", too *)
+             | Device n -> pr "  const char *%s;\n" n
+             | String n
              | OptString n -> pr "  char *%s;\n" n
              | StringList n -> pr "  char **%s;\n" n
              | Bool n -> pr "  int %s;\n" n
@@ -6233,8 +6231,7 @@ and generate_prototype ?(extern = true) ?(static = false) ?(semicolon = true)
       | String n
       | OptString n ->
           next ();
-          if not in_daemon then pr "const char *%s" n
-          else pr "char *%s" n
+          pr "const char *%s" n
       | StringList n ->
           next ();
           if not in_daemon then pr "char * const* const %s" n
@@ -6774,6 +6771,7 @@ DESTROY (g)
       iteri (
         fun i ->
           function
+	  (* FIXME: ? *)
           | Device n | String n | FileIn n | FileOut n -> pr "      char *%s;\n" n
           | OptString n ->
               (* http://www.perlmonks.org/?node_id=554277
-- 
1.6.4.337.g5420e


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]