mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-20 17:53:02 +00:00
* configure.in: Check the protos of strchr ans strspn.
Replace strchr if needed. * src/system.h: Provide the protos of strchr, strspn and memchr if missing. * lib/strchr.c: New. * src/reader.c (symbols_save): Use strchr.
This commit is contained in:
10
ChangeLog
10
ChangeLog
@@ -1,3 +1,13 @@
|
|||||||
|
2001-12-27 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* configure.in: Check the protos of strchr ans strspn.
|
||||||
|
Replace strchr if needed.
|
||||||
|
* src/system.h: Provide the protos of strchr, strspn and memchr if
|
||||||
|
missing.
|
||||||
|
* lib/strchr.c: New.
|
||||||
|
* src/reader.c (symbols_save): Use strchr.
|
||||||
|
|
||||||
|
|
||||||
2001-12-27 Akim Demaille <akim@epita.fr>
|
2001-12-27 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* src/print.c, src/print_graph.c (escape): New.
|
* src/print.c, src/print_graph.c (escape): New.
|
||||||
|
|||||||
@@ -85,8 +85,8 @@ AC_FUNC_ALLOCA
|
|||||||
AC_FUNC_OBSTACK
|
AC_FUNC_OBSTACK
|
||||||
AC_FUNC_ERROR_AT_LINE
|
AC_FUNC_ERROR_AT_LINE
|
||||||
AC_CHECK_FUNCS(mkstemp setlocale)
|
AC_CHECK_FUNCS(mkstemp setlocale)
|
||||||
AC_CHECK_DECLS([stpcpy, strndup, strnlen, memchr])
|
AC_CHECK_DECLS([stpcpy, strchr, strndup, strspn, strnlen, memchr])
|
||||||
AC_REPLACE_FUNCS(stpcpy strndup strnlen strspn memchr)
|
AC_REPLACE_FUNCS(stpcpy strchr strndup strnlen strspn memchr)
|
||||||
jm_FUNC_MALLOC
|
jm_FUNC_MALLOC
|
||||||
jm_FUNC_REALLOC
|
jm_FUNC_REALLOC
|
||||||
jm_PREREQ_QUOTEARG
|
jm_PREREQ_QUOTEARG
|
||||||
|
|||||||
32
lib/strchr.c
Normal file
32
lib/strchr.c
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/* Copyright (C) 2001 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2 of
|
||||||
|
the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this program; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place -
|
||||||
|
Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#if HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_STRING_H
|
||||||
|
# include <string.h>
|
||||||
|
#else
|
||||||
|
# include <strings.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
char *
|
||||||
|
strchr (const char *s, int c)
|
||||||
|
{
|
||||||
|
return index (s, c);
|
||||||
|
}
|
||||||
@@ -1647,13 +1647,11 @@ symbols_save (void)
|
|||||||
{
|
{
|
||||||
struct obstack tokendefs;
|
struct obstack tokendefs;
|
||||||
bucket *bp;
|
bucket *bp;
|
||||||
char *cp, *symbol;
|
|
||||||
char c;
|
|
||||||
obstack_init (&tokendefs);
|
obstack_init (&tokendefs);
|
||||||
|
|
||||||
for (bp = firstsymbol; bp; bp = bp->next)
|
for (bp = firstsymbol; bp; bp = bp->next)
|
||||||
{
|
{
|
||||||
symbol = bp->tag; /* get symbol */
|
char *symbol = bp->tag; /* get symbol */
|
||||||
|
|
||||||
if (bp->value >= ntokens)
|
if (bp->value >= ntokens)
|
||||||
continue;
|
continue;
|
||||||
@@ -1673,9 +1671,7 @@ symbols_save (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Don't #define nonliteral tokens whose names contain periods. */
|
/* Don't #define nonliteral tokens whose names contain periods. */
|
||||||
cp = symbol;
|
if (strchr (symbol, '.'))
|
||||||
while ((c = *cp++) && c != '.');
|
|
||||||
if (c != '\0')
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
obstack_fgrow2 (&tokendefs, "# define %s\t%d\n",
|
obstack_fgrow2 (&tokendefs, "# define %s\t%d\n",
|
||||||
|
|||||||
12
src/system.h
12
src/system.h
@@ -110,14 +110,26 @@ char *alloca ();
|
|||||||
char *stpcpy PARAMS ((char *dest, const char *src));
|
char *stpcpy PARAMS ((char *dest, const char *src));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !HAVE_DECL_STRCHR
|
||||||
|
char *strchr(const char *s, int c);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !HAVE_DECL_STRNDUP
|
#if !HAVE_DECL_STRNDUP
|
||||||
char *strndup PARAMS ((const char *s, size_t size));
|
char *strndup PARAMS ((const char *s, size_t size));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !HAVE_DECL_STRSPN
|
||||||
|
size_t strspn(const char *s, const char *accept);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !HAVE_DECL_STRNLEN
|
#if !HAVE_DECL_STRNLEN
|
||||||
size_t strnlen PARAMS ((const char *s, size_t maxlen));
|
size_t strnlen PARAMS ((const char *s, size_t maxlen));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !HAVE_DECL_MEMCHR
|
||||||
|
void *memchr(const void *s, int c, size_t n);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*-----------------.
|
/*-----------------.
|
||||||
|
|||||||
Reference in New Issue
Block a user