[PATCH 15/15] hexdump: use simple printing functions when possible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This makes common cases 35-50% quicker.

Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 text-utils/display.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/text-utils/display.c b/text-utils/display.c
index 41ddd8d..7698965 100644
--- a/text-utils/display.c
+++ b/text-utils/display.c
@@ -110,13 +110,13 @@ print(PR *pr, unsigned char *bp) {
 		break;
 	    }
 	case F_P:
-		(void)printf(pr->fmt, isprint(*bp) ? *bp : '.');
+		putchar_unlocked(isprint(*bp) ? *bp : '.');
 		break;
 	case F_STR:
 		(void)printf(pr->fmt, (char *)bp);
 		break;
 	case F_TEXT:
-		(void)printf("%s", pr->fmt);
+		fputs_unlocked(pr->fmt, stdout);
 		break;
 	case F_U:
 		conv_u(pr, bp);
@@ -213,7 +213,7 @@ void display(void)
 				(void)printf(pr->fmt, (int64_t)eaddress);
 				break;
 			case F_TEXT:
-				(void)printf("%s", pr->fmt);
+				fputs_unlocked(pr->fmt, stdout);
 				break;
 			}
 	}
@@ -250,7 +250,7 @@ get(void)
 			if (!need && vflag != ALL &&
 			    !memcmp(curp, savp, nread)) {
 				if (vflag != DUP)
-					(void)printf("*\n");
+					fputs_unlocked("*\n", stdout);
 				return(NULL);
 			}
 			if (need > 0)
@@ -281,7 +281,7 @@ get(void)
 				return(curp);
 			}
 			if (vflag == WAIT)
-				(void)printf("*\n");
+				fputs_unlocked("*\n", stdout);
 			vflag = DUP;
 			address += blocksize;
 			need = blocksize;
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux