OSDN Git Service

PATCH: [ 802762 ] Optimise printc() in diffutils
authorKimmo Varis <kimmov@gmail.com>
Wed, 10 Sep 2003 12:54:36 +0000 (12:54 +0000)
committerKimmo Varis <kimmov@gmail.com>
Wed, 10 Sep 2003 12:54:36 +0000 (12:54 +0000)
Src/diffutils/src/CMP.C
Src/readme.txt

index 907c2f6..7aae42d 100644 (file)
@@ -499,24 +499,28 @@ printc (width, c)
 {
   register FILE *fs = stdout;
 
-  if (c >= 128)
+  /* Handle non-printable chars */
+  if (! isprint (c))
     {
-      putc ('M', fs);
-      putc ('-', fs);
-      c -= 128;
-      width -= 2;
-    }
-  if (c < 32)
-    {
-      putc ('^', fs);
-      c += 64;
-      --width;
-    }
-  else if (c == 127)
-    {
-      putc ('^', fs);
-      c = '?';
-      --width;
+    if (c >= 128)
+      {
+        putc ('M', fs);
+        putc ('-', fs);
+        c -= 128;
+        width -= 2;
+      }
+    if (c < 32)
+      {
+        putc ('^', fs);
+        c += 64;
+        --width;
+      }
+    else if (c == 127)
+      {
+        putc ('^', fs);
+        c = '?';
+        --width;
+      }
     }
 
   putc (c, fs);
index 215aecf..227ab2c 100644 (file)
@@ -1,3 +1,7 @@
+2003-09-10 Kimmo
+ PATCH: [ 802762 ] Optimise printc() in diffutils
+  WinMerge: cmp.c
+
 2003-09-09 Laoran
  FIX ASSERT in GetAllViews during a merge session
   WinMerge: MainFrm.cpp MainFrm.h