Small cleanup
This commit is contained in:
parent
64996976f4
commit
ee7c29346a
2 changed files with 28 additions and 10 deletions
|
|
@ -126,12 +126,28 @@ static inline void array__splice(VoidArray *self, size_t element_size,
|
|||
array__reserve(self, element_size, new_size);
|
||||
|
||||
char *contents = (char *)self->contents;
|
||||
if (self->size > old_end)
|
||||
memmove(contents + new_end * element_size, contents + old_end * element_size,
|
||||
(self->size - old_end) * element_size);
|
||||
if (new_count > 0)
|
||||
memcpy((contents + index * element_size), elements,
|
||||
new_count * element_size);
|
||||
if (self->size > old_end) {
|
||||
memmove(
|
||||
contents + new_end * element_size,
|
||||
contents + old_end * element_size,
|
||||
(self->size - old_end) * element_size
|
||||
);
|
||||
}
|
||||
if (new_count > 0) {
|
||||
if (elements) {
|
||||
memcpy(
|
||||
(contents + index * element_size),
|
||||
elements,
|
||||
new_count * element_size
|
||||
);
|
||||
} else {
|
||||
memset(
|
||||
(contents + index * element_size),
|
||||
0,
|
||||
new_count * element_size
|
||||
);
|
||||
}
|
||||
}
|
||||
self->size += new_count - old_count;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,10 +29,12 @@ static inline bool ts_language_is_symbol_external(const TSLanguage *self, TSSymb
|
|||
return 0 < symbol && symbol < self->external_token_count + 1;
|
||||
}
|
||||
|
||||
static inline const TSParseAction *ts_language_actions(const TSLanguage *self,
|
||||
TSStateId state,
|
||||
TSSymbol symbol,
|
||||
uint32_t *count) {
|
||||
static inline const TSParseAction *ts_language_actions(
|
||||
const TSLanguage *self,
|
||||
TSStateId state,
|
||||
TSSymbol symbol,
|
||||
uint32_t *count
|
||||
) {
|
||||
TableEntry entry;
|
||||
ts_language_table_entry(self, state, symbol, &entry);
|
||||
*count = entry.action_count;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue