From a1b0ced4fc09509ea2a2e5d168f22f058a8a742d Mon Sep 17 00:00:00 2001 From: sahlberg Date: Fri, 12 Aug 2005 23:34:59 +0000 Subject: gmemchunk -> se_alloc() improvements git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15324 f5534014-38df-0310-8fa8-9805f1628bb7 --- epan/dissectors/packet-ajp13.c | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) (limited to 'epan/dissectors/packet-ajp13.c') 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 #include +#include #include #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); } -- cgit v1.2.3