From 94aa63f79652383738ff55c5f0617f5f9ace213f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Dejean?= Date: Thu, 12 Mar 2015 23:25:24 +0100 Subject: [PATCH] Add an assertion to ensure that GLIBTOP_SYSDEPS_* fit in an unsigned long. --- include/glibtop/sysdeps.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/glibtop/sysdeps.h b/include/glibtop/sysdeps.h index 3fb308e9..61006a0a 100644 --- a/include/glibtop/sysdeps.h +++ b/include/glibtop/sysdeps.h @@ -56,6 +56,9 @@ G_BEGIN_DECLS #define GLIBTOP_MAX_SYSDEPS 27 +/* The 'features' args to glibtop_init_* is an unsigned long */ +G_STATIC_ASSERT((1UL << (GLIBTOP_MAX_SYSDEPS - 1)) <= ULONG_MAX); + #define GLIBTOP_SYSDEPS_ALL ((1 << GLIBTOP_MAX_SYSDEPS) - 1) typedef struct _glibtop_sysdeps glibtop_sysdeps;