From 752147a1da4b1c2381ecba301627427c82b8d8a4 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 11 Aug 2009 11:56:33 +0200 Subject: [PATCH] generator.ml: emit "const char *" for Device and String params * 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 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/generator.ml b/src/generator.ml index e3453a3..e27d011 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -4725,11 +4725,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 @@ -6278,8 +6276,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 @@ -6819,6 +6816,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.8.3.1