diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-09-04 21:37:48 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-09-04 21:37:48 -0700 |
commit | 1f47e0a98f45ac2e60e2e23d827fd2f8da6b4962 (patch) | |
tree | 3bccf1dddb9f762ef5375c5da7da47e4aa4be786 /struct.h | |
parent | 7c996aaf65a2e77281177bb8132b675e8bba133d (diff) | |
download | txr-1f47e0a98f45ac2e60e2e23d827fd2f8da6b4962.tar.gz txr-1f47e0a98f45ac2e60e2e23d827fd2f8da6b4962.tar.bz2 txr-1f47e0a98f45ac2e60e2e23d827fd2f8da6b4962.zip |
structs: lazily allocate special slots array.
A type which we never ask for a special slot need not
waste space the array.
* struct.c (struct struct_type): Change spslot from array to
pointer.
(make_struct_type): Initialize spslot pointer to zero.
(struct_type_destroy): Free the dynamic array.
(invalidate_special_slot_nonexistence): Do nothing if the
spslot pointer is null.
(get_special_static_slot): Dynamically allocate the array
if the spslot pointer is null, and update that pointer,
before doing anything else. The parameter signature changes;
instead of a pointer to an element of the stslot array, we
pass the index.
(get_equal_method): Pass the index of the equal method special
slot, rather than the address of the array entry.
Diffstat (limited to 'struct.h')
0 files changed, 0 insertions, 0 deletions