[SSSD] [PATCH] UTIL: do not redefine SIZE_T_MAX

Lukas Slebodnik lslebodn at redhat.com
Mon Sep 2 17:18:59 UTC 2013


ehlo,

Some platforms can have defined SIZE_T_MAX.
It is better to use conditional build.

Two patches are attached. one for master(1.10) and second for 1.9

LS
-------------- next part --------------
>From 389fe98ffdf4f2604d7f1cce73b007359eb44a06 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Fri, 30 Aug 2013 23:12:41 +0200
Subject: [PATCH 1/2] UTIL: do not redefine SIZE_T_MAX

Some platforms can have defined SIZE_T_MAX.
It is better to use conditional build.
---
 src/util/util_safealign.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/util/util_safealign.h b/src/util/util_safealign.h
index d1d7a4861415ee6b0a755f17247985857b23ed57..099a4aea7628f110f72cdafcf2bbd1f3b56cf638 100644
--- a/src/util/util_safealign.h
+++ b/src/util/util_safealign.h
@@ -31,7 +31,9 @@
 
 #include <string.h>
 
+#ifndef SIZE_T_MAX
 #define SIZE_T_MAX ((size_t) -1)
+#endif
 
 #define SIZE_T_OVERFLOW(current, add) \
                         (((size_t)(add)) > (SIZE_T_MAX - ((size_t)(current))))
-- 
1.8.3.1

-------------- next part --------------
>From 750f43a16faeaf954a9569b4cd2541edaee43d27 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lukas.slebodnik at intrak.sk>
Date: Mon, 2 Sep 2013 11:30:17 +0200
Subject: [PATCH 1/2] UTIL: do not redefine SIZE_T_MAX

Some platforms can have defined SIZE_T_MAX.
It is better to use conditional build.
---
 src/util/util.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/util/util.h b/src/util/util.h
index 606eab03fc6e404f8b838a120b93ac63627eab01..5cb9cb9ae55c279928d6af3b87b83bfe8efd5b48 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -276,7 +276,9 @@ errno_t set_debug_file_from_fd(const int fd);
 #define OUT_OF_ID_RANGE(id, min, max) \
     (id == 0 || (min && (id < min)) || (max && (id > max)))
 
+#ifndef SIZE_T_MAX
 #define SIZE_T_MAX ((size_t) -1)
+#endif /* SIZE_T_MAX */
 
 #define SIZE_T_OVERFLOW(current, add) \
                         (((size_t)(add)) > (SIZE_T_MAX - ((size_t)(current))))
-- 
1.8.3.1



More information about the sssd-devel mailing list