diff options
Diffstat (limited to 'awkgram.c')
-rw-r--r-- | awkgram.c | 21 |
1 files changed, 7 insertions, 14 deletions
@@ -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 */ |