diff options
author | Jim Meyering <meyering@redhat.com> | 2009-07-03 14:17:23 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2009-07-03 17:04:21 +0200 |
commit | 5f9cb51f11879ece8b921d833850505d7e57d339 (patch) | |
tree | 30c58125086edbd4330d8fd1640c01b8b9023aec | |
parent | 0cc0e9e39f816c3f6174c74bf4cb136a5b4e13ea (diff) | |
download | libguestfs-5f9cb51f11879ece8b921d833850505d7e57d339.tar.gz libguestfs-5f9cb51f11879ece8b921d833850505d7e57d339.tar.xz libguestfs-5f9cb51f11879ece8b921d833850505d7e57d339.zip |
generate slightly more "const-correct" code
* src/generator.ml: Add a few "const" attributes.
-rwxr-xr-x | src/generator.ml | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/generator.ml b/src/generator.ml index c65e717a..5c9e1c34 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -4686,7 +4686,7 @@ and generate_one_test_body name i test_name init test = List.iter (generate_test_command_call test_name) seq | TestOutput (seq, expected) -> pr " /* TestOutput for %s (%d) */\n" name i; - pr " char expected[] = \"%s\";\n" (c_quote expected); + pr " const char *expected = \"%s\";\n" (c_quote expected); let seq, last = get_seq_last seq in let test () = pr " if (strcmp (r, expected) != 0) {\n"; @@ -4708,7 +4708,7 @@ and generate_one_test_body name i test_name init test = pr " return -1;\n"; pr " }\n"; pr " {\n"; - pr " char expected[] = \"%s\";\n" (c_quote str); + pr " const char *expected = \"%s\";\n" (c_quote str); pr " if (strcmp (r[%d], expected) != 0) {\n" i; pr " fprintf (stderr, \"%s: expected \\\"%%s\\\" but got \\\"%%s\\\"\\n\", expected, r[%d]);\n" test_name i; pr " return -1;\n"; @@ -4736,7 +4736,7 @@ and generate_one_test_body name i test_name init test = pr " return -1;\n"; pr " }\n"; pr " {\n"; - pr " char expected[] = \"%s\";\n" (c_quote str); + pr " const char *expected = \"%s\";\n" (c_quote str); pr " r[%d][5] = 's';\n" i; pr " if (strcmp (r[%d], expected) != 0) {\n" i; pr " fprintf (stderr, \"%s: expected \\\"%%s\\\" but got \\\"%%s\\\"\\n\", expected, r[%d]);\n" test_name i; @@ -4882,7 +4882,7 @@ and generate_test_command_call ?(expect_error = false) ?test test_name cmd = | OptString n, "NULL" -> () | String n, arg | OptString n, arg -> - pr " char %s[] = \"%s\";\n" n (c_quote arg); + pr " const char *%s = \"%s\";\n" n (c_quote arg); | Int _, _ | Bool _, _ | FileIn _, _ | FileOut _, _ -> () @@ -4890,9 +4890,9 @@ and generate_test_command_call ?(expect_error = false) ?test test_name cmd = let strs = string_split " " arg in iteri ( fun i str -> - pr " char %s_%d[] = \"%s\";\n" n i (c_quote str); + pr " const char *%s_%d = \"%s\";\n" n i (c_quote str); ) strs; - pr " char *%s[] = {\n" n; + pr " const char *%s[] = {\n" n; iteri ( fun i _ -> pr " %s_%d,\n" n i ) strs; |