summaryrefslogtreecommitdiffstats
path: root/parser.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-04-24 06:47:10 -0700
committerKaz Kylheku <kaz@kylheku.com>2020-04-24 06:47:10 -0700
commite93b91d8b2f239c8c85cb757487d488d4b91ca1b (patch)
tree73e1fbda2d18ead21c82ab794f84cdc3a58420f3 /parser.c
parent7fbf6b853893f65193ea9c81cf467be08c651244 (diff)
downloadtxr-e93b91d8b2f239c8c85cb757487d488d4b91ca1b.tar.gz
txr-e93b91d8b2f239c8c85cb757487d488d4b91ca1b.tar.bz2
txr-e93b91d8b2f239c8c85cb757487d488d4b91ca1b.zip
carray: bug sweep.
The carray type is hereby reviewed for and repaired of issues related to the nelem member of struct carray using negative values to indicate "unknown carray size". * ffi.c (struct carray): The artype becomes a two-element array of values, so a carray can have a cache of separate null-terminated and non-null-terminated array type descriptors. This way, we get rid of the dirty trick of mutating one type. (carray_mark_op): Mark the two-element artype. (make_carray): Initialize two-element artype to nil. (carray_set_length): Cache invalidation: reset both elements of artype to nil, because the type includes length information, which may now be wrong. (copy_carray): Throw exception if asked to copy carray of unknown length. This would happen in carray_dup anyway, but at least the diagnostic refers to copy-carray. (buf_carray): Avoid calling make_duplicate_buf with negative bytes value when the carray has unknown length; diagnose. (carray_ref, carray_refset): Don't translate negative index values if the length is unknown. (carray_sub, carray_replace): If the operation requires use of the length, and it is unknown, throw an exception. (carray_ensure_artype): Take a null_term paramter that is 0 or 1, and use it as an array index into artype to set up the correct type, with the correct value of the null_term member that is henceforth not mutated. (carray_get_common, carray_put_common): Pass the null_term argument down to carray_ensure_artype. Remove the mutation of the null_term member of the type structure.
Diffstat (limited to 'parser.c')
0 files changed, 0 insertions, 0 deletions