diff options
author | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2016-07-08 15:26:00 -0400 |
---|---|---|
committer | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2016-07-08 15:26:00 -0400 |
commit | c86137f472fdf876c2c223c8d99f673f477b7554 (patch) | |
tree | 7ed0e172eaa8d4f831a2d59287547f63f1e71dee /awk.h | |
parent | 4a0f74139fb702a14c2e6782fb1965245e4f9d2f (diff) | |
download | egawk-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.h | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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); |