Remove MG_ENABLE_DIRLIST

This commit is contained in:
Sergey Lyubka committed 2022-02-14 11:19:24 +00:00
1 parent 969b84043c
commit 5bc164de76
10 files changed
+35 -33

No files matched your search

-1
View File
@@ -18,6 +18,5 @@
#include <time.h>
#define MG_PATH_MAX 128
#define MG_ENABLE_DIRLIST 1
#endif
-1
View File
@@ -22,6 +22,5 @@
#include <esp_system.h>
#define MG_PATH_MAX 128
#define MG_ENABLE_DIRLIST 1
#endif
-4
View File
@@ -30,8 +30,4 @@
#include <time.h>
#include <unistd.h>
#ifndef MG_ENABLE_DIRLIST
#define MG_ENABLE_DIRLIST 1
#endif
#endif
-4
View File
@@ -86,8 +86,4 @@ typedef int socklen_t;
#define S_ISDIR(x) (((x) &_S_IFMT) == _S_IFDIR)
#endif
#ifndef MG_ENABLE_DIRLIST
#define MG_ENABLE_DIRLIST 1
#endif
#endif
+1 -1
View File
@@ -50,7 +50,7 @@
#endif
#ifndef MG_ENABLE_DIRLIST
#define MG_ENABLE_DIRLIST 0
#define MG_ENABLE_DIRLIST 1
#endif
#ifndef MG_ENABLE_CUSTOM_RANDOM
+16 -5
View File
@@ -81,9 +81,17 @@ const char *mg_strstr(const struct mg_str haystack,
return NULL;
}
static bool is_digit(int c) {
return c >= '0' && c <= '9';
}
static bool is_space(int c) {
return c == ' ' || c == '\r' || c == '\n' || c == '\t';
}
struct mg_str mg_strstrip(struct mg_str s) {
while (s.len > 0 && isspace((int) *s.ptr)) s.ptr++, s.len--;
while (s.len > 0 && isspace((int) *(s.ptr + s.len - 1))) s.len--;
while (s.len > 0 && is_space((int) *s.ptr)) s.ptr++, s.len--;
while (s.len > 0 && is_space((int) *(s.ptr + s.len - 1))) s.len--;
return s;
}
@@ -296,14 +304,14 @@ size_t mg_vsnprintf(char *buf, size_t len, const char *fmt, va_list ap) {
if (c == '#') x++, c = fmt[++i];
if (c == '-') minus++, c = fmt[++i];
if (c == '0') pad = '0', c = fmt[++i];
while (isdigit(c)) w *= 10, w += (size_t) (c - '0'), c = fmt[++i];
while (is_digit(c)) w *= 10, w += (size_t) (c - '0'), c = fmt[++i];
if (c == '.') {
c = fmt[++i];
if (c == '*') {
pr = (size_t) va_arg(ap, int);
c = fmt[++i];
} else {
while (isdigit(c)) pr *= 10, pr += (size_t) (c - '0'), c = fmt[++i];
while (is_digit(c)) pr *= 10, pr += (size_t) (c - '0'), c = fmt[++i];
}
}
while (c == 'h') c = fmt[++i]; // Treat h and hh as int
@@ -351,7 +359,10 @@ size_t mg_vsnprintf(char *buf, size_t len, const char *fmt, va_list ap) {
if (n < len) buf[n] = '%';
n++;
} else {
abort(); // Unsupported format specifier
if (n < len) buf[n] = '%';
n++;
if (n < len) buf[n] = c;
n++;
}
i++;
} else {