diff options
| author | Nicholas Rodrigues Lordello <[email protected]> | 2026-10-10 20:25:21 +0200 |
|---|---|---|
| committer | Nicholas Rodrigues Lordello <[email protected]> | 2026-10-10 20:25:21 +0200 |
| commit | bfcf30e800c68e0289f17b3967081280fca6592c (patch) | |
| tree | 96e29101ab4cd85d144744307e82ae436e87726a /tools | |
| parent | 70d2db07ec4dd5034c6d888258a3fd945c67e4d4 (diff) | |
Fixed Minor Portability Issues
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/generate-sysroot.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/tools/generate-sysroot.c b/tools/generate-sysroot.c index 4400fcd..e6d93f8 100644 --- a/tools/generate-sysroot.c +++ b/tools/generate-sysroot.c @@ -1,10 +1,12 @@ -#include <limits.h> #include <stdarg.h> #include <stdbool.h> #include <stddef.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> +#define PW_PATH_MAX 1024 + static inline void check(bool cond, char const *msg) { if (!cond) { perror(msg); @@ -22,10 +24,10 @@ static void fprintfx(FILE *f, char const *fmt, ...) { static void fclosex(FILE *f) { check(!fclose(f), "fclose"); } -static void joinpath(char buffer[static PATH_MAX], char const *dir, +static void joinpath(char buffer[static PW_PATH_MAX], char const *dir, char const *file) { - size_t n = snprintf(buffer, PATH_MAX, "%s/%s", dir, file); - check(n < PATH_MAX, "joinpath"); + size_t n = snprintf(buffer, PW_PATH_MAX, "%s/%s", dir, file); + check(n < PW_PATH_MAX, "joinpath"); } struct sysroot_output { @@ -35,7 +37,7 @@ struct sysroot_output { static void open_sysroot_output(struct sysroot_output *out, char const *outdir) { - char path[PATH_MAX]; + char path[PW_PATH_MAX]; joinpath(path, outdir, "sysroot.h"); out->h = fopen(path, "w"); @@ -125,7 +127,7 @@ int main(int argc, char *argv[argc + 1]) { {"unknown_p8_png", "unknown.p8.png"}, }; for (size_t i = 0; i < sizeof entries / sizeof entries[0]; i++) { - char file[PATH_MAX]; + char file[PW_PATH_MAX]; joinpath(file, sysroot, entries[i].file); write_sysroot_data(&out, entries[i].name, file); } |
