richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
ff6046
From 4c6c21669483a38cf2a387784a3881b3a47139a3 Mon Sep 17 00:00:00 2001
ff6046
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
ff6046
Date: Sat, 7 Jul 2018 19:08:52 +0200
ff6046
Subject: [PATCH] test-bus-marshal: use cescaping instead of hexmem
ff6046
ff6046
It is easier to see the contents this way by eye.
ff6046
ff6046
(cherry picked from commit 3ddf3d439463ab2c76391a4d22b54166be2dbe94)
ff6046
ff6046
Resolves: #1696224
ff6046
---
ff6046
 src/libsystemd/sd-bus/test-bus-marshal.c | 8 +++-----
ff6046
 1 file changed, 3 insertions(+), 5 deletions(-)
ff6046
ff6046
diff --git a/src/libsystemd/sd-bus/test-bus-marshal.c b/src/libsystemd/sd-bus/test-bus-marshal.c
ff6046
index c647f0ff12..f007168ca6 100644
ff6046
--- a/src/libsystemd/sd-bus/test-bus-marshal.c
ff6046
+++ b/src/libsystemd/sd-bus/test-bus-marshal.c
ff6046
@@ -20,8 +20,8 @@
ff6046
 #include "bus-label.h"
ff6046
 #include "bus-message.h"
ff6046
 #include "bus-util.h"
ff6046
+#include "escape.h"
ff6046
 #include "fd-util.h"
ff6046
-#include "hexdecoct.h"
ff6046
 #include "log.h"
ff6046
 #include "util.h"
ff6046
 
ff6046
@@ -112,7 +112,7 @@ int main(int argc, char *argv[]) {
ff6046
         uint8_t u, v;
ff6046
         void *buffer = NULL;
ff6046
         size_t sz;
ff6046
-        char *h;
ff6046
+        _cleanup_free_ char *h = NULL;
ff6046
         const int32_t integer_array[] = { -1, -2, 0, 1, 2 }, *return_array;
ff6046
         char *s;
ff6046
         _cleanup_free_ char *first = NULL, *second = NULL, *third = NULL;
ff6046
@@ -194,11 +194,9 @@ int main(int argc, char *argv[]) {
ff6046
         r = bus_message_get_blob(m, &buffer, &sz);
ff6046
         assert_se(r >= 0);
ff6046
 
ff6046
-        h = hexmem(buffer, sz);
ff6046
+        h = cescape_length(buffer, sz);
ff6046
         assert_se(h);
ff6046
-
ff6046
         log_info("message size = %zu, contents =\n%s", sz, h);
ff6046
-        free(h);
ff6046
 
ff6046
 #if HAVE_GLIB
ff6046
 #ifndef __SANITIZE_ADDRESS__