write documentation for nbt_procarr.

This commit is contained in:
2025-08-24 12:51:59 +02:00
parent 7feb193c51
commit 40b8c0ef30

View File

@@ -98,6 +98,9 @@ const u8 *nbt_nexttag(const u8 *restrict buf) {
return tag; return tag;
} }
/* processes an array at `buf`, of `nmem` items with a size of `size`
* returns a malloc'd pointer (which may be `NULL`) to the data.
* the data is converted from big endian to little endian on little endian systems. */
MALLOC static void *nbt_procarr(const u8 *restrict buf, i32 nmem, uint size) { MALLOC static void *nbt_procarr(const u8 *restrict buf, i32 nmem, uint size) {
u8 *ptr = malloc(nmem * size); u8 *ptr = malloc(nmem * size);
if (!ptr) return NULL; if (!ptr) return NULL;