Unbreak build

This commit is contained in:
Sergey Lyubka 2022-06-08 22:09:11 +01:00
parent cff208c5a9
commit b73115c002
5 changed files with 6 additions and 31 deletions

View File

@ -63,12 +63,6 @@ extern "C" {
#endif #endif
#endif // !defined(MG_ARCH) #endif // !defined(MG_ARCH)
#if defined(__GNUC__) && defined(__arm__)
#define PRINTF_LIKE(f, a) __attribute__((format(printf, f, a)))
#else
#define PRINTF_LIKE(f, a)
#endif
#if MG_ARCH == MG_ARCH_CUSTOM #if MG_ARCH == MG_ARCH_CUSTOM
#include <mongoose_custom.h> #include <mongoose_custom.h>
#endif #endif
@ -722,11 +716,11 @@ bool mg_globmatch(const char *pattern, size_t plen, const char *s, size_t n);
bool mg_commalist(struct mg_str *s, struct mg_str *k, struct mg_str *v); bool mg_commalist(struct mg_str *s, struct mg_str *k, struct mg_str *v);
bool mg_split(struct mg_str *s, struct mg_str *k, struct mg_str *v, char delim); bool mg_split(struct mg_str *s, struct mg_str *k, struct mg_str *v, char delim);
size_t mg_vsnprintf(char *buf, size_t len, const char *fmt, va_list ap); size_t mg_vsnprintf(char *buf, size_t len, const char *fmt, va_list ap);
size_t mg_snprintf(char *, size_t, const char *fmt, ...) PRINTF_LIKE(3, 4); size_t mg_snprintf(char *, size_t, const char *fmt, ...);
char *mg_hex(const void *buf, size_t len, char *dst); char *mg_hex(const void *buf, size_t len, char *dst);
void mg_unhex(const char *buf, size_t len, unsigned char *to); void mg_unhex(const char *buf, size_t len, unsigned char *to);
unsigned long mg_unhexn(const char *s, size_t len); unsigned long mg_unhexn(const char *s, size_t len);
size_t mg_asprintf(char **, size_t, const char *fmt, ...) PRINTF_LIKE(3, 4); size_t mg_asprintf(char **, size_t, const char *fmt, ...);
size_t mg_vasprintf(char **buf, size_t size, const char *fmt, va_list ap); size_t mg_vasprintf(char **buf, size_t size, const char *fmt, va_list ap);
int mg_check_ip_acl(struct mg_str acl, uint32_t remote_ip); int mg_check_ip_acl(struct mg_str acl, uint32_t remote_ip);
int64_t mg_to64(struct mg_str str); int64_t mg_to64(struct mg_str str);
@ -738,7 +732,7 @@ size_t mg_lld(char *buf, int64_t val, bool is_signed, bool is_hex);
enum { MG_LL_NONE, MG_LL_ERROR, MG_LL_INFO, MG_LL_DEBUG, MG_LL_VERBOSE }; enum { MG_LL_NONE, MG_LL_ERROR, MG_LL_INFO, MG_LL_DEBUG, MG_LL_VERBOSE };
void mg_log(const char *fmt, ...) PRINTF_LIKE(1, 2); void mg_log(const char *fmt, ...);
bool mg_log_prefix(int ll, const char *file, int line, const char *fname); bool mg_log_prefix(int ll, const char *file, int line, const char *fname);
void mg_log_set(const char *spec); void mg_log_set(const char *spec);
void mg_hexdump(const void *buf, size_t len); void mg_hexdump(const void *buf, size_t len);

View File

@ -36,12 +36,6 @@
#endif #endif
#endif // !defined(MG_ARCH) #endif // !defined(MG_ARCH)
#if defined(__GNUC__) && defined(__arm__)
#define PRINTF_LIKE(f, a) __attribute__((format(printf, f, a)))
#else
#define PRINTF_LIKE(f, a)
#endif
#if MG_ARCH == MG_ARCH_CUSTOM #if MG_ARCH == MG_ARCH_CUSTOM
#include <mongoose_custom.h> #include <mongoose_custom.h>
#endif #endif

View File

@ -4,7 +4,7 @@
#include "config.h" #include "config.h"
enum { MG_LL_NONE, MG_LL_ERROR, MG_LL_INFO, MG_LL_DEBUG, MG_LL_VERBOSE }; enum { MG_LL_NONE, MG_LL_ERROR, MG_LL_INFO, MG_LL_DEBUG, MG_LL_VERBOSE };
void mg_log(const char *fmt, ...) PRINTF_LIKE(1, 2); void mg_log(const char *fmt, ...);
bool mg_log_prefix(int ll, const char *file, int line, const char *fname); bool mg_log_prefix(int ll, const char *file, int line, const char *fname);
void mg_log_set(const char *spec); void mg_log_set(const char *spec);
void mg_hexdump(const void *buf, size_t len); void mg_hexdump(const void *buf, size_t len);

View File

@ -32,11 +32,11 @@ bool mg_globmatch(const char *pattern, size_t plen, const char *s, size_t n);
bool mg_commalist(struct mg_str *s, struct mg_str *k, struct mg_str *v); bool mg_commalist(struct mg_str *s, struct mg_str *k, struct mg_str *v);
bool mg_split(struct mg_str *s, struct mg_str *k, struct mg_str *v, char delim); bool mg_split(struct mg_str *s, struct mg_str *k, struct mg_str *v, char delim);
size_t mg_vsnprintf(char *buf, size_t len, const char *fmt, va_list ap); size_t mg_vsnprintf(char *buf, size_t len, const char *fmt, va_list ap);
size_t mg_snprintf(char *, size_t, const char *fmt, ...) PRINTF_LIKE(3, 4); size_t mg_snprintf(char *, size_t, const char *fmt, ...);
char *mg_hex(const void *buf, size_t len, char *dst); char *mg_hex(const void *buf, size_t len, char *dst);
void mg_unhex(const char *buf, size_t len, unsigned char *to); void mg_unhex(const char *buf, size_t len, unsigned char *to);
unsigned long mg_unhexn(const char *s, size_t len); unsigned long mg_unhexn(const char *s, size_t len);
size_t mg_asprintf(char **, size_t, const char *fmt, ...) PRINTF_LIKE(3, 4); size_t mg_asprintf(char **, size_t, const char *fmt, ...);
size_t mg_vasprintf(char **buf, size_t size, const char *fmt, va_list ap); size_t mg_vasprintf(char **buf, size_t size, const char *fmt, va_list ap);
int mg_check_ip_acl(struct mg_str acl, uint32_t remote_ip); int mg_check_ip_acl(struct mg_str acl, uint32_t remote_ip);
int64_t mg_to64(struct mg_str str); int64_t mg_to64(struct mg_str str);

View File

@ -1366,19 +1366,6 @@ static bool sn(const char *fmt, ...) {
return result; return result;
} }
static bool sn2(const char *expect, const char *fmt, ...) {
char buf[100];
va_list ap;
bool result;
va_start(ap, fmt);
mg_vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
va_start(ap, fmt);
result = strcmp(expect, buf) == 0;
if (!result) MG_ERROR(("[%s] != [%s]", expect, buf));
return result;
}
static bool sccmp(const char *s1, const char *s2, int expected) { static bool sccmp(const char *s1, const char *s2, int expected) {
int n1 = mg_casecmp(s1, s2); int n1 = mg_casecmp(s1, s2);
// MG_INFO(("[%s] [%s] %d %d", s1, s2, n1, expected)); // MG_INFO(("[%s] [%s] %d %d", s1, s2, n1, expected));