mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-18 10:59:45 +00:00
update examples
This commit is contained in:
1 parent
074ef5197b
commit
f5e2c68c8b
27 files changed
+166
-47
No files matched your search
@@ -1,6 +1,7 @@
|
||||
#include "fs.h"
|
||||
#include "printf.h"
|
||||
#include "str.h"
|
||||
#include "util.h"
|
||||
|
||||
struct mg_fd *mg_fs_open(struct mg_fs *fs, const char *path, int flags) {
|
||||
struct mg_fd *fd = (struct mg_fd *) mg_calloc(1, sizeof(*fd));
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "fs.h"
|
||||
#include "printf.h"
|
||||
#include "str.h"
|
||||
#include "util.h"
|
||||
|
||||
struct packed_file {
|
||||
const char *data;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "json.h"
|
||||
#include "base64.h"
|
||||
#include "fmt.h"
|
||||
#include "util.h"
|
||||
|
||||
static const char *escapeseq(int esc) {
|
||||
return esc ? "\b\f\n\r\t\\\"" : "bfnrt\\\"";
|
||||
|
||||
@@ -219,7 +219,7 @@ struct mg_timer *mg_timer_add(struct mg_mgr *mgr, uint64_t milliseconds,
|
||||
unsigned flags, void (*fn)(void *), void *arg) {
|
||||
struct mg_timer *t = (struct mg_timer *) mg_calloc(1, sizeof(*t));
|
||||
if (t != NULL) {
|
||||
flags |= MG_TIMER_AUTODELETE; // We have mg_calloc-ed it, so autodelete
|
||||
flags |= MG_TIMER_AUTODELETE; // We have alloc'ed it, so autodelete
|
||||
mg_timer_init(&mgr->timers, t, milliseconds, flags, fn, arg);
|
||||
}
|
||||
return t;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "rpc.h"
|
||||
#include "printf.h"
|
||||
#include "util.h"
|
||||
|
||||
void mg_rpc_add(struct mg_rpc **head, struct mg_str method,
|
||||
void (*fn)(struct mg_rpc_req *), void *fn_data) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "log.h"
|
||||
#include "printf.h"
|
||||
#include "ssi.h"
|
||||
#include "util.h"
|
||||
|
||||
#ifndef MG_MAX_SSI_DEPTH
|
||||
#define MG_MAX_SSI_DEPTH 5
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "str.h"
|
||||
#include "util.h"
|
||||
|
||||
struct mg_str mg_str_s(const char *s) {
|
||||
struct mg_str str = {(char *) s, s == NULL ? 0 : strlen(s)};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "arch.h"
|
||||
#include "timer.h"
|
||||
#include "util.h"
|
||||
|
||||
void mg_timer_init(struct mg_timer **head, struct mg_timer *t, uint64_t ms,
|
||||
unsigned flags, void (*fn)(void *), void *arg) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "printf.h"
|
||||
#include "profile.h"
|
||||
#include "tls.h"
|
||||
#include "util.h"
|
||||
|
||||
#if MG_TLS == MG_TLS_MBED
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "printf.h"
|
||||
#include "tls.h"
|
||||
#include "util.h"
|
||||
|
||||
#if MG_TLS == MG_TLS_OPENSSL || MG_TLS == MG_TLS_WOLFSSL
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "tls.h"
|
||||
#include "tls_rsa.h"
|
||||
#include "util.h"
|
||||
|
||||
#if MG_TLS == MG_TLS_BUILTIN
|
||||
|
||||
@@ -320,6 +321,48 @@ NS_INTERNAL BI_CTX *bi_initialize(void) {
|
||||
return ctx;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* @brief Close the bigint context and free any resources.
|
||||
*
|
||||
* Free up any used memory - a check is done if all objects were not
|
||||
* properly freed.
|
||||
* @param ctx [in] The bigint session context.
|
||||
*/
|
||||
NS_INTERNAL void bi_terminate(BI_CTX *ctx) {
|
||||
bi_depermanent(ctx->bi_radix);
|
||||
bi_free(ctx, ctx->bi_radix);
|
||||
|
||||
if (ctx->active_count != 0) {
|
||||
#ifdef CONFIG_SSL_FULL_MODE
|
||||
printf("bi_terminate: there were %d un-freed bigints\n", ctx->active_count);
|
||||
#endif
|
||||
abort();
|
||||
}
|
||||
|
||||
bi_clear_cache(ctx);
|
||||
mg_free(ctx);
|
||||
}
|
||||
|
||||
/**
|
||||
*@brief Clear the memory cache.
|
||||
*/
|
||||
NS_INTERNAL void bi_clear_cache(BI_CTX *ctx) {
|
||||
bigint *p, *pn;
|
||||
|
||||
if (ctx->free_list == NULL) return;
|
||||
|
||||
for (p = ctx->free_list; p != NULL; p = pn) {
|
||||
pn = p->next;
|
||||
mg_free(p->comps);
|
||||
mg_free(p);
|
||||
}
|
||||
|
||||
ctx->free_count = 0;
|
||||
ctx->free_list = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Increment the number of references to this object.
|
||||
* It does not do a full copy.
|
||||
|
||||
Reference in new issue
Block a user