diff options
author | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2013-07-02 15:59:15 -0400 |
---|---|---|
committer | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2013-07-02 15:59:15 -0400 |
commit | 6ace1b5a655517a41be7d1633ec7592ad940c0e6 (patch) | |
tree | cd58833a4e7482db3544c4df57c0bfa4a893d17b /gawkapi.c | |
parent | a0d911d5920362982fb6a5c1fa6047c69dc26668 (diff) | |
download | egawk-6ace1b5a655517a41be7d1633ec7592ad940c0e6.tar.gz egawk-6ace1b5a655517a41be7d1633ec7592ad940c0e6.tar.bz2 egawk-6ace1b5a655517a41be7d1633ec7592ad940c0e6.zip |
Patch gawkapi flatten_array to pass index values as strings in all cases!
Diffstat (limited to 'gawkapi.c')
-rw-r--r-- | gawkapi.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -936,12 +936,17 @@ api_flatten_array(awk_ext_id_t id, for (i = j = 0; i < 2 * array->table_size; i += 2, j++) { NODE *index, *value; - index = force_string(list[i]); + index = list[i]; value = list[i + 1]; /* number or string or subarray */ - /* convert index and value to ext types */ + /* + * Convert index and value to ext types. Force the + * index to be a string, since indices are always + * conceptually strings, regardless of internal optimizations + * to treat them as integers in some cases. + */ if (! node_to_awk_value(index, - & (*data)->elements[j].index, AWK_UNDEFINED)) { + & (*data)->elements[j].index, AWK_STRING)) { fatal(_("api_flatten_array: could not convert index %d\n"), (int) i); } |