Source-Changes-HG archive

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

[src/trunk]: src/sys/lib/libsa It's no use having a memcmp() that calls bcmp(...



details:   https://anonhg.NetBSD.org/src/rev/98fb15311d43
branches:  trunk
changeset: 467974:98fb15311d43
user:      simonb <simonb%NetBSD.org@localhost>
date:      Thu Apr 01 05:12:20 1999 +0000

description:
It's no use having a memcmp() that calls bcmp() if there's no bcmp() in
the SA library.  Basically copied from ../libkern with a few less #if's
and #include's.

diffstat:

 sys/lib/libsa/Makefile |   4 +-
 sys/lib/libsa/bcmp.c   |  58 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 2 deletions(-)

diffs (80 lines):

diff -r 71713e0126db -r 98fb15311d43 sys/lib/libsa/Makefile
--- a/sys/lib/libsa/Makefile    Thu Apr 01 03:58:44 1999 +0000
+++ b/sys/lib/libsa/Makefile    Thu Apr 01 05:12:20 1999 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.28 1999/03/30 22:02:39 cgd Exp $
+#      $NetBSD: Makefile,v 1.29 1999/04/01 05:12:20 simonb Exp $
 
 LIB=   sa
 MKPIC= no
@@ -14,7 +14,7 @@
 #COPTS+= -ansi -pedantic -Wall
 
 # stand routines
-SRCS+= alloc.c bcopy.c bzero.c errno.c exit.c exec.c getfile.c gets.c \
+SRCS+= alloc.c bcmp.c bcopy.c bzero.c errno.c exit.c exec.c getfile.c gets.c \
        globals.c memcmp.c memcpy.c memset.c panic.c printf.c snprintf.c \
        sprintf.c strerror.c subr_prf.c twiddle.c vsprintf.c
 
diff -r 71713e0126db -r 98fb15311d43 sys/lib/libsa/bcmp.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/lib/libsa/bcmp.c      Thu Apr 01 05:12:20 1999 +0000
@@ -0,0 +1,58 @@
+/*     $NetBSD: bcmp.c,v 1.1 1999/04/01 05:12:20 simonb Exp $  */
+
+/*
+ * Copyright (c) 1987, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+#include <lib/libkern/libkern.h>
+
+#undef bcmp                    /* in case of LIBSA_USE_MEMCMP */
+
+/*
+ * bcmp -- vax cmpc3 instruction
+ */
+int
+bcmp(b1, b2, length)
+       const void *b1, *b2;
+       size_t length;
+{
+       const char *p1 = b1, *p2 = b2;
+
+       if (length == 0)
+               return(0);
+       do {
+               if (*p1++ != *p2++)
+                       break;
+       } while (--length);
+       return(length);
+}



Home | Main Index | Thread Index | Old Index