refactor: add helpers for file I/O, main script detection, safe strncpy, & make hal generic
This commit is contained in:
parent
a33d4c0068
commit
db82efe269
19 changed files with 327 additions and 457 deletions
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifndef pxl8_min
|
||||
#define pxl8_min(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
|
@ -7,3 +9,10 @@
|
|||
#ifndef pxl8_max
|
||||
#define pxl8_max(a, b) ((a) > (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef pxl8_strncpy
|
||||
#define pxl8_strncpy(dst, src, size) do { \
|
||||
strncpy((dst), (src), (size) - 1); \
|
||||
(dst)[(size) - 1] = '\0'; \
|
||||
} while (0)
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue