From 54621e8b8fd804f06bf5f007dcb52b469521296c Mon Sep 17 00:00:00 2001 From: Explorer09 Date: Sat, 7 May 2016 14:57:51 +0800 Subject: [PATCH] Fix macro Header_forEachColumn The (this_) token was not expanded properly, but the bug was not caught because all uses of this macro specifies (this_)=this . Also parenthesize macro tokens to prevent further problems. --- Header.c | 2 +- Header.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Header.c b/Header.c index 929a6e0e..07631058 100644 --- a/Header.c +++ b/Header.c @@ -37,7 +37,7 @@ typedef struct Header_ { #endif #ifndef Header_forEachColumn -#define Header_forEachColumn(this_, i_) for (int i_=0; i_ < this->nrColumns; i_++) +#define Header_forEachColumn(this_, i_) for (int (i_)=0; (i_) < (this_)->nrColumns; ++(i_)) #endif Header* Header_new(struct ProcessList_* pl, Settings* settings, int nrColumns) { diff --git a/Header.h b/Header.h index 772e25dd..700ad354 100644 --- a/Header.h +++ b/Header.h @@ -28,7 +28,7 @@ typedef struct Header_ { #endif #ifndef Header_forEachColumn -#define Header_forEachColumn(this_, i_) for (int i_=0; i_ < this->nrColumns; i_++) +#define Header_forEachColumn(this_, i_) for (int (i_)=0; (i_) < (this_)->nrColumns; ++(i_)) #endif Header* Header_new(struct ProcessList_* pl, Settings* settings, int nrColumns);