aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-08-12 23:34:59 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-08-12 23:34:59 +0000
commit9d17101f941f9005fdb813f2cf27159d922e2a9c (patch)
tree072eee25e796c0eaabce0ba99ff217556bd65b24
parenta6af4ea93e9e0f718810a49b8c7ca27ea08c621c (diff)
gmemchunk -> se_alloc() improvements
svn path=/trunk/; revision=15324
-rw-r--r--epan/dissectors/packet-ajp13.c31
-rw-r--r--epan/dissectors/packet-aoe.c13
2 files changed, 5 insertions, 39 deletions
diff --git a/epan/dissectors/packet-ajp13.c b/epan/dissectors/packet-ajp13.c
index 6ad7ccc437..c8687ac6f3 100644
--- a/epan/dissectors/packet-ajp13.c
+++ b/epan/dissectors/packet-ajp13.c
@@ -34,6 +34,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include <epan/emem.h>
#include <epan/conversation.h>
#include "packet-tcp.h"
@@ -222,16 +223,10 @@ typedef struct ajp13_conv_data {
gboolean was_get_body_chunk; /* XXX - not used */
} ajp13_conv_data;
-static GMemChunk *ajp13_conv_data_chunk = NULL;
-
typedef struct ajp13_frame_data {
gboolean is_request_body;
} ajp13_frame_data;
-static GMemChunk *ajp13_frame_data_chunk = NULL;
-
-static int ajp13_packet_init_count = 100;
-
/* ajp13, in sort of a belt-and-suspenders move, encodes strings with
* both a leading length field, and a trailing null. Mostly, see
* AJPv13.html. The returned length _includes_ the trailing null, if
@@ -648,7 +643,7 @@ dissect_ajp13_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
cd = (ajp13_conv_data*)conversation_get_proto_data(conv, proto_ajp13);
if (!cd) {
- cd = (ajp13_conv_data*)g_mem_chunk_alloc(ajp13_conv_data_chunk);
+ cd = se_alloc(sizeof(ajp13_conv_data));
cd->content_length = 0;
cd->was_get_body_chunk = FALSE;
conversation_add_proto_data(conv, proto_ajp13, cd);
@@ -665,7 +660,7 @@ dissect_ajp13_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* time we've see the packet, and it must be the first "in order"
* pass through the data.
*/
- fd = (ajp13_frame_data*)g_mem_chunk_alloc(ajp13_frame_data_chunk);
+ fd = se_alloc(sizeof(ajp13_frame_data));
p_add_proto_data(pinfo->fd, proto_ajp13, fd);
fd->is_request_body = FALSE;
if (cd->content_length) {
@@ -751,25 +746,6 @@ dissect_ajp13(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
-static void
-ajp13_init_protocol(void)
-{
- if (ajp13_conv_data_chunk)
- g_mem_chunk_destroy(ajp13_conv_data_chunk);
- if (ajp13_frame_data_chunk)
- g_mem_chunk_destroy(ajp13_frame_data_chunk);
-
- ajp13_conv_data_chunk = g_mem_chunk_new("ajp13_conv_data_chunk",
- sizeof(ajp13_conv_data),
- ajp13_packet_init_count * sizeof(ajp13_conv_data),
- G_ALLOC_ONLY);
-
- ajp13_frame_data_chunk = g_mem_chunk_new("ajp13_frame_data_chunk",
- sizeof(ajp13_frame_data),
- ajp13_packet_init_count * sizeof(ajp13_frame_data),
- G_ALLOC_ONLY);
-}
-
void
proto_register_ajp13(void)
{
@@ -863,7 +839,6 @@ proto_register_ajp13(void)
proto_register_field_array(proto_ajp13, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
- register_init_routine(&ajp13_init_protocol);
}
diff --git a/epan/dissectors/packet-aoe.c b/epan/dissectors/packet-aoe.c
index e0cfd48d50..5592fc8b48 100644
--- a/epan/dissectors/packet-aoe.c
+++ b/epan/dissectors/packet-aoe.c
@@ -28,6 +28,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include <epan/emem.h>
#include <epan/conversation.h>
#include <etypes.h>
@@ -178,8 +179,6 @@ typedef struct ata_info_t {
nstime_t req_time;
guint8 cmd;
} ata_info_t;
-static GMemChunk *ata_info_chunk = NULL;
-static guint ata_info_chunk_count = 50;
static GHashTable *ata_cmd_unmatched;
static GHashTable *ata_cmd_matched;
@@ -237,7 +236,7 @@ dissect_ata_pdu(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset,
ata_info_t *tmp_ata_info;
/* first time we see this request so add a struct for request/response
matching */
- ata_info=g_mem_chunk_alloc(ata_info_chunk);
+ ata_info=se_alloc(sizeof(ata_info_t));
ata_info->tag=tag;
ata_info->conversation=conversation;
ata_info->request_frame=pinfo->fd->num;
@@ -428,14 +427,6 @@ dissect_aoe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
static void
ata_init(void)
{
- if (ata_info_chunk != NULL){
- g_mem_chunk_destroy(ata_info_chunk);
- ata_info_chunk=NULL;
- }
- ata_info_chunk = g_mem_chunk_new("ata_info_chunk",
- sizeof(ata_info_t),
- ata_info_chunk_count * sizeof(ata_info_t),
- G_ALLOC_ONLY);
if(ata_cmd_unmatched){
g_hash_table_destroy(ata_cmd_unmatched);
ata_cmd_unmatched=NULL;