1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

Detect EOL on-the-fly in strstr, strcasestr and memmem.

This commit is contained in:
Maxim Kuvyrkov
2012-05-28 22:50:15 -07:00
parent 20a71f2c8a
commit 400726deef
7 changed files with 108 additions and 15 deletions

View File

@ -1,6 +1,5 @@
/* Return the offset of one string within another.
Copyright (C) 1994,1996,1997,2000,2001,2003,2008,2009
Free Software Foundation, Inc.
Copyright (C) 1994-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -36,6 +35,9 @@
#define AVAILABLE(h, h_l, j, n_l) \
(!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l)) \
&& ((h_l) = (j) + (n_l)))
#define AVAILABLE1(h, h_l, j, n_l) (true)
#define AVAILABLE2(h, h_l, j, n_l) AVAILABLE (h, h_l, j, n_l)
#define RET0_IF_0(a) if (!a) goto ret0
#include "str-two-way.h"
#undef strstr