From aa67cc399b92652f9431868922cf1e4f03cc3eae Mon Sep 17 00:00:00 2001 From: Keith Busch Date: Mon, 1 Jun 2020 07:09:59 -0700 Subject: [PATCH] use common whitespace strip Signed-off-by: Keith Busch --- libnvme | 2 +- util/user-types.h | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/libnvme b/libnvme index 5fca249..af59d49 160000 --- a/libnvme +++ b/libnvme @@ -1 +1 @@ -Subproject commit 5fca2499aa7342ab7b57067982e54822409c8561 +Subproject commit af59d4979e10b8378fbeb76efe73917464ca374d diff --git a/util/user-types.h b/util/user-types.h index 4d18269..cbd0b02 100644 --- a/util/user-types.h +++ b/util/user-types.h @@ -370,12 +370,6 @@ static inline void nvme_json_add_hex_le16(struct json_object *j, nvme_json_add_hex(j, n, le16_to_cpu(v), flags); } -static void chomp(char *s, int l) -{ - while (l && (s[l] == '\0' || s[l] == ' ')) - s[l--] = '\0'; -} - static inline void nvme_json_add_str_flags(struct json_object *j, const char *n, const char *v, int l, unsigned long flags) { @@ -387,7 +381,7 @@ static inline void nvme_json_add_str_flags(struct json_object *j, const char *n, } snprintf(buf, sizeof(buf), "%-.*s", l, v); - chomp(buf, l); + nvme_chomp(buf, l); nvme_json_add_str(j, n, buf, flags); } -- 2.50.1