Re: [rt-tests 3/4] rt-utils: Move ARRAY_SIZE to common header

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Tue, 1 Sep 2020, Daniel Wagner wrote:

> Move the ARRAY_SIZE macro to a common header to avoid code
> duplication.
> 
> Signed-off-by: Daniel Wagner <dwagner@xxxxxxx>
> ---
>  src/cyclictest/cyclictest.c | 2 --
>  src/include/rt-utils.h      | 2 ++
>  src/signaltest/signaltest.c | 2 --
>  3 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> index ae1d64a46b21..b41d42f13f24 100644
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -49,8 +49,6 @@
>  #define SCHED_NORMAL SCHED_OTHER
>  #endif
>  
> -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
> -
>  #define sigev_notify_thread_id _sigev_un._tid
>  
>  #ifdef __UCLIBC__
> diff --git a/src/include/rt-utils.h b/src/include/rt-utils.h
> index f7b98d9605a0..4ed1cbc53ece 100644
> --- a/src/include/rt-utils.h
> +++ b/src/include/rt-utils.h
> @@ -8,6 +8,8 @@
>  #define STR(x) _STR(x)
>  #define MAX_PATH 256
>  
> +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
> +
>  int check_privs(void);
>  char *get_debugfileprefix(void);
>  int mount_debugfs(char *);
> diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
> index 49d42ff20b6f..0bf075456ab6 100644
> --- a/src/signaltest/signaltest.c
> +++ b/src/signaltest/signaltest.c
> @@ -32,8 +32,6 @@
>  #include "error.h"
>  #include "rt-utils.h"
>  
> -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
> -
>  /* Must be power of 2 ! */
>  #define VALBUF_SIZE		16384
>  
> -- 
> 2.28.0
> 
> 
Signed-off-by: John Kacur <jkacur@xxxxxxxxxx>



[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux