Skip to content

Commit 2b32ee8

Browse files
authored
Merge pull request #68 from biodranik/warning-fix
Fixed duplicated macro warning for enabled Unity builds
2 parents 547b07a + 557983c commit 2b32ee8

File tree

2 files changed

+15
-21
lines changed

2 files changed

+15
-21
lines changed

source/plutovg-ft-math.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,14 @@ static inline int clz(unsigned int x) {
4646
#define PVG_FT_PAD_ROUND(x, n) PVG_FT_PAD_FLOOR((x) + ((n) / 2), n)
4747
#define PVG_FT_PAD_CEIL(x, n) PVG_FT_PAD_FLOOR((x) + ((n)-1), n)
4848

49-
#define PVG_FT_BEGIN_STMNT do {
50-
#define PVG_FT_END_STMNT } while (0)
51-
5249
/* transfer sign leaving a positive number */
5350
#define PVG_FT_MOVE_SIGN(x, s) \
54-
PVG_FT_BEGIN_STMNT \
55-
if (x < 0) { \
56-
x = -x; \
57-
s = -s; \
58-
} \
59-
PVG_FT_END_STMNT
51+
do { \
52+
if (x < 0) { \
53+
x = -x; \
54+
s = -s; \
55+
} \
56+
} while (0)
6057

6158
PVG_FT_Long PVG_FT_MulFix(PVG_FT_Long a, PVG_FT_Long b)
6259
{

source/plutovg-ft-raster.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@
5858
#include "plutovg-ft-raster.h"
5959
#include "plutovg-ft-math.h"
6060

61-
#define PVG_FT_BEGIN_STMNT do {
62-
#define PVG_FT_END_STMNT } while ( 0 )
63-
6461
#include <setjmp.h>
6562

6663
#define pvg_ft_setjmp setjmp
@@ -109,15 +106,15 @@ typedef ptrdiff_t PVG_FT_PtrDist;
109106
/* remainder, cast to a specific type. This macro also ensures that */
110107
/* the remainder is always positive. */
111108
#define PVG_FT_DIV_MOD( type, dividend, divisor, quotient, remainder ) \
112-
PVG_FT_BEGIN_STMNT \
113-
(quotient) = (type)( (dividend) / (divisor) ); \
114-
(remainder) = (type)( (dividend) % (divisor) ); \
115-
if ( (remainder) < 0 ) \
116-
{ \
117-
(quotient)--; \
118-
(remainder) += (type)(divisor); \
119-
} \
120-
PVG_FT_END_STMNT
109+
do { \
110+
(quotient) = (type)( (dividend) / (divisor) ); \
111+
(remainder) = (type)( (dividend) % (divisor) ); \
112+
if ( (remainder) < 0 ) \
113+
{ \
114+
(quotient)--; \
115+
(remainder) += (type)(divisor); \
116+
} \
117+
} while ( 0 )
121118

122119
/* These macros speed up repetitive divisions by replacing them */
123120
/* with multiplications and right shifts. */

0 commit comments

Comments
 (0)