From 17f90d1cf696402835df9b50bfb0976079f90405 Mon Sep 17 00:00:00 2001
From: cshapiro <cshapiro>
Date: Mon, 5 Sep 2005 06:09:13 +0000
Subject: [PATCH] Replace all uses of the old b{copy,zero} byte string
 functions with the equivalent standard C mem{cpy,move,set} functions.

---
 lisp/alpha-arch.c          |  4 ++--
 lisp/cgc.c                 |  7 ++++---
 lisp/darwin-lispadjuster.c |  2 +-
 lisp/hpux-os.c             |  6 +++---
 lisp/monitor.c             |  6 +++---
 lisp/os-common.c           |  8 ++++----
 lisp/purify.c              | 18 +++++++++---------
 lisp/socket.c              |  8 ++++----
 lisp/sunos-os.h            |  5 +----
 lisp/validate.c            |  6 +++---
 lisp/vars.c                |  6 +++---
 11 files changed, 37 insertions(+), 39 deletions(-)

diff --git a/lisp/alpha-arch.c b/lisp/alpha-arch.c
index f730c0a54..1c2f9d41c 100644
--- a/lisp/alpha-arch.c
+++ b/lisp/alpha-arch.c
@@ -1,6 +1,6 @@
 /*
 
- $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/alpha-arch.c,v 1.6 2000/10/24 13:32:30 dtc Exp $
+ $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/alpha-arch.c,v 1.7 2005/09/05 06:09:12 cshapiro Exp $
 
  This code was written as part of the CMU Common Lisp project at
  Carnegie Mellon University, and has been placed in the public domain.
@@ -33,7 +33,7 @@ char *arch_init(void)
 	  OS_VM_PROT_ALL,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,-1,0)
      == (os_vm_address_t) -1)
     perror("mmap");
-  bcopy(call_into_lisp_LRA,call_into_lisp_LRA_page,OS_VM_DEFAULT_PAGESIZE);
+  memcpy(call_into_lisp_LRA_page,call_into_lisp_LRA,OS_VM_DEFAULT_PAGESIZE);
   os_flush_icache((os_vm_address_t)call_into_lisp_LRA_page,
 		  OS_VM_DEFAULT_PAGESIZE);
   return NULL;
diff --git a/lisp/cgc.c b/lisp/cgc.c
index bb04a3efe..e87a2a9bc 100644
--- a/lisp/cgc.c
+++ b/lisp/cgc.c
@@ -1,5 +1,5 @@
 /* cgc.c -*- Mode: C; comment-column: 40; -*-
- * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/cgc.c,v 1.11 2004/07/12 23:44:07 pmai Exp $
+ * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/cgc.c,v 1.12 2005/09/05 06:09:12 cshapiro Exp $
  *
  * Conservative Garbage Collector for CMUCL x86.
  *
@@ -16,6 +16,7 @@
 #include <stdio.h>
 #include <assert.h>
 #include <signal.h>
+#include <string.h>
 #include "os.h"				/* for SetSymbolValue */
 #include "globals.h"                    /* For dynamic_space_size */
 #include "x86-validate.h"		/* for memory layout  */
@@ -264,7 +265,7 @@ os_vm_size_t length;
   
   
   if(block_start > addr)
