aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2016-06-27 20:43:08 -0400
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2016-06-27 20:43:08 -0400
commit6e3f3560c1be80583b4045a627e483c572c895b3 (patch)
treefe9024ba5f68ec2944703386e8f041a08529f9bc
parent25b0547949a05839988dae236fa9a28be6573586 (diff)
downloadegawk-6e3f3560c1be80583b4045a627e483c572c895b3.tar.gz
egawk-6e3f3560c1be80583b4045a627e483c572c895b3.tar.bz2
egawk-6e3f3560c1be80583b4045a627e483c572c895b3.zip
Add comment to gawkapi.h about string termination.
-rw-r--r--ChangeLog5
-rw-r--r--gawkapi.h6
2 files changed, 11 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 24dcaf37..16f7f184 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2016-06-27 Andrew J. Schorr <aschorr@telemetry-investments.com>
+ * gawkapi.h (awk_string): Add comment about the potential lack of
+ NUL-termination.
+
+2016-06-27 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
* awk.h: Add a comment regarding the potential lack of NUL-termination
for Node_val strings.
diff --git a/gawkapi.h b/gawkapi.h
index f0244604..975f82df 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -278,6 +278,12 @@ enum {
* The API deals exclusively with regular chars; these strings may
* be multibyte encoded in the current locale's encoding and character
* set. Gawk will convert internally to wide characters if necessary.
+ *
+ * Note that the string may not be terminated with a '\0' character.
+ * In particular, this happens for field values $n where n > 0 and n < NF,
+ * since the string points directly into the $0 buffer. All other strings,
+ * including those created by extensions, should be NUL-terminated. In general
+ * though, extension code should not assume that the string is NUL-terminated!
*/
typedef struct awk_string {
char *str; /* data */