[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gnulib] strchrnul patch to assume C89 or later
From: |
Paul Eggert |
Subject: |
[Bug-gnulib] strchrnul patch to assume C89 or later |
Date: |
10 Sep 2003 00:12:43 -0700 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
This one is a bit unusual, in that while fixing the signature I noted
a related bug. Here is a patch:
2003-09-10 Paul Eggert <address@hidden>
* strchrnul.c (strchrnul): Define with a prototype.
Fix bug: c_in was not converted to unsigned char before searching.
* strchrnul.m4 (gl_PREREQ_STRCHRNUL): Don't check for string.h.
Index: lib/strchrnul.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/strchrnul.c,v
retrieving revision 1.1
diff -p -u -r1.1 strchrnul.c
--- lib/strchrnul.c 10 Jun 2003 12:13:32 -0000 1.1
+++ lib/strchrnul.c 10 Sep 2003 07:07:01 -0000
@@ -20,12 +20,11 @@
/* Find the first occurrence of C in S or the final NUL byte. */
char *
-strchrnul (s, c_in)
- const char *s;
- int c_in;
+strchrnul (const char *s, int c_in)
{
- while (*s && (*s != c_in))
+ unsigned char c = c_in;
+ while (*s && (*s != c))
s++;
- return (char*) s;
+ return (char *) s;
}
Index: m4/strchrnul.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/strchrnul.m4,v
retrieving revision 1.1
diff -p -u -r1.1 strchrnul.m4
--- m4/strchrnul.m4 10 Jun 2003 12:13:32 -0000 1.1
+++ m4/strchrnul.m4 10 Sep 2003 07:07:01 -0000
@@ -1,4 +1,4 @@
-# strchrnul.m4 serial 1
+# strchrnul.m4 serial 2
dnl Copyright (C) 2003 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
@@ -18,6 +18,4 @@ AC_DEFUN([gl_FUNC_STRCHRNUL],
])
# Prerequisites of lib/strchrnul.c.
-AC_DEFUN([gl_PREREQ_STRCHRNUL], [
- AC_CHECK_HEADERS_ONCE(string.h)
-])
+AC_DEFUN([gl_PREREQ_STRCHRNUL], [:])
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug-gnulib] strchrnul patch to assume C89 or later,
Paul Eggert <=