aboutsummaryrefslogtreecommitdiffstats
path: root/awk.h
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2016-07-08 15:26:00 -0400
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2016-07-08 15:26:00 -0400
commitc86137f472fdf876c2c223c8d99f673f477b7554 (patch)
tree7ed0e172eaa8d4f831a2d59287547f63f1e71dee /awk.h
parent4a0f74139fb702a14c2e6782fb1965245e4f9d2f (diff)
downloadegawk-c86137f472fdf876c2c223c8d99f673f477b7554.tar.gz
egawk-c86137f472fdf876c2c223c8d99f673f477b7554.tar.bz2
egawk-c86137f472fdf876c2c223c8d99f673f477b7554.zip
Optimization: support unterminated field strings inside gawk, but make terminated copies for the API.
Diffstat (limited to 'awk.h')
-rw-r--r--awk.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/awk.h b/awk.h
index 9e1fae10..91159a26 100644
--- a/awk.h
+++ b/awk.h
@@ -475,7 +475,14 @@ typedef struct exp_node {
#define re_cnt flags
/* Node_val */
-/* Note that the string in stptr will always be NUL-terminated. */
+/*
+ * Note that the string in stptr may not be NUL-terminated, but it is
+ * guaranteed to have at least one extra byte that may be temporarily set
+ * to '\0'. This is helpful when calling functions such as strtod that require
+ * a NUL-terminated argument. In particular, field values $n for n > 0 and
+ * n < NF will not have a NUL terminator, since they point into the $0 buffer.
+ * All other strings are NUL-terminated.
+ */
#define stptr sub.val.sp
#define stlen sub.val.slen
#define valref sub.val.sref
@@ -1497,6 +1504,7 @@ extern void update_ext_api(void);
extern NODE *awk_value_to_node(const awk_value_t *);
extern void run_ext_exit_handlers(int exitval);
extern void print_ext_versions(void);
+extern void free_api_string_copies(void);
/* gawkmisc.c */
extern char *gawk_name(const char *filespec);