Commit 15b361fb authored by Deomid Ryabkov's avatar Deomid Ryabkov Committed by Cesanta Bot

Add mbuf_clear()

PUBLISHED_FROM=754b98b3000b24ad3b3d9cc0b4c480ca005a1c3f
parent 3130e592
...@@ -4,6 +4,7 @@ symbol_kind: "intro" ...@@ -4,6 +4,7 @@ symbol_kind: "intro"
decl_name: "mbuf.h" decl_name: "mbuf.h"
items: items:
- { name: mbuf_append.md } - { name: mbuf_append.md }
- { name: mbuf_clear.md }
- { name: mbuf_free.md } - { name: mbuf_free.md }
- { name: mbuf_init.md } - { name: mbuf_init.md }
- { name: mbuf_insert.md } - { name: mbuf_insert.md }
......
---
title: "mbuf_clear()"
decl_name: "mbuf_clear"
symbol_kind: "func"
signature: |
void mbuf_clear(struct mbuf *);
---
Removes all the data from mbuf (if any).
...@@ -1620,6 +1620,11 @@ void mbuf_remove(struct mbuf *mb, size_t n) { ...@@ -1620,6 +1620,11 @@ void mbuf_remove(struct mbuf *mb, size_t n) {
} }
} }
void mbuf_clear(struct mbuf *mb) WEAK;
void mbuf_clear(struct mbuf *mb) {
mb->len = 0;
}
#endif /* EXCLUDE_COMMON */ #endif /* EXCLUDE_COMMON */
#ifdef MG_MODULE_LINES #ifdef MG_MODULE_LINES
#line 1 "common/mg_str.c" #line 1 "common/mg_str.c"
......
...@@ -2388,6 +2388,9 @@ void mbuf_remove(struct mbuf *, size_t data_size); ...@@ -2388,6 +2388,9 @@ void mbuf_remove(struct mbuf *, size_t data_size);
*/ */
void mbuf_resize(struct mbuf *, size_t new_size); void mbuf_resize(struct mbuf *, size_t new_size);
/* Removes all the data from mbuf (if any). */
void mbuf_clear(struct mbuf *);
/* Shrinks an Mbuf by resizing its `size` to `len`. */ /* Shrinks an Mbuf by resizing its `size` to `len`. */
void mbuf_trim(struct mbuf *); void mbuf_trim(struct mbuf *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment