diff options
-rw-r--r-- | libglusterfs/src/common-utils.h | 2 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr.h | 1 | ||||
-rw-r--r-- | xlators/cluster/ec/src/ec-heal.c | 1 | ||||
-rw-r--r-- | xlators/debug/io-stats/src/io-stats.c | 3 |
4 files changed, 3 insertions, 4 deletions
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index aacf2c5a32c..fa5d28d92b3 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -44,6 +44,8 @@ void trap (void); #define STRINGIFY(val) #val #define TOSTRING(val) STRINGIFY(val) +#define alloca0(size) ({void *__ptr; __ptr = alloca(size); memset(__ptr, 0, size); __ptr; }) + #define min(a,b) ((a)<(b)?(a):(b)) #define max(a,b) ((a)>(b)?(a):(b)) #define roof(a,b) ((((a)+(b)-1)/((b)?(b):1))*(b)) diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index 71247c2c573..54f988e8f33 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -45,7 +45,6 @@ typedef int (*afr_inode_refresh_cbk_t) (call_frame_t *frame, xlator_t *this, int typedef int (*afr_changelog_resume_t) (call_frame_t *frame, xlator_t *this); -#define alloca0(size) ({void *__ptr; __ptr = alloca(size); memset(__ptr, 0, size); __ptr;}) #define AFR_COUNT(array,max) ({int __i; int __res = 0; for (__i = 0; __i < max; __i++) if (array[__i]) __res++; __res;}) #define AFR_INTERSECT(dst,src1,src2,max) ({int __i; for (__i = 0; __i < max; __i++) dst[__i] = src1[__i] && src2[__i];}) #define AFR_CMP(a1,a2,len) ({int __cmp = 0; int __i; for (__i = 0; __i < len; __i++) if (a1[__i] != a2[__i]) { __cmp = 1; break;} __cmp;}) diff --git a/xlators/cluster/ec/src/ec-heal.c b/xlators/cluster/ec/src/ec-heal.c index 94ff4757b4d..7fe1b2c4f8b 100644 --- a/xlators/cluster/ec/src/ec-heal.c +++ b/xlators/cluster/ec/src/ec-heal.c @@ -26,7 +26,6 @@ #include "syncop-utils.h" #include "cluster-syncop.h" -#define alloca0(size) ({void *__ptr; __ptr = alloca(size); memset(__ptr, 0, size); __ptr; }) #define EC_COUNT(array, max) ({int __i; int __res = 0; for (__i = 0; __i < max; __i++) if (array[__i]) __res++; __res; }) #define EC_INTERSECT(dst, src1, src2, max) ({int __i; for (__i = 0; __i < max; __i++) dst[__i] = src1[__i] && src2[__i]; }) #define EC_ADJUST_SOURCE(source, sources, max) ({int __i; if (sources[source] == 0) {source = -1; for (__i = 0; __i < max; __i++) if (sources[__i]) source = __i; } }) diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index d7684e16470..e2963b7c196 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -2855,8 +2855,7 @@ conditional_dump (dict_t *dict, char *key, data_t *value, void *data) /* hmmm... no check for this */ /* name format: <passed in path/filename>.<xlator name slashes to -> */ namelen = value->len + strlen (this->name) + 2; /* '.' and '\0' */ - filename = alloca (namelen); - memset (filename, 0, namelen); + filename = alloca0 (namelen); memcpy (filename, data_to_str (value), value->len); memcpy (filename + value->len, ".", 1); memcpy (filename + value->len + 1, this->name, strlen(this->name)); |