diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | gawkapi.c | 28 | ||||
-rw-r--r-- | gawkapi.h | 13 |
3 files changed, 13 insertions, 35 deletions
@@ -1,5 +1,12 @@ 2013-07-02 Andrew J. Schorr <aschorr@telemetry-investments.com> + * gawkapi.h (gawk_api): Remove unused api_lookup_file hook. + (lookup_file): Remove associated macro. + * gawkapi.c (api_lookup_file): Remove unused function. + (api_impl): Remove unused api_lookup_file hook. + +2013-07-02 Andrew J. Schorr <aschorr@telemetry-investments.com> + * awkgram.y (main_beginfile): Declare new global INSTRUCTION *. (parse_program): Set main_beginfile to point to the BEGINFILE instruction block. @@ -25,7 +25,10 @@ #include "awk.h" -extern IOBUF *curfile; /* required by api_lookup_file and api_get_file */ +/* Declare some globals used by api_get_file: */ +extern IOBUF *curfile; +extern INSTRUCTION *main_beginfile; +extern int currule; static awk_bool_t node_to_awk_value(NODE *node, awk_value_t *result, awk_valtype_t wanted); @@ -1035,28 +1038,8 @@ api_release_value(awk_ext_id_t id, awk_value_cookie_t value) return true; } -/* api_lookup_file --- return a handle to an open file */ - -static const awk_input_buf_t * -api_lookup_file(awk_ext_id_t id, const char *name, size_t namelen) -{ - const struct redirect *f; - - if ((name == NULL) || (namelen == 0)) { - if (curfile == NULL) - return NULL; - return &curfile->public; - } - if ((f = getredirect(name, namelen)) == NULL) - return NULL; - return &f->iop->public; -} - /* api_get_file --- return a handle to an existing or newly opened file */ -extern INSTRUCTION *main_beginfile; -extern int currule; - static const awk_input_buf_t * api_get_file(awk_ext_id_t id, const char *name, size_t namelen, const char *filetype, size_t typelen) { @@ -1215,8 +1198,7 @@ gawk_api_t api_impl = { api_flatten_array, api_release_flattened_array, - /* Find/get open files */ - api_lookup_file, + /* Find/open a file */ api_get_file, }; @@ -667,15 +667,7 @@ typedef struct gawk_api { awk_flat_array_t *data); /* - * Look up a currently open file. If the name is NULL, it returns - * data for the currently open input file corresponding to FILENAME. - * If the file is not found, it returns NULL. - */ - const awk_input_buf_t *(*api_lookup_file)(awk_ext_id_t id, - const char *name, - size_t name_len); - /* - * Look up a file. If the name is NULL, it returns + * Look up a file. If the name is NULL or name_len is 0, it returns * data for the currently open input file corresponding to FILENAME. * If the file is not already open, it tries to open it. * The "filetype" argument should be one of: @@ -763,9 +755,6 @@ typedef struct gawk_api { #define release_value(value) \ (api->api_release_value(ext_id, value)) -#define lookup_file(name, namelen) \ - (api->api_lookup_file(ext_id, name, namelen)) - #define get_file(name, namelen, filetype, typelen) \ (api->api_get_file(ext_id, name, namelen, filetype, typelen)) |