diff options
author | Evan Huus <eapache@gmail.com> | 2021-07-16 11:36:34 -0400 |
---|---|---|
committer | Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2021-07-21 05:38:29 +0000 |
commit | d6d7dd1e5664810b368231d03d56465112e3d82e (patch) | |
tree | 4f95a8b408e58b8edc0b4a2c17831b58049beaf3 /doc | |
parent | ef542759d0c7003a495436f2194d5821bfc30bd4 (diff) |
First pass pinfo->pool conversion
Automated find/replace of wmem_packet_scope() with pinfo->pool in all
files where it didn't cause a build failure.
I also tweaked a few of the docs which got caught up.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/README.developer | 6 | ||||
-rw-r--r-- | doc/README.request_response_tracking | 2 | ||||
-rw-r--r-- | doc/README.wmem | 11 |
3 files changed, 10 insertions, 9 deletions
diff --git a/doc/README.developer b/doc/README.developer index dacaca5d78..270e7713d4 100644 --- a/doc/README.developer +++ b/doc/README.developer @@ -452,7 +452,7 @@ instead allocate a buffer dynamically using the string-specific or plain wmem routines (see README.wmem) such as wmem_strbuf_t *strbuf; - strbuf = wmem_strbuf_new(wmem_packet_scope(), ""); + strbuf = wmem_strbuf_new(pinfo->pool, ""); wmem_strbuf_append_printf(strbuf, ... or @@ -460,7 +460,7 @@ or char *buffer=NULL; ... #define MAX_BUFFER 1024 - buffer=wmem_alloc(wmem_packet_scope(), MAX_BUFFER); + buffer=wmem_alloc(pinfo->pool, MAX_BUFFER); buffer[0]='\0'; ... snprintf(buffer, MAX_BUFFER, ... @@ -491,7 +491,7 @@ instead write the code as static void foo_to_str(char **buffer, ... #define MAX_BUFFER x - *buffer=wmem_alloc(wmem_packet_scope(), MAX_BUFFER); + *buffer=wmem_alloc(pinfo->pool, MAX_BUFFER); <fill in *buffer> } ... diff --git a/doc/README.request_response_tracking b/doc/README.request_response_tracking index 519c0bc97e..1081c4d5e8 100644 --- a/doc/README.request_response_tracking +++ b/doc/README.request_response_tracking @@ -122,7 +122,7 @@ actual dissector. } if (!pana_trans) { /* create a "fake" pana_trans structure */ - pana_trans=wmem_new(wmem_packet_scope(), pana_transaction_t); + pana_trans=wmem_new(pinfo->pool, pana_transaction_t); pana_trans->req_frame = 0; pana_trans->rep_frame = 0; pana_trans->req_time = pinfo->fd->abs_ts; diff --git a/doc/README.wmem b/doc/README.wmem index 79ec946df3..27a2097722 100644 --- a/doc/README.wmem +++ b/doc/README.wmem @@ -54,17 +54,18 @@ changed without warning. 2.2 Wireshark Global Pools Dissectors that include the wmem header file will have three pools available -to them automatically: wmem_packet_scope(), wmem_file_scope() and -wmem_epan_scope(); +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. -The packet pool is scoped to the dissection of each packet, meaning that any +The pinfo pool is scoped to the dissection of each packet, meaning that any memory allocated in it will be automatically freed at the end of the current packet. The file pool is similarly scoped to the dissection of each file, meaning that any memory allocated in it will be automatically freed when the current capture file is closed. -NB: Using these pools outside of the appropriate scope (e.g. using the packet - pool when there isn't a packet being dissected) will throw an assertion. +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. The epan pool is scoped to the library's lifetime - memory allocated in it is |