mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
7061c79c22
- python now mixes audio 10x faster - python octal notation is restored - chibicc now builds code 3x faster - chibicc now has help documentation - chibicc can now generate basic python bindings - linenoise now supports some paredit-like features See #141
17 lines
458 B
C
17 lines
458 B
C
#include "third_party/chibicc/chibicc.h"
|
|
|
|
void strarray_push(StringArray *arr, char *s) {
|
|
size_t i;
|
|
if (!arr->data) {
|
|
arr->data = calloc(8, sizeof(char *));
|
|
arr->capacity = 8;
|
|
}
|
|
if (arr->len + 1 == arr->capacity) {
|
|
arr->capacity += arr->capacity >> 1;
|
|
arr->data = realloc(arr->data, arr->capacity * sizeof(*arr->data));
|
|
for (i = arr->len; i < arr->capacity; i++) {
|
|
arr->data[i] = 0;
|
|
}
|
|
}
|
|
arr->data[arr->len++] = s;
|
|
}
|