Improve memory allocation APIs

- replace `qe_malloc_dup()` with `qe_malloc_dup_bytes()` and `qe_malloc_dup_array()`
- replace `qe_realloc()` with `qe_realloc_bytes()` and `qe_realloc_array()`
- pass numbers of objects to `qe_malloc_dup_array` and `qe_realloc_array`
- add `qe_strndup()`
This commit is contained in:
oguillaumin 2024-07-28 19:22:07 +02:00 • committed by Charlie Gordon
commit 494ea38c33
12 changed files with 136 additions and 45 deletions

View file

@ -1077,7 +1077,7 @@ void css_parse_style_sheet(CSSStyleSheet *s, CSSParseState *b)
if (qe_isalpha(ch)) {
tree_op = CSS_TREE_OP_DESCENDANT;
add_tree:
ss1 = qe_malloc_dup(ss, sizeof(CSSSimpleSelector));
ss1 = qe_malloc_dup_array(ss, 1);
if (ss1) {
last_ss = ss1;
}