Subject: | [PATCH] Zlib.xs (gzreadline): use memchr() for ninstr() which is buggy as of MAINT30364 |
Date: | Wed, 28 Feb 2007 10:58:14 +0300 |
To: | bug-compress-zlib [...] rt.cpan.org |
From: | Alexey Tourbin <at [...] altlinux.ru> |
See this thread
http://www.nntp.perl.org/group/perl.perl5.porters/2007/02/msg121477.html
---
Zlib.xs | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/Zlib.xs b/Zlib.xs
index 74c262a..c92248d 100644
--- a/Zlib.xs
+++ b/Zlib.xs
@@ -268,7 +268,6 @@ gzreadline(file, output)
dTHX;
#endif
SV * store = file->buffer ;
- char *nl = "\n";
char *p;
char *out_ptr = SvPVX(store) ;
int n;
@@ -279,7 +278,7 @@ gzreadline(file, output)
if ((n = SvCUR(store))) {
out_ptr = SvPVX(store) + file->offset ;
- if ((p = ninstr(out_ptr, out_ptr + n - 1, nl, nl))) {
+ if ((p = memchr(out_ptr, '\n', n))) {
/* if (rschar != 0777 && */
/* p = ninstr(out_ptr, out_ptr + n - 1, rs, rs+rslen-1)) { */
--
1.5.0.1.GIT