mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-29 12:41:03 +00:00
Make mg_random() weak, see #1269
This commit is contained in:
1 parent
7061b7202f
commit
31c9e3fb7e
3 files changed
+33
-28
No files matched your search
+14
-14
@@ -3,11 +3,24 @@
|
||||
#include "arch.h"
|
||||
#include "str.h"
|
||||
|
||||
// WEAK symbol makes it possible to define a "default" function implementation,
|
||||
// which could be overridden by the user who can define a function with the
|
||||
// same name without linking conflict
|
||||
#if !defined(WEAK)
|
||||
#if (defined(__GNUC__) || defined(__clang__) || \
|
||||
defined(__TI_COMPILER_VERSION__)) && \
|
||||
!defined(_WIN32) && !defined(__CYGWIN__)
|
||||
#define WEAK __attribute__((weak))
|
||||
#else
|
||||
#define WEAK
|
||||
#endif
|
||||
#endif
|
||||
|
||||
char *mg_file_read(const char *path, size_t *size);
|
||||
int64_t mg_file_size(const char *path);
|
||||
bool mg_file_write(const char *path, const void *buf, size_t len);
|
||||
bool mg_file_printf(const char *path, const char *fmt, ...);
|
||||
void mg_random(void *buf, size_t len);
|
||||
void mg_random(void *buf, size_t len) WEAK;
|
||||
bool mg_globmatch(const char *pattern, int plen, const char *s, int n);
|
||||
bool mg_next_comma_entry(struct mg_str *s, struct mg_str *k, struct mg_str *v);
|
||||
uint16_t mg_ntohs(uint16_t net);
|
||||
@@ -37,19 +50,6 @@ FILE *mg_fopen(const char *fp, const char *mode);
|
||||
#define mg_htons(x) mg_ntohs(x)
|
||||
#define mg_htonl(x) mg_ntohl(x)
|
||||
|
||||
// WEAK symbol makes it possible to define a "default" function implementation,
|
||||
// which could be overridden by the user who can define a function with the
|
||||
// same name without linking conflict
|
||||
#if !defined(WEAK)
|
||||
#if (defined(__GNUC__) || defined(__clang__) || \
|
||||
defined(__TI_COMPILER_VERSION__)) && \
|
||||
!defined(_WIN32) && !defined(__CYGWIN__)
|
||||
#define WEAK __attribute__((weak))
|
||||
#else
|
||||
#define WEAK
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Expands to a string representation of its argument: e.g.
|
||||
// MG_STRINGIFY_LITERAL(5) expands to "5"
|
||||
#if !defined(_MSC_VER) || _MSC_VER >= 1900
|
||||
|
||||
Reference in new issue
Block a user