From: Vsevolod Stakhov Date: Thu, 12 Jan 2017 12:00:46 +0000 (+0000) Subject: [CritFix] Repair PTR_ARRAY_FOREACH macro X-Git-Tag: 1.5.0~365 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=397eeeb6d90d523372ced1f176a347a0890abbc4;p=thirdparty%2Frspamd.git [CritFix] Repair PTR_ARRAY_FOREACH macro MFH: true --- diff --git a/src/libutil/util.h b/src/libutil/util.h index 221ebc0d40..cfea5f8517 100644 --- a/src/libutil/util.h +++ b/src/libutil/util.h @@ -516,5 +516,5 @@ gdouble rspamd_normalize_probability (gdouble x, gdouble bias); */ guint64 rspamd_tm_to_time (const struct tm *tm, glong tz); -#define PTR_ARRAY_FOREACH(ar, i, cur) if (ar != NULL && ar->len > 0) for ((i) = 0, (cur) = g_ptr_array_index((ar), 0); (i) < (ar)->len; (cur) = g_ptr_array_index((ar), (i + 1)), ++(i)) +#define PTR_ARRAY_FOREACH(ar, i, cur) if ((ar) != NULL && (ar)->len > 0) for ((i) = 0; (i) < (ar)->len && (((cur) = g_ptr_array_index((ar), (i))) || 1); ++(i)) #endif