Skip to contentSkip to conversation

atm: Replace custom isprint() with generic analogue

PATCH Applied Andy Shevchenko 2 participants 2 messages May 10, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 atm: Replace custom isprint() with generic analogue

Custom isprint() definition may collide with one form ctype.h. In order to avoid this, replace it with a functional analogue which is isascii() && isprint() in this case.

First appearance of the code is in the commit 636b38438001 ("Import 2.3.43").

---
 drivers/atm/iphase.c | 11 +++++++----
 drivers/atm/iphase.h |  1 -
 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/atm/iphase.c +7 -4
index 933e3ff2ee8d..e3f5d073caa6 100644
@@ -47,6 +47,7 @@
 #include <linux/errno.h>  
 #include <linux/atm.h>  
 #include <linux/atmdev.h>  
+#include <linux/ctype.h>
 #include <linux/sonet.h>  
 #include <linux/skbuff.h>  
 #include <linux/time.h>  
@@ -996,10 +997,12 @@ static void xdump( u_char*  cp, int  length, char*  prefix )
         }
         pBuf += sprintf( pBuf, "  " );
         for(col = 0;count + col < length && col < 16; col++){
-            if (isprint((int)cp[count + col]))
-                pBuf += sprintf( pBuf, "%c", cp[count + col] );
-            else
-                pBuf += sprintf( pBuf, "." );
+		u_char c = cp[count + col];
+
+		if (isascii(c) && isprint(c))
+			pBuf += sprintf(pBuf, "%c", c);
+		else
+			pBuf += sprintf(pBuf, ".");
                 }
         printk("%s\n", prntBuf);
         count += col;
drivers/atm/iphase.h +0 -1
index 2beacf2fc1ec..2f5f8875cbd1 100644
@@ -124,7 +124,6 @@
 #define IF_RXPKT(A)
 #endif /* CONFIG_ATM_IA_DEBUG */ 
 
-#define isprint(a) ((a >=' ')&&(a <= '~'))  
 #define ATM_DESC(skb) (skb->protocol)
 #define IA_SKB_STATE(skb) (skb->protocol)
 #define IA_DLED   1
Signature · 1 line
2.30.2
#1 lore raw
This patch was applied to netdev/net-next.git (refs/heads/master):

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

Quoted 8 lines · On Mon, 10 May 2021 17:49:09 +0300 you wrote:

Custom isprint() definition may collide with one form ctype.h. In order to avoid this, replace it with a functional analogue which is isascii() && isprint() in this case.

First appearance of the code is in the commit 636b38438001 ("Import 2.3.43").

[...]

Here is the summary with links:
- [v1,1/1] atm: Replace custom isprint() with generic analogue

    https://git.kernel.org/netdev/net-next/c/532062b09956

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html