Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
4bc9f242
Commit
4bc9f242
authored
Dec 16, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add nghttp2_mem example
parent
d695d2cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
lib/includes/nghttp2/nghttp2.h
lib/includes/nghttp2/nghttp2.h
+32
-0
No files found.
lib/includes/nghttp2/nghttp2.h
View file @
4bc9f242
...
...
@@ -1725,6 +1725,38 @@ typedef void *(*nghttp2_realloc)(void *ptr, size_t size, void *mem_user_data);
* Custom memory allocator functions and user defined pointer. The
* |mem_user_data| member is passed to each allocator function. This
* can be used, for example, to achieve per-session memory pool.
*
* In the following example code, ``my_malloc``, ``my_free``,
* ``my_calloc`` and ``my_realloc`` are the replacement of the
* standard allocators ``malloc``, ``free``, ``calloc`` and
* ``realloc`` respectively::
*
* void *my_malloc_cb(size_t size, void *mem_user_data) {
* return my_malloc(size);
* }
*
* void my_free_cb(void *ptr, void *mem_user_data) { my_free(ptr); }
*
* void *my_calloc_cb(size_t nmemb, size_t size, void *mem_user_data) {
* return my_calloc(nmemb, size);
* }
*
* void *my_realloc_cb(void *ptr, size_t size, void *mem_user_data) {
* return my_realloc(ptr, size);
* }
*
* void session_new() {
* nghttp2_session *session;
* nghttp2_session_callbacks *callbacks;
* nghttp2_mem mem = {NULL, my_malloc_cb, my_free_cb, my_calloc_cb,
* my_realloc_cb};
*
* ...
*
* nghttp2_session_client_new3(&session, callbacks, NULL, NULL, &mem);
*
* ...
* }
*/
typedef
struct
{
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment