Refactor type byte -> byte_t

Simpler to read as a type.  This style will allow me to define signed
versions of the base types as simpler names than what they are
currently.
This commit is contained in:
2024-04-25 10:48:51 +05:30
parent 159501168c
commit 1dfdbb3cd0
10 changed files with 39 additions and 38 deletions

View File

@@ -27,7 +27,7 @@
*/
typedef struct
{
byte *data;
byte_t *data;
size_t used, available;
} darr_t;
@@ -58,19 +58,19 @@ void darr_ensure_capacity(darr_t *darr, size_t n);
* If the dynamic array doesn't have enough space it will reallocate
* to ensure it can fit it in.
*/
void darr_append_byte(darr_t *darr, byte b);
void darr_append_byte(darr_t *darr, byte_t b);
/** Append an array of n bytes (b) to the dynamic array (darr).
* If the dynamic array doesn't have enough space to fit all n bytes
* it will reallocate to ensure it can fit it in.
*/
void darr_append_bytes(darr_t *darr, byte *b, size_t n);
void darr_append_bytes(darr_t *darr, byte_t *b, size_t n);
/** Safely get the nth byte of the dynamic array (darr)
* If the dynamic array has less than n bytes used, it will return 0
* as a default value.
*/
byte darr_at(darr_t *darr, size_t n);
byte_t darr_at(darr_t *darr, size_t n);
/** Write the dynamic array (darr) to the file pointer (fp) as a
* buffer of bytes.