mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-11 16:40:17 +00:00
Move mg_a*printf to common
PUBLISHED_FROM=cccd28ef43ec4e08fa52340ce78bda10db5ac27a
This commit is contained in:
1 parent
9dba6c806b
commit
a23daa1547
5 files changed
+73
-99
No files matched your search
+20
-20
@@ -1869,6 +1869,26 @@ int mg_ncasecmp(const char *s1, const char *s2, size_t len);
|
||||
*/
|
||||
int mg_casecmp(const char *s1, const char *s2);
|
||||
|
||||
/*
|
||||
* Prints message to the buffer. If the buffer is large enough to hold the
|
||||
* message, it returns buffer. If buffer is to small, it allocates a large
|
||||
* enough buffer on heap and returns allocated buffer.
|
||||
* This is a supposed use case:
|
||||
*
|
||||
* char buf[5], *p = buf;
|
||||
* mg_avprintf(&p, sizeof(buf), "%s", "hi there");
|
||||
* use_p_somehow(p);
|
||||
* if (p != buf) {
|
||||
* free(p);
|
||||
* }
|
||||
*
|
||||
* The purpose of this is to avoid malloc-ing if generated strings are small.
|
||||
*/
|
||||
int mg_asprintf(char **buf, size_t size, const char *fmt, ...);
|
||||
|
||||
/* Same as mg_asprintf, but takes varargs list. */
|
||||
int mg_avprintf(char **buf, size_t size, const char *fmt, va_list ap);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -3763,26 +3783,6 @@ void mg_hexdump_connection(struct mg_connection *nc, const char *path,
|
||||
const void *buf, int num_bytes, int ev);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Prints message to the buffer. If the buffer is large enough to hold the
|
||||
* message, it returns buffer. If buffer is to small, it allocates a large
|
||||
* enough buffer on heap and returns allocated buffer.
|
||||
* This is a supposed use case:
|
||||
*
|
||||
* char buf[5], *p = buf;
|
||||
* mg_avprintf(&p, sizeof(buf), "%s", "hi there");
|
||||
* use_p_somehow(p);
|
||||
* if (p != buf) {
|
||||
* free(p);
|
||||
* }
|
||||
*
|
||||
* The purpose of this is to avoid malloc-ing if generated strings are small.
|
||||
*/
|
||||
int mg_asprintf(char **buf, size_t size, const char *fmt, ...);
|
||||
|
||||
/* Same as mg_asprintf, but takes varargs list. */
|
||||
int mg_avprintf(char **buf, size_t size, const char *fmt, va_list ap);
|
||||
|
||||
/*
|
||||
* Returns true if target platform is big endian.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user