nightmaremail

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit f7ec63b8edb59a179aa98e670df9aaffcd8eaf34
parent 3f9f95ccac176b30c0a8064589c0638561178023
Author: Rolf Eike Beer <eike@sf-mail.de>
Date:   Fri, 12 Jul 2019 18:38:29 +0200

get rid of str_diff() and use the default strcmp() instead

For the very same reasons as str_len() this can go away.

Diffstat:
MMakefile | 8++------
MTARGETS | 1-
Mcase.3 | 2--
Mstr.h | 4++--
Dstr_diff.c | 17-----------------
5 files changed, 4 insertions(+), 28 deletions(-)

diff --git a/Makefile b/Makefile @@ -1775,10 +1775,10 @@ scan.h fmt.h ./compile splogger.c str.a: \ -makelib str_diff.o str_diffn.o str_cpy.o str_chr.o \ +makelib str_diffn.o str_cpy.o str_chr.o \ str_rchr.o str_start.o byte_chr.o byte_rchr.o byte_diff.o byte_copy.o \ byte_cr.o byte_zero.o - ./makelib str.a str_diff.o str_diffn.o str_cpy.o \ + ./makelib str.a str_diffn.o str_cpy.o \ str_chr.o str_rchr.o str_start.o byte_chr.o byte_rchr.o \ byte_diff.o byte_copy.o byte_cr.o byte_zero.o @@ -1790,10 +1790,6 @@ str_cpy.o: \ compile str_cpy.c str.h ./compile str_cpy.c -str_diff.o: \ -compile str_diff.c str.h - ./compile str_diff.c - str_diffn.o: \ compile str_diffn.c str.h ./compile str_diffn.c diff --git a/TARGETS b/TARGETS @@ -91,7 +91,6 @@ error.o error_str.o error_temp.o error.a -str_diff.o str_diffn.o str_cpy.o str_chr.o diff --git a/case.3 b/case.3 @@ -95,6 +95,4 @@ All comparisons are performed on unsigned bytes. .SH "SEE ALSO" byte_diff(3), byte_equal(3), -str_diff(3), -str_equal(3), str_start(3) diff --git a/str.h b/str.h @@ -4,13 +4,13 @@ #include <string.h> extern unsigned int str_copy(); -extern int str_diff(); +#define str_diff(s,t) strcmp((s),(t)) extern int str_diffn(); #define str_len(s) strlen((s)) extern unsigned int str_chr(); extern unsigned int str_rchr(); extern int str_start(); -#define str_equal(s,t) (!str_diff((s),(t))) +#define str_equal(s,t) (strcmp((s),(t)) == 0) #endif diff --git a/str_diff.c b/str_diff.c @@ -1,17 +0,0 @@ -#include "str.h" - -int str_diff(s,t) -register char *s; -register char *t; -{ - register char x; - - for (;;) { - x = *s; if (x != *t) break; if (!x) break; ++s; ++t; - x = *s; if (x != *t) break; if (!x) break; ++s; ++t; - x = *s; if (x != *t) break; if (!x) break; ++s; ++t; - x = *s; if (x != *t) break; if (!x) break; ++s; ++t; - } - return ((int)(unsigned int)(unsigned char) x) - - ((int)(unsigned int)(unsigned char) *t); -}