Use mg_snprintf()

This commit is contained in:
Sergey Lyubka committed 2022-02-10 11:56:55 +00:00
1 parent 9e634310b4
commit f64c86d23f
22 files changed
+659 -458

No files matched your search

+2 -1
View File
@@ -1,4 +1,5 @@
#include "fs.h"
#include "str.h"
struct packed_file {
const char *data;
@@ -47,7 +48,7 @@ static void packed_list(const char *dir, void (*fn)(const char *, void *),
begin = &path[n + 1];
end = strchr(begin, '/');
if (end == NULL) end = begin + strlen(begin);
snprintf(buf, sizeof(buf), "%.*s", (int) (end - begin), begin);
mg_snprintf(buf, sizeof(buf), "%.*s", (int) (end - begin), begin);
buf[sizeof(buf) - 1] = '\0';
// If this entry has been already listed, skip
// NOTE: we're assuming that file list is sorted alphabetically