From 133b0c583f0d365175284a94c9b5411d62e3e5b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Mon, 26 Jul 2021 01:31:17 +0100 Subject: Move epan/wmem/wmem_scopes.h to epan/ This header was installed incorrectly to epan/wmem_scopes.h. Instead of creating additional installation rules for a single header in a subfolder (kept for backward compatibility) just rename the standard "epan/wmem/wmem.h" include to "epan/wmem_scopes.h" and fix the documentation. Now the header is installed *correctly* to epan/wmem_scopes.h. --- doc/README.request_response_tracking | 4 +--- doc/README.wmem | 16 ++++++++-------- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'doc') diff --git a/doc/README.request_response_tracking b/doc/README.request_response_tracking index 1081c4d5e8..eb9886a46c 100644 --- a/doc/README.request_response_tracking +++ b/doc/README.request_response_tracking @@ -27,11 +27,9 @@ The example below shows how simple this is to add to the dissector IF: The example is taken from the PANA dissector: -First we need to include the definitions for conversations and memory -management. +First we need to include the definitions for conversations. #include - #include Then we also need a few header fields to show the relations between request and response as well as the response time. diff --git a/doc/README.wmem b/doc/README.wmem index 27a2097722..3e1e95aaef 100644 --- a/doc/README.wmem +++ b/doc/README.wmem @@ -5,9 +5,9 @@ the old 'emem' framework which was removed in Wireshark 2.0. In order to make memory management easier and to reduce the probability of memory leaks, Wireshark provides its own memory management API. This API is -implemented inside epan/wmem/ and provides memory pools and functions that make +implemented inside wsutil/wmem/ and provides memory pools and functions that make it easy to manage memory even in the face of exceptions (which many dissector -functions can raise). +functions can raise). Memory scopes for dissection are defined in epan/wmem_scopes.h. Correct use of these functions will make your code faster, and greatly reduce the chances that it will leak memory in exceptional cases. @@ -19,7 +19,7 @@ https://www.wireshark.org/lists/wireshark-dev/201210/msg00178.html If you're writing a dissector, or other "userspace" code, then using wmem should be very similar to using malloc or g_malloc or whatever else you're used -to. All you need to do is include the header (epan/wmem/wmem.h) and optionally +to. All you need to do is include the header (epan/wmem_scopes.h) and optionally get a handle to a memory pool (if you want to *create* a memory pool, see the section "3. Usage for Producers" below). @@ -53,7 +53,7 @@ changed without warning. 2.2 Wireshark Global Pools -Dissectors that include the wmem header file will have three pools available +Dissectors that include the wmem_scopes.h header file will have three pools available to them automatically: pinfo->pool, wmem_file_scope() and wmem_epan_scope(); there is also a wmem_packet_scope() for cases when the `pinfo` argument is not accessible, but pinfo->pool should be preferred. @@ -66,7 +66,7 @@ current capture file is closed. NB: Using these pools outside of the appropriate scope (e.g. using the file pool when there isn't a file open) will throw an assertion. - See the comment in epan/wmem/wmem_scopes.c for details. + See the comment in epan/wmem_scopes.c for details. The epan pool is scoped to the library's lifetime - memory allocated in it is not freed until epan_cleanup() is called, which is typically but not necessarily @@ -170,7 +170,7 @@ To create a pool, include the regular wmem header and call the wmem_allocator_new() function with the appropriate type value. For example: - #include "wmem/wmem.h" + #include wmem_allocator_t *myPool; myPool = wmem_allocator_new(WMEM_ALLOCATOR_SIMPLE); @@ -186,7 +186,7 @@ document. Regardless of which allocator you used to create a pool, it can be destroyed with a call to the function wmem_destroy_allocator(). For example: - #include "wmem/wmem.h" + #include wmem_allocator_t *myPool; @@ -206,7 +206,7 @@ allowing it to be reused later. Depending on the type of allocator, doing this and recreating the pool. This method is therefore recommended, especially when the pool would otherwise be scoped to a single iteration of a loop. For example: - #include "wmem/wmem.h" + #include wmem_allocator_t *myPool; -- cgit v1.2.3