-    bzero((char *)addr, MIN(block_start - addr, length));
+    memset((char *)addr, 0, MIN(block_start - addr, length))
 
   if(block_start < end)
     {
@@ -273,7 +274,7 @@ os_vm_size_t length;
       block_size =os_trunc_size_to_page(length);
       
       if(block_size < length)
-	bzero((char *)block_start + block_size,length - block_size);
+	memset((char *)block_start + block_size,0,length - block_size);
   
       if (block_size != 0)
 	{
diff --git a/lisp/darwin-lispadjuster.c b/lisp/darwin-lispadjuster.c
index 6084e529c..70b5fddd9 100644
--- a/lisp/darwin-lispadjuster.c
+++ b/lisp/darwin-lispadjuster.c
@@ -50,7 +50,7 @@ int main(int argc, char** argv)
 
     dprintf("Reading remainder of Segment command (%d bytes)", sizeof(thesegment)-sizeof(struct load_command));
     read(fd,&thesegment.segname,sizeof(thesegment)-sizeof(struct load_command));
-    bzero(segname,17);
+    memset(segname,0,17);
     memcpy(segname,thesegment.segname,16);
     dprintf("Segname: %s\n",segname);
     if (0==strncmp(thesegment.segname,"CMUCLRO",7)) {
diff --git a/lisp/hpux-os.c b/lisp/hpux-os.c
index 322ff2a43..9241a813f 100644
--- a/lisp/hpux-os.c
+++ b/lisp/hpux-os.c
@@ -1,5 +1,5 @@
 /*
- * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/hpux-os.c,v 1.5 2003/07/19 14:10:16 emarsden Exp $
+ * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/hpux-os.c,v 1.6 2005/09/05 06:09:13 cshapiro Exp $
  *
  * OS-dependent routines.  This file (along with os.h) exports an
  * OS-independent interface to the operating system VM facilities.
@@ -255,7 +255,7 @@ os_zero(os_vm_address_t addr,os_vm_size_t length)
     block_size=os_trunc_size_to_page(length);
 
     if(block_start>addr)
-      bzero((char *)addr,block_start-addr);
+      memset((char *)addr,0,block_start-addr);
     if(block_size<length)
       assert(FALSE);
     
@@ -314,7 +314,7 @@ int getrusage(int who,struct rusage *rusage)
   struct tms buf;
   clock_t uticks, sticks;
 
-  bzero(rusage,sizeof(struct rusage));
+  memset(rusage,0,sizeof(struct rusage));
   if (ticks_per_sec == 0) {
     ticks_per_sec = sysconf(_SC_CLK_TCK);
     usec_per_tick = 1000000 / ticks_per_sec;
diff --git a/lisp/monitor.c b/lisp/monitor.c
index a98bfa0a9..d04420af8 100644
--- a/lisp/monitor.c
+++ b/lisp/monitor.c
@@ -1,4 +1,4 @@
-/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/monitor.c,v 1.18 2004/07/08 18:21:29 rtoy Exp $ */
+/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/monitor.c,v 1.19 2005/09/05 06:09:13 cshapiro Exp $ */
 
 #include <stdio.h>
 #include <sys/types.h>
@@ -486,7 +486,7 @@ void ldb_monitor()
 {
     jmp_buf oldbuf;
 
-    bcopy(curbuf, oldbuf, sizeof(oldbuf));
+    memcpy(oldbuf, curbuf, sizeof(jmp_buf));
 
     printf("LDB monitor\n");
 
@@ -496,7 +496,7 @@ void ldb_monitor()
 
     done = FALSE;
 
-    bcopy(oldbuf, curbuf, sizeof(curbuf));
+    memcpy(curbuf, oldbuf, sizeof(jmp_buf));
 }
 
 void throw_to_monitor()
diff --git a/lisp/os-common.c b/lisp/os-common.c
index d921ed3f5..cd5d36731 100644
--- a/lisp/os-common.c
+++ b/lisp/os-common.c
@@ -1,6 +1,6 @@
 /*
 
- $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/os-common.c,v 1.18 2005/02/07 00:49:02 rtoy Exp $
+ $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/os-common.c,v 1.19 2005/09/05 06:09:13 cshapiro Exp $
 
  This code was written as part of the CMU Common Lisp project at
  Carnegie Mellon University, and has been placed in the public domain.
@@ -41,9 +41,9 @@ os_vm_size_t length;
     block_size=os_trunc_size_to_page(length);
 
     if(block_start>addr)
-	bzero((char *)addr,block_start-addr);
+	memset((char *)addr,0,block_start-addr);
     if(block_size<length)
-	bzero((char *)block_start+block_size,length-block_size);
+	memset((char *)block_start+block_size,0,length-block_size);
     
     if (block_size != 0) {
 	/* Now deallocate and allocate the block so that it */
@@ -98,7 +98,7 @@ os_vm_address_t os_reallocate(os_vm_address_t addr, os_vm_size_t old_len,
 	      os_vm_address_t new=os_allocate(len);
 
 	      if(new!=NULL){
-		bcopy((char*)addr, (char*)new,old_len);
+		memcpy((char*)new, (char*)addr, old_len);
 		os_invalidate(addr,old_len);
 		}
 		
diff --git a/lisp/purify.c b/lisp/purify.c
index df1fe724b..5721e725e 100644
--- a/lisp/purify.c
+++ b/lisp/purify.c
@@ -10,13 +10,13 @@
    and x86/GENCGC stack scavenging, by Douglas Crosher, 1996, 1997,
    1998.
 
-   $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/purify.c,v 1.32 2005/05/03 14:57:24 rtoy Exp $ 
+   $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/purify.c,v 1.33 2005/09/05 06:09:13 cshapiro Exp $ 
 
    */
 #include <stdio.h>
 #include <sys/types.h>
 #include <stdlib.h>
-#include <strings.h>
+#include <string.h>
 
 #include "lisp.h"
 #include "arch.h"
@@ -547,7 +547,7 @@ static lispobj ptrans_boxed(lispobj thing, lispobj header, boolean constant)
     }
 
     /* Copy it. */
-    bcopy(old, new, nwords * sizeof(lispobj));
+    memmove(new, old, nwords * sizeof(lispobj));
 
     /* Deposit forwarding pointer. */
     result = (lispobj)new | LowtagOf(thing);
@@ -590,7 +590,7 @@ static lispobj ptrans_instance(lispobj thing, lispobj header, boolean constant)
       assert_static_space_bounds (static_free);
 
       /* Copy it. */
-      bcopy(old, new, nwords * sizeof(lispobj));
+      memmove(new, old, nwords * sizeof(lispobj));
 
       /* Deposit forwarding pointer. */
       result = (lispobj)new | LowtagOf(thing);
@@ -622,7 +622,7 @@ static lispobj ptrans_fdefn(lispobj thing, lispobj header)
     assert_static_space_bounds (static_free);
 
     /* Copy it. */
-    bcopy(old, new, nwords * sizeof(lispobj));
+    memmove(new, old, nwords * sizeof(lispobj));
 
     /* Deposit forwarding pointer. */
     result = (lispobj)new | LowtagOf(thing);
@@ -652,7 +652,7 @@ static lispobj ptrans_unboxed(lispobj thing, lispobj header)
     assert_readonly_space_bounds (read_only_free);
 
     /* Copy it. */
-    bcopy(old, new, nwords * sizeof(lispobj));
+    memmove(new, old, nwords * sizeof(lispobj));
 
     /* Deposit forwarding pointer. */
     result = (lispobj)new | LowtagOf(thing);
@@ -686,7 +686,7 @@ static lispobj ptrans_vector(lispobj thing, int bits, int extra,
         assert_readonly_space_bounds (read_only_free);
     }
 
-    bcopy(vector, new, nwords * sizeof(lispobj));
+    memmove(new, vector, nwords * sizeof(lispobj));
 
     result = (lispobj)new | LowtagOf(thing);
     vector->header = result;
@@ -794,7 +794,7 @@ static lispobj ptrans_code(lispobj thing)
     read_only_free += CEILING(nwords, 2);
     assert_readonly_space_bounds (read_only_free);
 
-    bcopy(code, new, nwords * sizeof(lispobj));
+    memmove(new, code, nwords * sizeof(lispobj));
 
 #if (defined(i386) || defined(__x86_64))
     apply_code_fixups_during_purify(code,new);
@@ -902,7 +902,7 @@ static lispobj ptrans_func(lispobj thing, lispobj header)
             assert_readonly_space_bounds (read_only_free);
 	}
         /* Copy it. */
-        bcopy(old, new, nwords * sizeof(lispobj));
+        memmove(new, old, nwords * sizeof(lispobj));
 
         /* Deposit forwarding pointer. */
         result = (lispobj)new | LowtagOf(thing);
diff --git a/lisp/socket.c b/lisp/socket.c
index 01fa497e7..afba8385d 100644
--- a/lisp/socket.c
+++ b/lisp/socket.c
@@ -1,6 +1,6 @@
 /*
 
- $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Attic/socket.c,v 1.4 2000/10/26 19:50:19 dtc Exp $
+ $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Attic/socket.c,v 1.5 2005/09/05 06:09:13 cshapiro Exp $
 
  This code was written as part of the CMU Common Lisp project at
  Carnegie Mellon University, and has been placed in the public domain.
@@ -104,9 +104,9 @@ int connect_to_server (char *host, int display)
 	    }
 	  /* Set up the socket data. */
 	  inaddr.sin_family = host_ptr->h_addrtype;
-	  bcopy((char *)host_ptr->h_addr, 
-		(char *)&inaddr.sin_addr, 
-		sizeof(inaddr.sin_addr));
+	  memcpy((char *)&inaddr.sin_addr, 
+		 (char *)host_ptr->h_addr, 
+		 sizeof(inaddr.sin_addr));
 	} 
       else 
 	{
diff --git a/lisp/sunos-os.h b/lisp/sunos-os.h
index d1339a111..ffecaf789 100644
--- a/lisp/sunos-os.h
+++ b/lisp/sunos-os.h
@@ -1,6 +1,6 @@
 /*
 
- $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/sunos-os.h,v 1.6 2005/01/13 19:55:01 fgilham Exp $
+ $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/sunos-os.h,v 1.7 2005/09/05 06:09:13 cshapiro Exp $
 
  This code was written as part of the CMU Common Lisp project at
  Carnegie Mellon University, and has been placed in the public domain.
@@ -56,9 +56,6 @@ typedef int os_vm_prot_t;
 #define NULL 0
 #endif
 
-#define bcopy(a,b,n) memmove(b,a,n)
-#define bzero(a,n) memset(a,0,n)
-
 extern void flush_icache(unsigned int*, unsigned int);
 extern void save_context(void);
 
diff --git a/lisp/validate.c b/lisp/validate.c
index 04588de9c..84766b278 100644
--- a/lisp/validate.c
+++ b/lisp/validate.c
@@ -1,5 +1,5 @@
 /*
- * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/validate.c,v 1.21 2004/07/08 18:21:29 rtoy Exp $
+ * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/validate.c,v 1.22 2005/09/05 06:09:13 cshapiro Exp $
  *
  * Memory Validation
  */
@@ -81,9 +81,9 @@ validate(void)
 	 dynamic space segment in the executable), then copy the data
 	 back into it.  This is necessary to make the data in the
 	 dynamic space segment available to the new lisp process.  */
-      bcopy(dynamic_0_space, dynamic_space_data, (int)&image_dynamic_space_size);
+      memcpy(dynamic_space_data, dynamic_0_space, (int)&image_dynamic_space_size);
       ensure_space(dynamic_0_space, dynamic_space_size);
-      bcopy(dynamic_space_data, dynamic_0_space, (int)&image_dynamic_space_size);
+      memcpy(dynamic_0_space, dynamic_space_data, (int)&image_dynamic_space_size);
     } else
       ensure_space(dynamic_0_space, dynamic_space_size);
 
diff --git a/lisp/vars.c b/lisp/vars.c
index b43396b4a..2a8516a45 100644
--- a/lisp/vars.c
+++ b/lisp/vars.c
@@ -1,4 +1,4 @@
-/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/vars.c,v 1.4 2005/08/01 21:53:00 rtoy Exp $ */
+/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/vars.c,v 1.5 2005/09/05 06:09:13 cshapiro Exp $ */
 #include <stdio.h>
 #include <sys/types.h>
 #include <stdlib.h>
@@ -62,8 +62,8 @@ void flush_vars()
                 free(var);
             }
         }
-    bzero(NameHash, sizeof(NameHash));
-    bzero(ObjHash, sizeof(ObjHash));
+    memset(NameHash, 0, sizeof(NameHash));
+    memset(ObjHash, 0, sizeof(ObjHash));
     tempcntr = 1;
 
     for (var = perm; var != NULL; var = next) {
-- 
GitLab