1
0
mirror of https://github.com/CPunch/Laika.git synced 2025-09-29 13:10:08 +00:00

shell: migrated to new vector API

- removed array API from lmem.h
- sterm.c: basically left as-is. see source for notes as to why
This commit is contained in:
2022-09-01 19:35:52 -05:00
parent 44086f563b
commit 169313ee39
6 changed files with 53 additions and 48 deletions

View File

@@ -55,30 +55,6 @@
name##_COUNT += numElem; \
} while (0);
#define laikaM_growarray(type, buf, needed, count, capacity) \
if (count + needed >= capacity || buf == NULL) { \
capacity = (capacity + needed) * GROW_FACTOR; \
buf = (type *)laikaM_realloc(buf, sizeof(type) * capacity); \
}
/* moves array elements above indx down by numElem, removing numElem elements at indx */
#define laikaM_rmvarray(buf, count, indx, numElem) \
do { \
int _i, _sz = ((count - indx) - numElem); \
for (_i = 0; _i < _sz; _i++) \
buf[indx + _i] = buf[indx + numElem + _i]; \
count -= numElem; \
} while (0);
/* moves array elements above indx up by numElem, inserting numElem elements at indx */
#define laikaM_insertarray(buf, count, indx, numElem) \
do { \
int _i; \
for (_i = count; _i > indx; _i--) \
buf[_i] = buf[_i - 1]; \
count += numElem; \
} while (0);
void *laikaM_realloc(void *buf, size_t sz);
#endif