[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171123163335.19078-10-vladislav.valtchev@gmail.com>
Date: Thu, 23 Nov 2017 18:33:33 +0200
From: "Vladislav Valtchev (VMware)" <vladislav.valtchev@...il.com>
To: rostedt@...dmis.org
Cc: linux-kernel@...r.kernel.org, y.karadz@...il.com,
"Vladislav Valtchev (VMware)" <vladislav.valtchev@...il.com>
Subject: [PATCH 09/11] trace-cmd: Consolidate ARRAY_SIZE() in trace-cmd.h
Since ARRAY_SIZE() is a very useful macro, it makes sense to move it in a common
header file, in order to avoid several C files to re-define it.
Signed-off-by: Vladislav Valtchev (VMware) <vladislav.valtchev@...il.com>
---
plugin_blk.c | 1 -
trace-cmd.c | 2 --
trace-cmd.h | 2 ++
3 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/plugin_blk.c b/plugin_blk.c
index e87bebb..a1b5df0 100644
--- a/plugin_blk.c
+++ b/plugin_blk.c
@@ -30,7 +30,6 @@
#define MINORMASK ((1U << MINORBITS) - 1)
#define MAJOR(dev) ((unsigned int) ((dev) >> MINORBITS))
#define MINOR(dev) ((unsigned int) ((dev) & MINORMASK))
-#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
struct blk_data {
unsigned long long sector;
diff --git a/trace-cmd.c b/trace-cmd.c
index 7297756..6c2efa3 100644
--- a/trace-cmd.c
+++ b/trace-cmd.c
@@ -117,8 +117,6 @@ struct command commands[] = {
{"-h", trace_usage},
};
-#define ARRAY_SIZE(_a) (sizeof(_a) / sizeof(_a[0]))
-
int main (int argc, char **argv)
{
int i;
diff --git a/trace-cmd.h b/trace-cmd.h
index 485907f..3fb6aab 100644
--- a/trace-cmd.h
+++ b/trace-cmd.h
@@ -22,6 +22,8 @@
#include "event-parse.h"
+#define ARRAY_SIZE(_a) (sizeof(_a) / sizeof((_a)[0]))
+
#define TRACECMD_ERR_MSK ((unsigned long)(-1) & ~((1UL << 14) - 1))
#define TRACECMD_ISERR(ptr) ((unsigned long)(ptr) > TRACECMD_ERR_MSK)
#define TRACECMD_ERROR(ret) ((void *)((unsigned long)(ret) | TRACECMD_ERR_MSK))
--
2.14.1
Powered by blists - more mailing lists