changeset 1588:732a88db381f

* dispnew.c [not MULTI_FRAME] (Fredraw_display): Pass the correct number of arguments to mark_window_display_accurate. * dispnew.c (safe_bcopy): Use the right terminating condition in the loop which uses multiple bcopy calls to transfer a block to an overlapping higher block.
author Jim Blandy <jimb@redhat.com>
date Mon, 16 Nov 1992 00:42:24 +0000
parents 57ae5625fe22
children 6168f42d716c
files src/dispnew.c
diffstat 1 files changed, 20 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/dispnew.c	Mon Nov 16 00:41:30 1992 +0000
+++ b/src/dispnew.c	Mon Nov 16 00:42:24 1992 +0000
@@ -202,7 +202,7 @@
   windows_or_buffers_changed++;
   /* Mark all windows as INaccurate,
      so that every window will have its redisplay done.  */
-  mark_window_display_accurate (FRAME_ROOT_WINDOW (0));
+  mark_window_display_accurate (FRAME_ROOT_WINDOW (0), 0);
   return Qnil;
 }
 
@@ -469,25 +469,27 @@
      char *from, *to;
      int size;
 {
-  register char *endf;
-  register char *endt;
-
-  if (size == 0)
+  if (size <= 0 || from == to)
     return;
 
-  /* If destination is higher in memory, and overlaps source zone,
-     copy from the end.  */
-  if (from < to && from + size > to)
+  /* If the source and destination don't overlap, then bcopy can
+     handle it.  If they do overlap, but the destination is lower in
+     memory than the source, we'll assume bcopy can handle that.  */
+  if (to < from || from + size <= to)
+    bcopy (from, to, size);
+
+  /* Otherwise, we'll copy from the end.  */
+  else
     {
-      endf = from + size;
-      endt = to + size;
+      register char *endf = from + size;
+      register char *endt = to + size;
 
       /* If TO - FROM is large, then we should break the copy into
 	 nonoverlapping chunks of TO - FROM bytes each.  However, if
 	 TO - FROM is small, then the bcopy function call overhead
 	 makes this not worth it.  The crossover point could be about
-	 anywhere.  Since I don't think the obvious copy loop is ever
-	 too bad, I'm trying to err in its favor.  */
+	 anywhere.  Since I don't think the obvious copy loop is too
+	 bad, I'm trying to err in its favor.  */
       if (to - from < 64)
 	{
 	  do
@@ -496,24 +498,23 @@
 	}
       else
 	{
-	  /* Since TO - FROM >= 64, the overlap is less than SIZE,
-	     so we can always safely do this loop once.  */
-	  while (endt > to)
+	  for (;;)
 	    {
 	      endt -= (to - from);
 	      endf -= (to - from);
 
+	      if (endt < to)
+		break;
+
 	      bcopy (endf, endt, to - from);
 	    }
-	  
-	  /* If TO - FROM wasn't a multiple of SIZE, there will be a
+
+	  /* If SIZE wasn't a multiple of TO - FROM, there will be a
 	     little left over.  The amount left over is
 	     (endt + (to - from)) - to, which is endt - from.  */
 	  bcopy (from, to, endt - from);
 	}
     }
-  else
-    bcopy (from, to, size);
 }     
 
 #if 0