On 08/18/2017 06:15 PM, Eric Blake wrote:
There was only one caller; it's easier to inline things.

What's the benefit of this change? Having a separate function ease code reading. You might add the 'inline' qualifier but the compiler is smart enough to inline it.

Instead of this change I'd inline it and remove the return value, having a void function initializing s->big_endian. Matter of taste I think :)


Signed-off-by: Eric Blake <ebl...@redhat.com>
---
  tests/libqtest.c | 22 ++++++----------------
  1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/tests/libqtest.c b/tests/libqtest.c
index 5d16351e24..b6dd26e54a 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -244,20 +244,6 @@ redo:
      return words;
  }

-static int qtest_query_target_endianness(QTestState *s)
-{
-    gchar **args;
-    int big_endian;
-
-    qtest_sendf(s, "endianness\n");
-    args = qtest_rsp(s, 1);
-    g_assert(strcmp(args[1], "big") == 0 || strcmp(args[1], "little") == 0);
-    big_endian = strcmp(args[1], "big") == 0;
-    g_strfreev(args);
-
-    return big_endian;
-}
-
  static void cleanup_sigabrt_handler(void)
  {
      sigaction(SIGABRT, &sigact_old, NULL);
@@ -288,6 +274,7 @@ QTestState *qtest_init_without_qmp_handshake(const char 
*extra_args)
      gchar *qmp_socket_path;
      gchar *command;
      const char *qemu_binary;
+    gchar **args;

      qemu_binary = getenv("QTEST_QEMU_BINARY");
      if (!qemu_binary) {
@@ -351,8 +338,11 @@ QTestState *qtest_init_without_qmp_handshake(const char 
*extra_args)
      }

      /* ask endianness of the target */
-
-    s->big_endian = qtest_query_target_endianness(s);
+    qtest_sendf(s, "endianness\n");
+    args = qtest_rsp(s, 1);
+    g_assert(strcmp(args[1], "big") == 0 || strcmp(args[1], "little") == 0);
+    s->big_endian = strcmp(args[1], "big") == 0;
+    g_strfreev(args);

      return s;
  }


Reply via email to