fix: remove recursive functions and improve (theoretical) performance

note that lists are no longer handled here, this will be re-implemented
in a newer commit. The basic functionality for compound/end and other
tags are there, though.
This commit is contained in:
2025-08-18 14:28:34 +02:00
parent e6cc6ce2e8
commit 10a2aca0a5
2 changed files with 25 additions and 81 deletions

View File

@@ -50,19 +50,9 @@ struct nbt_procdat {
i16 dpt, mdpt;
};
/* searches for the end of a compound tag without processing data, the final pointer is returned.
* `NULL` is returned upon failure, the otherwise returned pointer is not guaranteed to be valid.
* `cdat` is assumed to be the start of the **compound tag's data**. */
PURE NONNULL((1)) const u8 *nbt_nextcompound(const u8 *restrict cdat);
/* searches for the end of a list tag without processing data, the final pointer is returned.
* `NULL` is returned upon failure, the otherwise returned pointer is not guaranteed to be valid.
* `ldat` is assumed to be the start of the **list tag's data.** */
PURE NONNULL((1)) const u8 *nbt_nextlist(const u8 *restrict ldat);
/* searches for the end of a named tag without processing data, the final pointer is returned.
* `NULL` is returned upon failure, the otherwise returned pointer is not guaranteed to be valid. */
PURE NONNULL((1)) const u8 *nbt_nexttag(const u8 *restrict buf, u16 naml);
PURE NONNULL((1)) const u8 *nbt_nexttag(const u8 *restrict buf);
/* initialises a data structure used whilst processing the tags */
PURE NONNULL((1)) struct nbt_procdat nbt_initproc(struct nbt_path const *restrict pats, uint npats);