summaryrefslogtreecommitdiffstats
path: root/lib/libc/string/strstr.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/string/strstr.c')
-rw-r--r--lib/libc/string/strstr.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/lib/libc/string/strstr.c b/lib/libc/string/strstr.c
index 079d69d257f..241a080e7a8 100644
--- a/lib/libc/string/strstr.c
+++ b/lib/libc/string/strstr.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: strstr.c,v 1.8 2018/04/30 07:44:56 denis Exp $ */
+/* $OpenBSD: strstr.c,v 1.9 2020/04/16 12:37:52 claudio Exp $ */
/*
- * Copyright (c) 2005-2014 Rich Felker
+ * Copyright (c) 2005-2018 Rich Felker
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -24,13 +24,8 @@
*/
#include <string.h>
-#include <stdlib.h>
#include <stdint.h>
-#ifdef DEBUG
-#include <stdio.h>
-#endif
-
static char *
twobyte_strstr(const unsigned char *h, const unsigned char *n)
{
@@ -146,11 +141,8 @@ twoway_strstr(const unsigned char *h, const unsigned char *n)
/* Check last byte first; advance by shift on mismatch */
if (BITOP(byteset, h[l-1], &)) {
k = l-shift[h[l-1]];
-#ifdef DEBUG
- printf("adv by %zu (on %c) at [%s] (%zu;l=%zu)\n", k, h[l-1], h, shift[h[l-1]], l);
-#endif
if (k) {
- if (mem0 && mem && k < p) k = l-p;
+ if (k < mem) k = mem;
h += k;
mem = 0;
continue;