summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2012-07-26 22:27:54 +0300
committerArnold D. Robbins <arnold@skeeve.com>2012-07-26 22:27:54 +0300
commit652a11e5fbe9862a2b8e961b32b9748b3c2c418b (patch)
tree003fe14ab86a1f521522a8815f22b618ebffd842 /io.c
parentc3d3c83b0a60454c7b1bc335c022051b58f393e3 (diff)
downloadgawk-652a11e5fbe9862a2b8e961b32b9748b3c2c418b.tar.gz
Add set_RT to API and to readdir extension.
Diffstat (limited to 'io.c')
-rw-r--r--io.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/io.c b/io.c
index 05e87907..f4ea286a 100644
--- a/io.c
+++ b/io.c
@@ -536,7 +536,7 @@ remap_std_file(int oldfd)
static int
iop_close(IOBUF *iop)
{
- int ret;
+ int ret = 0;
if (iop == NULL)
return 0;
@@ -2667,6 +2667,30 @@ iop_alloc(int fd, const char *name, bool do_input_parsers)
return iop;
}
+/* set_RT_to_null --- real function for use by extension API */
+
+void
+set_RT_to_null()
+{
+ if (! do_traditional) {
+ unref(RT_node->var_value);
+ RT_node->var_value = dupnode(Nnull_string);
+ }
+}
+
+/* set_RT --- real function for use by extension API */
+
+void
+set_RT(const char *str, size_t len)
+{
+ if (! do_traditional) {
+ unref(RT_node->var_value);
+ RT_node->var_value = make_str_node(str, len, ALREADY_MALLOCED);
+ }
+}
+
+/* macros for speed in default implementation */
+
#define set_RT_to_null() \
(void)(! do_traditional && (unref(RT_node->var_value), \
RT_node->var_value = dupnode(Nnull_string)))