mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-27 15:01:03 +08:00
Fix #1298 - shadowing struct mg_str constructor
This commit is contained in:
parent
80fcba91c8
commit
77fae5c562
3
Makefile
3
Makefile
@ -50,7 +50,6 @@ test++: test
|
||||
# Make sure we can build from an unamalgamated sources
|
||||
unamalgamated: $(SRCS) $(HDRS) Makefile
|
||||
$(CLANG) src/*.c test/unit_test.c $(CFLAGS) $(LDFLAGS) -g -o unit_test
|
||||
|
||||
fuzz: mongoose.c mongoose.h Makefile test/fuzz.c
|
||||
$(CLANG) mongoose.c test/fuzz.c $(CFLAGS) -DMG_ENABLE_LINES -DMG_ENABLE_LOG=0 -fsanitize=fuzzer,signed-integer-overflow,address $(LDFLAGS) -g -o fuzzer
|
||||
$(DEBUGGER) ./fuzzer
|
||||
@ -96,7 +95,7 @@ linux: Makefile mongoose.c mongoose.h test/unit_test.c
|
||||
$(GCC) ./unit_test_gcc
|
||||
|
||||
linux++: CC = g++
|
||||
linux++: WARN += -Wno-shadow # Ignore "hides constructor for 'struct mg_str'"
|
||||
linux++: WARN += -Wno-missing-field-initializers
|
||||
linux++: linux
|
||||
|
||||
linux-libs: CFLAGS += -fPIC
|
||||
|
@ -3282,7 +3282,7 @@ void mg_http_serve_ssi(struct mg_connection *c, const char *root,
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
struct mg_str mg_str(const char *s) {
|
||||
struct mg_str mg_str_s(const char *s) {
|
||||
struct mg_str str = {s, s == NULL ? 0 : strlen(s)};
|
||||
return str;
|
||||
}
|
||||
|
@ -459,6 +459,9 @@ struct mg_str {
|
||||
#define MG_NULL_STR \
|
||||
{ NULL, 0 }
|
||||
|
||||
// Using macro to avoid shadowing C++ struct constructor, see #1298
|
||||
#define mg_str(s) mg_str_s(s)
|
||||
|
||||
struct mg_str mg_str(const char *s);
|
||||
struct mg_str mg_str_n(const char *s, size_t n);
|
||||
int mg_lower(const char *s);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "str.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
struct mg_str mg_str(const char *s) {
|
||||
struct mg_str mg_str_s(const char *s) {
|
||||
struct mg_str str = {s, s == NULL ? 0 : strlen(s)};
|
||||
return str;
|
||||
}
|
||||
|
@ -11,6 +11,9 @@ struct mg_str {
|
||||
#define MG_NULL_STR \
|
||||
{ NULL, 0 }
|
||||
|
||||
// Using macro to avoid shadowing C++ struct constructor, see #1298
|
||||
#define mg_str(s) mg_str_s(s)
|
||||
|
||||
struct mg_str mg_str(const char *s);
|
||||
struct mg_str mg_str_n(const char *s, size_t n);
|
||||
int mg_lower(const char *s);
|
||||
|
Loading…
x
Reference in New Issue
Block a user