[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gawk-diffs] [SCM] gawk branch, gawk-4.0-stable, updated. a89bd16ff78c74
From: |
Arnold Robbins |
Subject: |
[gawk-diffs] [SCM] gawk branch, gawk-4.0-stable, updated. a89bd16ff78c74513461af3f676d87d4eb9cfd3c |
Date: |
Sat, 31 Dec 2011 18:51:44 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, gawk-4.0-stable has been updated
via a89bd16ff78c74513461af3f676d87d4eb9cfd3c (commit)
from a32faf6354086864b55755c968f72a90e7e8f0d1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=a89bd16ff78c74513461af3f676d87d4eb9cfd3c
commit a89bd16ff78c74513461af3f676d87d4eb9cfd3c
Author: Arnold D. Robbins <address@hidden>
Date: Sat Dec 31 20:51:11 2011 +0200
Remove ancient STREQ, STREQN macros.
diff --git a/ChangeLog b/ChangeLog
index 075809d..39dd5a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-12-31 Arnold D. Robbins <address@hidden>
+
+ * awk.h [STREQ, STREQN]: Remove macros.
+ * awkgram.y, builtin.c, command.y, debug.c, eval.c,
+ io.c, msg.c: Change all uses to call strcmp, strncmp.
+
2011-12-26 Arnold D. Robbins <address@hidden>
Finish Rational Range Interpretation (!)
diff --git a/awk.h b/awk.h
index a267d2e..3574e58 100644
--- a/awk.h
+++ b/awk.h
@@ -1110,13 +1110,8 @@ extern STACK_ITEM *stack_top;
#endif /* __GNUC__ */
#endif /* GAWKDEBUG */
-#define STREQ(a,b) (*(a) == *(b) && strcmp((a), (b)) == 0)
-#define STREQN(a,b,n) ((n) && *(a)== *(b) && \
- strncmp((a), (b), (size_t) (n)) == 0)
-
#define fatal set_loc(__FILE__, __LINE__), r_fatal
-
extern jmp_buf fatal_tag;
extern int fatal_tag_valid;
diff --git a/awkgram.c b/awkgram.c
index 7a06667..665edbd 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -6675,7 +6675,7 @@ lookup(const char *name)
len = strlen(name);
for (bucket = variables[hash(name, len, (unsigned long) HASHSIZE,
NULL)];
bucket != NULL; bucket = bucket->hnext)
- if (bucket->hlength == len && STREQN(bucket->hname, name, len))
+ if (bucket->hlength == len && strncmp(bucket->hname, name, len)
== 0)
return bucket->hvalue;
return NULL;
}
@@ -6961,7 +6961,7 @@ remove_symbol(char *name)
len = strlen(name);
save = &(variables[hash(name, len, (unsigned long) HASHSIZE, NULL)]);
for (bucket = *save; bucket != NULL; bucket = bucket->hnext) {
- if (len == bucket->hlength && STREQN(bucket->hname, name, len))
{
+ if (len == bucket->hlength && strncmp(bucket->hname, name, len)
== 0) {
var_count--;
*save = bucket->hnext;
return bucket;
@@ -7233,7 +7233,7 @@ variable(char *name, NODETYPE type)
r = mk_symbol(type, (NODE *) NULL);
return install_symbol(name, r);
}
- if (STREQ(name, dv->name)) {
+ if (strcmp(name, dv->name) == 0) {
r = (*dv->load_func)();
break;
}
diff --git a/awkgram.y b/awkgram.y
index 69f74ca..ce71bb2 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -3985,7 +3985,7 @@ lookup(const char *name)
len = strlen(name);
for (bucket = variables[hash(name, len, (unsigned long) HASHSIZE,
NULL)];
bucket != NULL; bucket = bucket->hnext)
- if (bucket->hlength == len && STREQN(bucket->hname, name, len))
+ if (bucket->hlength == len && strncmp(bucket->hname, name, len)
== 0)
return bucket->hvalue;
return NULL;
}
@@ -4271,7 +4271,7 @@ remove_symbol(char *name)
len = strlen(name);
save = &(variables[hash(name, len, (unsigned long) HASHSIZE, NULL)]);
for (bucket = *save; bucket != NULL; bucket = bucket->hnext) {
- if (len == bucket->hlength && STREQN(bucket->hname, name, len))
{
+ if (len == bucket->hlength && strncmp(bucket->hname, name, len)
== 0) {
var_count--;
*save = bucket->hnext;
return bucket;
@@ -4543,7 +4543,7 @@ variable(char *name, NODETYPE type)
r = mk_symbol(type, (NODE *) NULL);
return install_symbol(name, r);
}
- if (STREQ(name, dv->name)) {
+ if (strcmp(name, dv->name) == 0) {
r = (*dv->load_func)();
break;
}
diff --git a/builtin.c b/builtin.c
index 4b4b972..30cf9a5 100644
--- a/builtin.c
+++ b/builtin.c
@@ -154,9 +154,9 @@ static FILE *
stdfile(const char *name, size_t len)
{
if (len == 11) {
- if (STREQN(name, "/dev/stderr", 11))
+ if (strncmp(name, "/dev/stderr", 11) == 0)
return stderr;
- else if (STREQN(name, "/dev/stdout", 11))
+ else if (strncmp(name, "/dev/stdout", 11) == 0)
return stdout;
}
diff --git a/command.c b/command.c
index 2b3b349..3664eee 100644
--- a/command.c
+++ b/command.c
@@ -1,9 +1,8 @@
-/* A Bison parser, made by GNU Bison 2.4.3. */
+/* A Bison parser, made by GNU Bison 2.5. */
-/* Skeleton implementation for Bison's Yacc-like parsers in C
+/* Bison implementation for Yacc-like parsers in C
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -45,7 +44,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.4.3"
+#define YYBISON_VERSION "2.5"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -74,7 +73,7 @@
/* Copy the first part of user declarations. */
-/* Line 189 of yacc.c */
+/* Line 268 of yacc.c */
#line 26 "command.y"
#include "awk.h"
@@ -143,8 +142,8 @@ static int find_argument(CMDARG *arg);
#define YYSTYPE CMDARG *
-/* Line 189 of yacc.c */
-#line 148 "command.c"
+/* Line 268 of yacc.c */
+#line 147 "command.c"
/* Enabling traces. */
#ifndef YYDEBUG
@@ -281,8 +280,8 @@ typedef int YYSTYPE;
/* Copy the second part of user declarations. */
-/* Line 264 of yacc.c */
-#line 286 "command.c"
+/* Line 343 of yacc.c */
+#line 285 "command.c"
#ifdef short
# undef short
@@ -384,11 +383,11 @@ YYID (yyi)
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ ||
defined __C99__FUNC__ \
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ ||
defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef _STDLIB_H
-# define _STDLIB_H 1
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
# endif
# endif
# endif
@@ -411,24 +410,24 @@ YYID (yyi)
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
# endif
-# if (defined __cplusplus && ! defined _STDLIB_H \
+# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
&& (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef _STDLIB_H
-# define _STDLIB_H 1
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
# endif
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
-# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined
__C99__FUNC__ \
+# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ ||
defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
-# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined
__C99__FUNC__ \
+# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ ||
defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
@@ -455,23 +454,7 @@ union yyalloc
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+ YYSTACK_GAP_MAXIMUM)
-/* Copy COUNT objects from FROM to TO. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if defined __GNUC__ && 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (YYID (0))
-# endif
-# endif
+# define YYCOPY_NEEDED 1
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
@@ -491,6 +474,26 @@ union yyalloc
#endif
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from FROM to TO. The source and destination do
+ not overlap. */
+# ifndef YYCOPY
+# if defined __GNUC__ && 1 < __GNUC__
+# define YYCOPY(To, From, Count) \
+ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+# else
+# define YYCOPY(To, From, Count) \
+ do \
+ { \
+ YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (To)[yyi] = (From)[yyi]; \
+ } \
+ while (YYID (0))
+# endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
@@ -721,8 +724,8 @@ static const yytype_uint8 yyr2[] =
1, 1, 2, 1, 2, 2, 1
};
-/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
- STATE-NUM when YYTABLE doesn't specify something else to do. Zero
+/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE doesn't specify something else to do. Zero
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
@@ -801,8 +804,7 @@ static const yytype_int16 yypgoto[] =
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
- number is the opposite. If zero, do what YYDEFACT says.
- If YYTABLE_NINF, syntax error. */
+ number is the opposite. If YYTABLE_NINF, syntax error. */
#define YYTABLE_NINF -148
static const yytype_int16 yytable[] =
{
@@ -829,6 +831,12 @@ static const yytype_int16 yytable[] =
0, 0, 0, 45
};
+#define yypact_value_is_default(yystate) \
+ ((yystate) == (-151))
+
+#define yytable_value_is_error(yytable_value) \
+ YYID (0)
+
static const yytype_int16 yycheck[] =
{
3, 6, 17, 17, 81, 1, 83, 1, 85, 86,
@@ -914,7 +922,6 @@ do
\
{ \
yychar = (Token); \
yylval = (Value); \
- yytoken = YYTRANSLATE (yychar); \
YYPOPSTACK (1); \
goto yybackup; \
} \
@@ -956,19 +963,10 @@ while (YYID (0))
#endif
-/* YY_LOCATION_PRINT -- Print the location on the stream.
- This macro was not mandated originally: define only if we know
- we won't break user code: when these are the locations we know. */
+/* This macro is provided for backward compatibility. */
#ifndef YY_LOCATION_PRINT
-# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
-# define YY_LOCATION_PRINT(File, Loc) \
- fprintf (File, "%d.%d-%d.%d", \
- (Loc).first_line, (Loc).first_column, \
- (Loc).last_line, (Loc).last_column)
-# else
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-# endif
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
#endif
@@ -1156,7 +1154,6 @@ int yydebug;
# define YYMAXDEPTH 10000
#endif
-
#if YYERROR_VERBOSE
@@ -1257,115 +1254,142 @@ yytnamerr (char *yyres, const char *yystr)
}
# endif
-/* Copy into YYRESULT an error message about the unexpected token
- YYCHAR while in state YYSTATE. Return the number of bytes copied,
- including the terminating null byte. If YYRESULT is null, do not
- copy anything; just return the number of bytes that would be
- copied. As a special case, return 0 if an ordinary "syntax error"
- message will do. Return YYSIZE_MAXIMUM if overflow occurs during
- size calculation. */
-static YYSIZE_T
-yysyntax_error (char *yyresult, int yystate, int yychar)
-{
- int yyn = yypact[yystate];
+/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
+ about the unexpected token YYTOKEN for the state stack whose top is
+ YYSSP.
- if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
- return 0;
- else
+ Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
+ not large enough to hold the message. In that case, also set
+ *YYMSG_ALLOC to the required number of bytes. Return 2 if the
+ required number of bytes is too large to store. */
+static int
+yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
+ yytype_int16 *yyssp, int yytoken)
+{
+ YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
+ YYSIZE_T yysize = yysize0;
+ YYSIZE_T yysize1;
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ /* Internationalized format string. */
+ const char *yyformat = 0;
+ /* Arguments of yyformat. */
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ /* Number of reported tokens (one for the "unexpected", one per
+ "expected"). */
+ int yycount = 0;
+
+ /* There are many possibilities here to consider:
+ - Assume YYFAIL is not used. It's too flawed to consider. See
+ <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
+ for details. YYERROR is fine as it does not invoke this
+ function.
+ - If this state is a consistent state with a default action, then
+ the only way this function was invoked is if the default action
+ is an error action. In that case, don't check for expected
+ tokens because there are none.
+ - The only way there can be no lookahead present (in yychar) is if
+ this state is a consistent state with a default action. Thus,
+ detecting the absence of a lookahead is sufficient to determine
+ that there is no unexpected or expected token to report. In that
+ case, just report a simple "syntax error".
+ - Don't assume there isn't a lookahead just because this state is a
+ consistent state with a default action. There might have been a
+ previous inconsistent state, consistent state with a non-default
+ action, or user semantic action that manipulated yychar.
+ - Of course, the expected token list depends on states to have
+ correct lookahead information, and it depends on the parser not
+ to perform extra reductions after fetching a lookahead from the
+ scanner and before detecting a syntax error. Thus, state merging
+ (from LALR or IELR) and default reductions corrupt the expected
+ token list. However, the list is correct for canonical LR with
+ one exception: it will still contain any token that will not be
+ accepted due to an error action in a later state.
+ */
+ if (yytoken != YYEMPTY)
{
- int yytype = YYTRANSLATE (yychar);
- YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
- YYSIZE_T yysize = yysize0;
- YYSIZE_T yysize1;
- int yysize_overflow = 0;
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- int yyx;
-
-# if 0
- /* This is so xgettext sees the translatable formats that are
- constructed on the fly. */
- YY_("syntax error, unexpected %s");
- YY_("syntax error, unexpected %s, expecting %s");
- YY_("syntax error, unexpected %s, expecting %s or %s");
- YY_("syntax error, unexpected %s, expecting %s or %s or %s");
- YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
-# endif
- char *yyfmt;
- char const *yyf;
- static char const yyunexpected[] = "syntax error, unexpected %s";
- static char const yyexpecting[] = ", expecting %s";
- static char const yyor[] = " or %s";
- char yyformat[sizeof yyunexpected
- + sizeof yyexpecting - 1
- + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
- * (sizeof yyor - 1))];
- char const *yyprefix = yyexpecting;
-
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
-
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn + 1;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yycount = 1;
-
- yyarg[0] = yytname[yytype];
- yyfmt = yystpcpy (yyformat, yyunexpected);
-
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- {
- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
- {
- yycount = 1;
- yysize = yysize0;
- yyformat[sizeof yyunexpected - 1] = '\0';
- break;
- }
- yyarg[yycount++] = yytname[yyx];
- yysize1 = yysize + yytnamerr (0, yytname[yyx]);
- yysize_overflow |= (yysize1 < yysize);
- yysize = yysize1;
- yyfmt = yystpcpy (yyfmt, yyprefix);
- yyprefix = yyor;
- }
+ int yyn = yypact[*yyssp];
+ yyarg[yycount++] = yytname[yytoken];
+ if (!yypact_value_is_default (yyn))
+ {
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. In other words, skip the first -YYN actions for
+ this state because they are default actions. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = YYLAST - yyn + 1;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ int yyx;
+
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
+ && !yytable_value_is_error (yytable[yyx + yyn]))
+ {
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+ {
+ yycount = 1;
+ yysize = yysize0;
+ break;
+ }
+ yyarg[yycount++] = yytname[yyx];
+ yysize1 = yysize + yytnamerr (0, yytname[yyx]);
+ if (! (yysize <= yysize1
+ && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
+ }
+ }
- yyf = YY_(yyformat);
- yysize1 = yysize + yystrlen (yyf);
- yysize_overflow |= (yysize1 < yysize);
- yysize = yysize1;
+ switch (yycount)
+ {
+# define YYCASE_(N, S) \
+ case N: \
+ yyformat = S; \
+ break
+ YYCASE_(0, YY_("syntax error"));
+ YYCASE_(1, YY_("syntax error, unexpected %s"));
+ YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+ YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+ YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+ YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or
%s"));
+# undef YYCASE_
+ }
- if (yysize_overflow)
- return YYSIZE_MAXIMUM;
+ yysize1 = yysize + yystrlen (yyformat);
+ if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
- if (yyresult)
- {
- /* Avoid sprintf, as that infringes on the user's name space.
- Don't have undefined behavior even if the translation
- produced a string with the wrong number of "%s"s. */
- char *yyp = yyresult;
- int yyi = 0;
- while ((*yyp = *yyf) != '\0')
- {
- if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
- {
- yyp += yytnamerr (yyp, yyarg[yyi++]);
- yyf += 2;
- }
- else
- {
- yyp++;
- yyf++;
- }
- }
- }
- return yysize;
+ if (*yymsg_alloc < yysize)
+ {
+ *yymsg_alloc = 2 * yysize;
+ if (! (yysize <= *yymsg_alloc
+ && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+ *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+ return 1;
}
+
+ /* Avoid sprintf, as that infringes on the user's name space.
+ Don't have undefined behavior even if the translation
+ produced a string with the wrong number of "%s"s. */
+ {
+ char *yyp = *yymsg;
+ int yyi = 0;
+ while ((*yyp = *yyformat) != '\0')
+ if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
+ {
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
+ yyformat += 2;
+ }
+ else
+ {
+ yyp++;
+ yyformat++;
+ }
+ }
+ return 0;
}
#endif /* YYERROR_VERBOSE */
-
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
@@ -1397,6 +1421,7 @@ yydestruct (yymsg, yytype, yyvaluep)
}
}
+
/* Prevent warnings from -Wmissing-prototypes. */
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
@@ -1423,10 +1448,9 @@ YYSTYPE yylval;
int yynerrs;
-
-/*-------------------------.
-| yyparse or yypush_parse. |
-`-------------------------*/
+/*----------.
+| yyparse. |
+`----------*/
#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus ||
defined _MSC_VER)
@@ -1448,8 +1472,6 @@ yyparse ()
#endif
#endif
{
-
-
int yystate;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
@@ -1604,7 +1626,7 @@ yybackup:
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
- if (yyn == YYPACT_NINF)
+ if (yypact_value_is_default (yyn))
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
@@ -1635,8 +1657,8 @@ yybackup:
yyn = yytable[yyn];
if (yyn <= 0)
{
- if (yyn == 0 || yyn == YYTABLE_NINF)
- goto yyerrlab;
+ if (yytable_value_is_error (yyn))
+ goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
@@ -1691,7 +1713,7 @@ yyreduce:
{
case 3:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 109 "command.y"
{
cmd_idx = -1;
@@ -1711,7 +1733,7 @@ yyreduce:
case 5:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 128 "command.y"
{
if (errcount == 0 && cmd_idx >= 0) {
@@ -1766,7 +1788,7 @@ yyreduce:
case 6:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 178 "command.y"
{
yyerrok;
@@ -1775,14 +1797,14 @@ yyreduce:
case 22:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 212 "command.y"
{ want_nodeval = TRUE; }
break;
case 23:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 217 "command.y"
{
if (errcount == 0) {
@@ -1802,7 +1824,7 @@ yyreduce:
case 24:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 235 "command.y"
{
(yyval) = append_statement(arg_list, (char *) start_EVAL);
@@ -1815,14 +1837,14 @@ yyreduce:
case 25:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 242 "command.y"
{ (yyval) = append_statement((yyvsp[(1) - (2)]), lexptr_begin); }
break;
case 26:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 243 "command.y"
{
(yyval) = (yyvsp[(3) - (4)]);
@@ -1831,7 +1853,7 @@ yyreduce:
case 27:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 250 "command.y"
{
arg_list = append_statement((yyvsp[(2) - (3)]), (char *)
end_EVAL);
@@ -1852,7 +1874,7 @@ yyreduce:
case 28:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 266 "command.y"
{
NODE *n;
@@ -1868,7 +1890,7 @@ yyreduce:
case 34:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 285 "command.y"
{
if (cmdtab[cmd_idx].class == D_FRAME
@@ -1879,7 +1901,7 @@ yyreduce:
case 35:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 291 "command.y"
{
int idx = find_argument((yyvsp[(2) - (2)]));
@@ -1896,49 +1918,49 @@ yyreduce:
case 38:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 304 "command.y"
{ want_nodeval = TRUE; }
break;
case 40:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 305 "command.y"
{ want_nodeval = TRUE; }
break;
case 46:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 310 "command.y"
{ want_nodeval = TRUE; }
break;
case 49:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 312 "command.y"
{ want_nodeval = TRUE; }
break;
case 51:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 313 "command.y"
{ want_nodeval = TRUE; }
break;
case 53:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 314 "command.y"
{ want_nodeval = TRUE; }
break;
case 57:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 318 "command.y"
{
if (in_cmd_src((yyvsp[(2) - (2)])->a_string))
@@ -1948,7 +1970,7 @@ yyreduce:
case 58:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 323 "command.y"
{
if (! input_from_tty)
@@ -1958,7 +1980,7 @@ yyreduce:
case 59:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 328 "command.y"
{
int type = 0;
@@ -1989,7 +2011,7 @@ yyreduce:
case 60:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 354 "command.y"
{
if (! in_commands)
@@ -2004,7 +2026,7 @@ yyreduce:
case 61:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 364 "command.y"
{
if (! in_commands)
@@ -2014,7 +2036,7 @@ yyreduce:
case 62:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 369 "command.y"
{
int idx = find_argument((yyvsp[(2) - (2)]));
@@ -2031,14 +2053,14 @@ yyreduce:
case 63:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 380 "command.y"
{ want_nodeval = TRUE; }
break;
case 64:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 381 "command.y"
{
int type;
@@ -2051,7 +2073,7 @@ yyreduce:
case 65:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 389 "command.y"
{
if (in_commands) {
@@ -2067,7 +2089,7 @@ yyreduce:
case 66:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 403 "command.y"
{
if ((yyvsp[(1) - (1)]) != NULL) {
@@ -2082,42 +2104,42 @@ yyreduce:
case 68:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 417 "command.y"
{ (yyval) = NULL; }
break;
case 69:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 422 "command.y"
{ (yyval) = NULL; }
break;
case 74:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 431 "command.y"
{ (yyval) = NULL; }
break;
case 75:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 436 "command.y"
{ (yyval) = NULL; }
break;
case 77:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 439 "command.y"
{ (yyval) = NULL; }
break;
case 78:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 444 "command.y"
{
NODE *n;
@@ -2129,14 +2151,14 @@ yyreduce:
case 79:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 454 "command.y"
{ (yyval) = NULL; }
break;
case 80:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 456 "command.y"
{
if (find_option((yyvsp[(1) - (1)])->a_string) < 0)
@@ -2146,7 +2168,7 @@ yyreduce:
case 81:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 461 "command.y"
{
if (find_option((yyvsp[(1) - (3)])->a_string) < 0)
@@ -2156,7 +2178,7 @@ yyreduce:
case 82:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 469 "command.y"
{
NODE *n;
@@ -2174,56 +2196,56 @@ yyreduce:
case 83:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 485 "command.y"
{ (yyval) = NULL; }
break;
case 88:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 494 "command.y"
{ (yyval) = NULL; }
break;
case 89:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 495 "command.y"
{ want_nodeval = TRUE; }
break;
case 92:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 497 "command.y"
{ want_nodeval = TRUE; }
break;
case 95:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 503 "command.y"
{ (yyval) = NULL; }
break;
case 97:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 509 "command.y"
{ (yyval) = NULL; }
break;
case 99:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 515 "command.y"
{ (yyval) = NULL; }
break;
case 104:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 527 "command.y"
{
int idx = find_argument((yyvsp[(1) - (2)]));
@@ -2240,7 +2262,7 @@ yyreduce:
case 106:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 543 "command.y"
{
(yyvsp[(2) - (2)])->type = D_array; /* dump all items */
@@ -2250,7 +2272,7 @@ yyreduce:
case 107:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 548 "command.y"
{
(yyvsp[(2) - (3)])->type = D_array;
@@ -2260,21 +2282,21 @@ yyreduce:
case 117:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 574 "command.y"
{ (yyval) = NULL; }
break;
case 118:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 576 "command.y"
{ (yyval) = NULL; }
break;
case 119:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 578 "command.y"
{
CMDARG *a;
@@ -2286,7 +2308,7 @@ yyreduce:
case 126:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 594 "command.y"
{
if ((yyvsp[(1) - (3)])->a_int > (yyvsp[(3) - (3)])->a_int)
@@ -2300,28 +2322,28 @@ yyreduce:
case 127:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 606 "command.y"
{ (yyval) = NULL; }
break;
case 134:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 620 "command.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
case 135:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 622 "command.y"
{ (yyval) = (yyvsp[(1) - (3)]); }
break;
case 137:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 628 "command.y"
{
CMDARG *a;
@@ -2341,21 +2363,21 @@ yyreduce:
case 139:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 647 "command.y"
{ (yyval) = (yyvsp[(1) - (1)]); num_dim = 1; }
break;
case 140:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 649 "command.y"
{ (yyval) = (yyvsp[(1) - (2)]); num_dim++; }
break;
case 142:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 655 "command.y"
{
NODE *n = (yyvsp[(2) - (2)])->a_node;
@@ -2369,7 +2391,7 @@ yyreduce:
case 143:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 664 "command.y"
{
/* a_string is array name, a_count is dimension count */
@@ -2381,14 +2403,14 @@ yyreduce:
case 144:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 674 "command.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
case 145:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 676 "command.y"
{
NODE *n = (yyvsp[(2) - (2)])->a_node;
@@ -2400,7 +2422,7 @@ yyreduce:
case 146:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 683 "command.y"
{
NODE *n = (yyvsp[(2) - (2)])->a_node;
@@ -2414,35 +2436,35 @@ yyreduce:
case 147:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 695 "command.y"
{ (yyval) = NULL; }
break;
case 148:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 697 "command.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
case 149:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 702 "command.y"
{ (yyval) = NULL; }
break;
case 150:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 704 "command.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
case 151:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 709 "command.y"
{
if ((yyvsp[(1) - (1)])->a_int == 0)
@@ -2453,7 +2475,7 @@ yyreduce:
case 152:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 715 "command.y"
{
if ((yyvsp[(2) - (2)])->a_int == 0)
@@ -2464,21 +2486,21 @@ yyreduce:
case 153:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 724 "command.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
case 154:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 726 "command.y"
{ (yyval) = (yyvsp[(2) - (2)]); }
break;
case 155:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 728 "command.y"
{
(yyvsp[(2) - (2)])->a_int = - (yyvsp[(2) - (2)])->a_int;
@@ -2488,7 +2510,7 @@ yyreduce:
case 156:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 736 "command.y"
{
if (lexptr_begin != NULL) {
@@ -2502,10 +2524,21 @@ yyreduce:
-/* Line 1464 of yacc.c */
-#line 2519 "command.c"
+/* Line 1806 of yacc.c */
+#line 2541 "command.c"
default: break;
}
+ /* User semantic actions sometimes alter yychar, and that requires
+ that yytoken be updated with the new translation. We take the
+ approach of translating immediately before every use of yytoken.
+ One alternative is translating here after every semantic action,
+ but that translation would be missed if the semantic action invokes
+ YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+ if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
+ incorrect destructor might then be invoked immediately. In the
+ case of YYERROR or YYBACKUP, subsequent parser actions might lead
+ to an incorrect destructor call or verbose syntax error message
+ before the lookahead is translated. */
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
YYPOPSTACK (yylen);
@@ -2533,6 +2566,10 @@ yyreduce:
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
+
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
@@ -2540,37 +2577,36 @@ yyerrlab:
#if ! YYERROR_VERBOSE
yyerror (YY_("syntax error"));
#else
+# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
+ yyssp, yytoken)
{
- YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
- if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
- {
- YYSIZE_T yyalloc = 2 * yysize;
- if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
- yyalloc = YYSTACK_ALLOC_MAXIMUM;
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
- yymsg = (char *) YYSTACK_ALLOC (yyalloc);
- if (yymsg)
- yymsg_alloc = yyalloc;
- else
- {
- yymsg = yymsgbuf;
- yymsg_alloc = sizeof yymsgbuf;
- }
- }
-
- if (0 < yysize && yysize <= yymsg_alloc)
- {
- (void) yysyntax_error (yymsg, yystate, yychar);
- yyerror (yymsg);
- }
- else
- {
- yyerror (YY_("syntax error"));
- if (yysize != 0)
- goto yyexhaustedlab;
- }
+ char const *yymsgp = YY_("syntax error");
+ int yysyntax_error_status;
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ if (yysyntax_error_status == 0)
+ yymsgp = yymsg;
+ else if (yysyntax_error_status == 1)
+ {
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+ yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
+ if (!yymsg)
+ {
+ yymsg = yymsgbuf;
+ yymsg_alloc = sizeof yymsgbuf;
+ yysyntax_error_status = 2;
+ }
+ else
+ {
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ yymsgp = yymsg;
+ }
+ }
+ yyerror (yymsgp);
+ if (yysyntax_error_status == 2)
+ goto yyexhaustedlab;
}
+# undef YYSYNTAX_ERROR
#endif
}
@@ -2629,7 +2665,7 @@ yyerrlab1:
for (;;)
{
yyn = yypact[yystate];
- if (yyn != YYPACT_NINF)
+ if (!yypact_value_is_default (yyn))
{
yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
@@ -2688,8 +2724,13 @@ yyexhaustedlab:
yyreturn:
if (yychar != YYEMPTY)
- yydestruct ("Cleanup: discarding lookahead",
- yytoken, &yylval);
+ {
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = YYTRANSLATE (yychar);
+ yydestruct ("Cleanup: discarding lookahead",
+ yytoken, &yylval);
+ }
/* Do not reclaim the symbols of the rule which action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
@@ -2714,7 +2755,7 @@ yyreturn:
-/* Line 1684 of yacc.c */
+/* Line 2067 of yacc.c */
#line 746 "command.y"
@@ -3404,7 +3445,7 @@ do_help(CMDARG *arg, int cmd)
i = find_command(name, strlen(name));
if (i >= 0) {
fprintf(out_fp, "%s\n", cmdtab[i].help_txt);
- if (STREQ(cmdtab[i].name, "option"))
+ if (strcmp(cmdtab[i].name, "option") == 0)
option_help();
} else
fprintf(out_fp, _("undefined command: %s\n"), name);
diff --git a/command.y b/command.y
index bcaa74f..676a545 100644
--- a/command.y
+++ b/command.y
@@ -1431,7 +1431,7 @@ do_help(CMDARG *arg, int cmd)
i = find_command(name, strlen(name));
if (i >= 0) {
fprintf(out_fp, "%s\n", cmdtab[i].help_txt);
- if (STREQ(cmdtab[i].name, "option"))
+ if (strcmp(cmdtab[i].name, "option") == 0)
option_help();
} else
fprintf(out_fp, _("undefined command: %s\n"), name);
diff --git a/debug.c b/debug.c
index ea65247..1cfbac4 100644
--- a/debug.c
+++ b/debug.c
@@ -994,7 +994,7 @@ find_param(const char *name, long num, char **pname)
pcount = get_param_count(func);
for (i = 0; i < pcount; i++) {
- if (STREQ(name, pnames[i])) {
+ if (strcmp(name, pnames[i]) == 0) {
r = f->stack[i];
if (r->type == Node_array_ref)
r = r->orig_array;
@@ -4068,7 +4068,7 @@ do_save(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
*/
if (strlen(line) > 1
- && STREQN(line, "sa", 2))
+ && strncmp(line, "sa", 2) == 0)
continue;
fprintf(fp, "%s\n", line);
@@ -4102,7 +4102,7 @@ do_option(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
value = arg ? arg->a_string : NULL;
for (opt = option_list; opt->name; opt++) { /* linear search */
- if (STREQ(name, opt->name))
+ if (strcmp(name, opt->name) == 0)
break;
}
if (! opt->name)
@@ -4651,8 +4651,9 @@ unserialize_option(char **pstr, int *pstr_len, int
field_cnt ATTRIBUTE_UNUSED)
const struct dbg_option *opt;
for (opt = option_list; opt->name; opt++) {
- if (STREQN(pstr[0], opt->name, pstr_len[0])) {
+ if (strncmp(pstr[0], opt->name, pstr_len[0]) == 0) {
char *value;
+
value = estrdup(pstr[1], pstr_len[1]);
(*(opt->assign))(value);
efree(value);
@@ -5063,7 +5064,7 @@ find_option(char *name)
int idx;
for (idx = 0; (p = option_list[idx].name); idx++) {
- if (STREQ(p, name))
+ if (strcmp(p, name) == 0)
return idx;
}
return -1;
@@ -5132,19 +5133,19 @@ set_gawk_output(const char *file)
if (fp == NULL)
close(fd);
- } else if (STREQN(file, "/dev/", 5)) {
+ } else if (strncmp(file, "/dev/", 5) == 0) {
char *cp = (char *) file + 5;
- if (STREQ(cp, "stdout"))
+ if (strcmp(cp, "stdout") == 0)
return;
- if (STREQ(cp, "stderr")) {
+ if (strcmp(cp, "stderr") == 0) {
output_fp = stderr;
output_file = "/dev/stderr";
output_is_tty = os_isatty(fileno(stderr));
return;
}
- if (STREQN(cp, "fd/", 3)) {
+ if (strncmp(cp, "fd/", 3) == 0) {
cp += 3;
fd = (int) strtoul(cp, NULL, 10);
if (errno == 0 && fd > INVALID_HANDLE) {
@@ -5198,9 +5199,9 @@ static int
set_option_flag(const char *value)
{
long n;
- if (STREQ(value, "on"))
+ if (strcmp(value, "on") == 0)
return TRUE;
- if (STREQ(value, "off"))
+ if (strcmp(value, "off") == 0)
return FALSE;
errno = 0;
n = strtol(value, NULL, 0);
@@ -5703,7 +5704,7 @@ in_cmd_src(const char *filename)
{
struct command_source *cs;
for (cs = cmd_src; cs != NULL; cs = cs->next) {
- if (cs->str != NULL && STREQ(cs->str, filename))
+ if (cs->str != NULL && strcmp(cs->str, filename) == 0)
return TRUE;
}
return FALSE;
diff --git a/eval.c b/eval.c
index 22f3077..2421aea 100644
--- a/eval.c
+++ b/eval.c
@@ -2448,7 +2448,7 @@ match_re:
if (t1->stlen > 0) {
/* retrieve function definition node */
f = pc->func_body;
- if (f != NULL && STREQ(f->vname, t1->stptr))
+ if (f != NULL && strcmp(f->vname, t1->stptr) ==
0)
/* indirect var hasn't been reassigned
*/
goto func_call;
f = lookup(t1->stptr);
diff --git a/io.c b/io.c
index 9c827ed..c57aef2 100644
--- a/io.c
+++ b/io.c
@@ -618,9 +618,8 @@ redirect(NODE *redir_exp, int redirtype, int *errflg)
fatal(_("expression for `%s' redirection has null string
value"),
what);
- if (do_lint && (STREQN(str, "0", redir_exp->stlen)
- || STREQN(str, "1",
redir_exp->stlen))
- )
+ if (do_lint && (strncmp(str, "0", redir_exp->stlen) == 0
+ || strncmp(str, "1", redir_exp->stlen) == 0))
lintwarn(_("filename `%s' for `%s' redirection may be result of
logical expression"),
str, what);
@@ -631,7 +630,7 @@ redirect(NODE *redir_exp, int redirtype, int *errflg)
#ifdef HAVE_SOCKETS
if (inetfile(str, & len, NULL)) {
tflag |= RED_SOCKET;
- if (STREQN(str + len, "tcp/", 4))
+ if (strncmp(str + len, "tcp/", 4) == 0)
tflag |= RED_TCP; /* use shutdown when closing */
}
#endif /* HAVE_SOCKETS */
@@ -1378,7 +1377,7 @@ devopen(const char *name, const char *mode)
flag = str2mode(mode);
- if (STREQ(name, "-"))
+ if (strcmp(name, "-") == 0)
return fileno(stdin);
openfd = INVALID_HANDLE;
@@ -1391,16 +1390,16 @@ devopen(const char *name, const char *mode)
return openfd;
}
- if (STREQN(name, "/dev/", 5)) {
+ if (strncmp(name, "/dev/", 5) == 0) {
cp = (char *) name + 5;
- if (STREQ(cp, "stdin") && (flag & O_ACCMODE) == O_RDONLY)
+ if (strcmp(cp, "stdin") == 0 && (flag & O_ACCMODE) == O_RDONLY)
openfd = fileno(stdin);
- else if (STREQ(cp, "stdout") && (flag & O_ACCMODE) == O_WRONLY)
+ else if (strcmp(cp, "stdout") == 0 && (flag & O_ACCMODE) ==
O_WRONLY)
openfd = fileno(stdout);
- else if (STREQ(cp, "stderr") && (flag & O_ACCMODE) == O_WRONLY)
+ else if (strcmp(cp, "stderr") == 0 && (flag & O_ACCMODE) ==
O_WRONLY)
openfd = fileno(stderr);
- else if (STREQN(cp, "fd/", 3)) {
+ else if (strncmp(cp, "fd/", 3) == 0) {
struct stat sbuf;
cp += 3;
@@ -1423,9 +1422,9 @@ devopen(const char *name, const char *mode)
cp = (char *) name + len;
/* which protocol? */
- if (STREQN(cp, "tcp/", 4))
+ if (strncmp(cp, "tcp/", 4) == 0)
protocol = SOCK_STREAM;
- else if (STREQN(cp, "udp/", 4))
+ else if (strncmp(cp, "udp/", 4) == 0)
protocol = SOCK_DGRAM;
else {
protocol = SOCK_STREAM; /* shut up the compiler */
@@ -2374,7 +2373,7 @@ do_find_source(const char *src, struct stat *stb, int
*errcode)
emalloc(path, char *, max_pathlen + strlen(src) + 1, "do_find_source");
for (i = 0; awkpath[i] != NULL; i++) {
- if (STREQ(awkpath[i], "./") || STREQ(awkpath[i], ".")) {
+ if (strcmp(awkpath[i], "./") == 0 || strcmp(awkpath[i], ".") ==
0) {
*path = '\0';
} else
strcpy(path, awkpath[i]);
@@ -3211,19 +3210,19 @@ inetfile(const char *str, int *length, int *family)
{
int ret = FALSE;
- if (STREQN(str, "/inet/", 6)) {
+ if (strncmp(str, "/inet/", 6) == 0) {
ret = TRUE;
if (length != NULL)
*length = 6;
if (family != NULL)
*family = AF_UNSPEC;
- } else if (STREQN(str, "/inet4/", 7)) {
+ } else if (strncmp(str, "/inet4/", 7) == 0) {
ret = TRUE;
if (length != NULL)
*length = 7;
if (family != NULL)
*family = AF_INET;
- } else if (STREQN(str, "/inet6/", 7)) {
+ } else if (strncmp(str, "/inet6/", 7) == 0) {
ret = TRUE;
if (length != NULL)
*length = 7;
diff --git a/msg.c b/msg.c
index 84a4e5c..3ed0233 100644
--- a/msg.c
+++ b/msg.c
@@ -46,7 +46,7 @@ err(const char *s, const char *emsg, va_list argp)
(void) fflush(output_fp);
me = myname;
- if (STREQN(me, "dgawk", 5))
+ if (strncmp(me, "dgawk", 5) == 0)
me = &myname[1];
(void) fprintf(stderr, "%s: ", me);
#ifdef GAWKDEBUG
diff --git a/vms/ChangeLog b/vms/ChangeLog
index 62db87e..a39f112 100644
--- a/vms/ChangeLog
+++ b/vms/ChangeLog
@@ -1,3 +1,8 @@
+2011-12-31 Arnold D. Robbins <address@hidden>
+
+ * vms_misc.c: [STREQ, STREQN]: Change use of macros to call
+ strcmp, strncmp, directly.
+
2011-11-02 Pat Rankin <address@hidden>
* vms-conf.h (HAVE_SETSID, HAVE_SYS_IOCTL): Add but leave undef'd.
diff --git a/vms/vms_misc.c b/vms/vms_misc.c
index f3650ef..cd92d7e 100644
--- a/vms/vms_misc.c
+++ b/vms/vms_misc.c
@@ -98,7 +98,7 @@ vms_open( const char *name, int mode, ... )
{
int result;
- if (STREQN(name, "/dev/", 5)) {
+ if (strncmp(name, "/dev/", 5) == 0) {
/* (this used to be handled in vms_devopen(), but that is only
called when opening files for output; we want it for input too) */
if (strcmp(name + 5, "null") == 0) /* /dev/null -> NL: */
@@ -307,7 +307,7 @@ VMS_fstat (fd, statbuf)
if (result == 0 /* GAWK addition; fixup /dev/null flags */
&& (statbuf->st_mode & S_IFREG)
- && STREQ(statbuf->st_dev, "_NLA0:"))
+ && strcmp(statbuf->st_dev, "_NLA0:") == 0)
{
statbuf->st_mode &= ~S_IFREG;
statbuf->st_mode |= S_IFCHR;
@@ -354,7 +354,7 @@ VMS_stat (name, statbuf)
if (result == 0 /* GAWK addition; fixup /dev/null flags */
&& (statbuf->st_mode & S_IFREG)
- && STREQ(statbuf->st_dev, "_NLA0:"))
+ && strcmp(statbuf->st_dev, "_NLA0:") == 0)
{
statbuf->st_mode &= ~S_IFREG;
statbuf->st_mode |= S_IFCHR;
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 6 +
awk.h | 5 -
awkgram.c | 6 +-
awkgram.y | 6 +-
builtin.c | 4 +-
command.c | 583 ++++++++++++++++++++++++++++++--------------------------
command.y | 2 +-
debug.c | 25 ++--
eval.c | 2 +-
io.c | 31 ++--
msg.c | 2 +-
vms/ChangeLog | 5 +
vms/vms_misc.c | 6 +-
13 files changed, 365 insertions(+), 318 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gawk-diffs] [SCM] gawk branch, gawk-4.0-stable, updated. a89bd16ff78c74513461af3f676d87d4eb9cfd3c,
Arnold Robbins <=