michal-grzedzicki / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame SOURCES/0001-NFC-debugedit-Protect-macro-arguments-by-parentheses.patch

813822
From a93b0f5c9f0abef6efb5413df9e98b047a2a9a46 Mon Sep 17 00:00:00 2001
813822
From: Jan Kratochvil <jan.kratochvil@redhat.com>
813822
Date: Mon, 17 Aug 2020 16:56:56 +0200
813822
Subject: [PATCH 1/6] [NFC] debugedit: Protect macro arguments by parentheses
813822
813822
---
813822
 tools/debugedit.c | 14 +++++++-------
813822
 1 file changed, 7 insertions(+), 7 deletions(-)
813822
813822
diff --git a/tools/debugedit.c b/tools/debugedit.c
813822
index 6bea88551..a351adec8 100644
813822
--- a/tools/debugedit.c
813822
+++ b/tools/debugedit.c
813822
@@ -233,7 +233,7 @@ typedef struct
813822
   int shift = 0;			\
813822
   do					\
813822
     {					\
813822
-      c = *ptr++;			\
813822
+      c = *(ptr)++;			\
813822
       ret |= (c & 0x7f) << shift;	\
813822
       shift += 7;			\
813822
     } while (c & 0x80);			\
813822
@@ -251,7 +251,7 @@ typedef struct
813822
       valv >>= 7;			\
813822
       if (valv)				\
813822
 	c |= 0x80;			\
813822
-      *ptr++ = c;			\
813822
+      *(ptr)++ = c;			\
813822
     }					\
813822
   while (valv);				\
813822
 })
813822
@@ -311,7 +311,7 @@ strptr (DSO *dso, int sec, off_t offset)
813822
 }
813822
 
813822
 
813822
-#define read_8(ptr) *ptr++
813822
+#define read_8(ptr) *(ptr)++
813822
 
813822
 #define read_16(ptr) ({					\
813822
   uint16_t ret = do_read_16 (ptr);			\
813822
@@ -328,13 +328,13 @@ strptr (DSO *dso, int sec, off_t offset)
813822
 REL *relptr, *relend;
813822
 int reltype;
813822
 
813822
-#define do_read_32_relocated(ptr) ({			\
813822
-  uint32_t dret = do_read_32 (ptr);			\
813822
+#define do_read_32_relocated(xptr) ({			\
813822
+  uint32_t dret = do_read_32 (xptr);			\
813822
   if (relptr)						\
813822
     {							\
813822
-      while (relptr < relend && relptr->ptr < ptr)	\
813822
+      while (relptr < relend && relptr->ptr < (xptr))	\
813822
 	++relptr;					\
813822
-      if (relptr < relend && relptr->ptr == ptr)	\
813822
+      if (relptr < relend && relptr->ptr == (xptr))	\
813822
 	{						\
813822
 	  if (reltype == SHT_REL)			\
813822
 	    dret += relptr->addend;			\
813822
-- 
813822
2.18.4
813822