aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2014-01-12 20:22:55 +0200
committerArnold D. Robbins <arnold@skeeve.com>2014-01-12 20:22:55 +0200
commit6c09c80378028858d439158d923f94a72d30efc6 (patch)
treedcaad3f969b33954c2c7827d38da0aae5095bfd0
parent664868f72b741ba448398d609e18a4cbb1ca20be (diff)
downloadegawk-6c09c80378028858d439158d923f94a72d30efc6.tar.gz
egawk-6c09c80378028858d439158d923f94a72d30efc6.tar.bz2
egawk-6c09c80378028858d439158d923f94a72d30efc6.zip
Minor improvements in a few files.
-rw-r--r--ChangeLog12
-rw-r--r--awkgram.c21
-rw-r--r--awkgram.y23
-rwxr-xr-xbootstrap.sh3
-rw-r--r--command.y2
-rw-r--r--ext.c15
6 files changed, 37 insertions, 39 deletions
diff --git a/ChangeLog b/ChangeLog
index 04e7ff03..eb22fc0f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2014-01-12 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awkgram.y: Update copyright year.
+ (func_use): Simplify code.
+ * command.y: Update copyright year.
+ * ext.c: Update copyright year.
+ (make_builtin): Small simplification.
+ (make_old_builtin): Make code consistent with make_builtin(), add
+ call to track_ext_func().
+ * bootstrap.sh: Update copyright year. Remove touch of version.c
+ since that file is no longer autogenerated.
+
2014-01-07 Arnold D. Robbins <arnold@skeeve.com>
* command.y (next_word): Move into ifdef for HAVE_LIBREADLINE,
diff --git a/awkgram.c b/awkgram.c
index 74913840..7eff2f11 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -6856,18 +6856,9 @@ func_use(const char *name, enum defref how)
len = strlen(name);
ind = hash(name, len, HASHSIZE, NULL);
- for (fp = ftable[ind]; fp != NULL; fp = fp->next) {
- if (strcmp(fp->name, name) == 0) {
- if (how == FUNC_DEFINE)
- fp->defined++;
- else if (how == FUNC_EXT) {
- fp->defined++;
- fp->extension++;
- } else
- fp->used++;
- return;
- }
- }
+ for (fp = ftable[ind]; fp != NULL; fp = fp->next)
+ if (strcmp(fp->name, name) == 0)
+ goto update_value;
/* not in the table, fall through to allocate a new one */
@@ -6875,6 +6866,10 @@ func_use(const char *name, enum defref how)
memset(fp, '\0', sizeof(struct fdesc));
emalloc(fp->name, char *, len + 1, "func_use");
strcpy(fp->name, name);
+ fp->next = ftable[ind];
+ ftable[ind] = fp;
+
+update_value:
if (how == FUNC_DEFINE)
fp->defined++;
else if (how == FUNC_EXT) {
@@ -6882,8 +6877,6 @@ func_use(const char *name, enum defref how)
fp->extension++;
} else
fp->used++;
- fp->next = ftable[ind];
- ftable[ind] = fp;
}
/* track_ext_func --- add an extension function to the table */
diff --git a/awkgram.y b/awkgram.y
index 9786ca7a..5846c134 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-2013 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-2014 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -4308,18 +4308,9 @@ func_use(const char *name, enum defref how)
len = strlen(name);
ind = hash(name, len, HASHSIZE, NULL);
- for (fp = ftable[ind]; fp != NULL; fp = fp->next) {
- if (strcmp(fp->name, name) == 0) {
- if (how == FUNC_DEFINE)
- fp->defined++;
- else if (how == FUNC_EXT) {
- fp->defined++;
- fp->extension++;
- } else
- fp->used++;
- return;
- }
- }
+ for (fp = ftable[ind]; fp != NULL; fp = fp->next)
+ if (strcmp(fp->name, name) == 0)
+ goto update_value;
/* not in the table, fall through to allocate a new one */
@@ -4327,6 +4318,10 @@ func_use(const char *name, enum defref how)
memset(fp, '\0', sizeof(struct fdesc));
emalloc(fp->name, char *, len + 1, "func_use");
strcpy(fp->name, name);
+ fp->next = ftable[ind];
+ ftable[ind] = fp;
+
+update_value:
if (how == FUNC_DEFINE)
fp->defined++;
else if (how == FUNC_EXT) {
@@ -4334,8 +4329,6 @@ func_use(const char *name, enum defref how)
fp->extension++;
} else
fp->used++;
- fp->next = ftable[ind];
- ftable[ind] = fp;
}
/* track_ext_func --- add an extension function to the table */
diff --git a/bootstrap.sh b/bootstrap.sh
index 496d8a03..85cdd196 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -3,7 +3,7 @@
# bootstrap.sh --- touch relevant files to avoid out-of-date issues in
# Git sandboxes
-# Copyright (C) 2007, 2009-2013 the Free Software Foundation, Inc.
+# Copyright (C) 2007, 2009-2014 the Free Software Foundation, Inc.
#
# This file is part of GAWK, the GNU implementation of the
# AWK Programming Language.
@@ -41,4 +41,3 @@ touch po/*.gmo
touch po/stamp-po
touch awkgram.c
touch command.c
-touch version.c
diff --git a/command.y b/command.y
index acf4a602..742b185a 100644
--- a/command.y
+++ b/command.y
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 2004, 2010, 2011 the Free Software Foundation, Inc.
+ * Copyright (C) 2004, 2010, 2011, 2014 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
diff --git a/ext.c b/ext.c
index 60765e07..cae882ff 100644
--- a/ext.c
+++ b/ext.c
@@ -7,7 +7,7 @@
*/
/*
- * Copyright (C) 1995 - 2001, 2003-2013 the Free Software Foundation, Inc.
+ * Copyright (C) 1995 - 2001, 2003-2014 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -223,9 +223,7 @@ make_builtin(const awk_ext_func_t *funcinfo)
if (! is_letter(*sp))
return false;
- sp++;
-
- while ((c = *sp++) != '\0') {
+ for (sp++; (c = *sp++) != '\0';) {
if (! is_identifier_char(c))
return false;
}
@@ -277,9 +275,11 @@ make_old_builtin(const char *name, NODE *(*func)(int), int count) /* temporary *
if (sp == NULL || *sp == '\0')
fatal(_("extension: missing function name"));
- while ((c = *sp++) != '\0') {
- if ((sp == & name[1] && c != '_' && ! isalpha((unsigned char) c))
- || (sp > &name[1] && ! is_identifier_char((unsigned char) c)))
+ if (! is_letter(*sp))
+ fatal(_("extension: illegal character `%c' in function name `%s'"), *sp, name);
+
+ for (sp++; (c = *sp++) != '\0';) {
+ if (! is_identifier_char(c))
fatal(_("extension: illegal character `%c' in function name `%s'"), c, name);
}
@@ -312,6 +312,7 @@ make_old_builtin(const char *name, NODE *(*func)(int), int count) /* temporary *
symbol = install_symbol(estrdup(name, strlen(name)), Node_old_ext_func);
symbol->code_ptr = b;
+ track_ext_func(name);
}