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

[Libguestfs] [PATCH libguestfs 22/23] generator.ml: factor out "pr_args n" function



From: Jim Meyering <meyering redhat com>

---
 src/generator.ml |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/generator.ml b/src/generator.ml
index 70ccbef..256283f 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -4712,18 +4712,21 @@ and generate_daemon_actions () =
            pr "    reply_with_error (\"%%s: daemon failed to decode procedure arguments\", \"%s\");\n" name;
            pr "    return;\n";
            pr "  }\n";
+	   let pr_args n =
+	     pr "  char *%s = args.%s;\n" n n
+	   in
            List.iter (
              function
              | Pathname n ->
-                 pr "  char *%s = args.%s;\n" n n;
+                 pr_args n;
                  pr "  ABS_PATH (%s, goto done);\n" n;
              | Device n ->
-                 pr "  char *%s = args.%s;\n" n n;
+                 pr_args n;
                  pr "  RESOLVE_DEVICE (%s, goto done);" n;
 	     | Dev_or_Path n ->
-                 pr "  char *%s = args.%s;\n" n n;
+                 pr_args n;
                  pr "  REQUIRE_ROOT_OR_RESOLVE_DEVICE (%s, goto done);" n;
-             | String n -> pr "  char *%s = args.%s;\n" n n
+             | String n -> pr_args n
              | OptString n -> pr "  %s = args.%s ? *args.%s : NULL;\n" n n n
              | StringList n ->
                  pr "  %s = realloc (args.%s.%s_val,\n" n n n;
-- 
1.6.4.337.g5420e


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