nightmaremail

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

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

get rid of str_len() and just use the default strlen() instead

Basically 2 things could happen here:

-the custom implementation is used, which is probably slower than the one
 provided by the compiler
-the compiler or linker notices that this is just strlen() and replaces it with
 the normal one

In both cases we are better of just removing it altogether.

It would in theory be possible that this implementation is faster than what your
compiler or libc offers. But than your system is already slow, this few calls
for your mailer daemon will not matter then anyway.

Diffstat:
MMakefile | 8++------
MTARGETS | 1-
Mstr.h | 4+++-
Dstr_len.c | 15---------------
4 files changed, 5 insertions(+), 23 deletions(-)

diff --git a/Makefile b/Makefile @@ -1775,10 +1775,10 @@ scan.h fmt.h ./compile splogger.c str.a: \ -makelib str_len.o str_diff.o str_diffn.o str_cpy.o str_chr.o \ +makelib str_diff.o 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_len.o str_diff.o str_diffn.o str_cpy.o \ + ./makelib str.a str_diff.o 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 @@ -1798,10 +1798,6 @@ str_diffn.o: \ compile str_diffn.c str.h ./compile str_diffn.c -str_len.o: \ -compile str_len.c str.h - ./compile str_len.c - str_rchr.o: \ compile str_rchr.c str.h ./compile str_rchr.c diff --git a/TARGETS b/TARGETS @@ -91,7 +91,6 @@ error.o error_str.o error_temp.o error.a -str_len.o str_diff.o str_diffn.o str_cpy.o diff --git a/str.h b/str.h @@ -1,10 +1,12 @@ #ifndef STR_H #define STR_H +#include <string.h> + extern unsigned int str_copy(); extern int str_diff(); extern int str_diffn(); -extern unsigned int str_len(); +#define str_len(s) strlen((s)) extern unsigned int str_chr(); extern unsigned int str_rchr(); extern int str_start(); diff --git a/str_len.c b/str_len.c @@ -1,15 +0,0 @@ -#include "str.h" - -unsigned int str_len(s) -register char *s; -{ - register char *t; - - t = s; - for (;;) { - if (!*t) return t - s; ++t; - if (!*t) return t - s; ++t; - if (!*t) return t - s; ++t; - if (!*t) return t - s; ++t; - } -}