aboutsummaryrefslogtreecommitdiffstats
path: root/epan/ftypes
diff options
context:
space:
mode:
authorsahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>2006-12-22 08:35:43 +0000
committersahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>2006-12-22 08:35:43 +0000
commit118f0d31400cb2e0dd6a6d1c852f65b806db42f7 (patch)
tree760fcd65bf9721b8a488ce4f1b974347949acdee /epan/ftypes
parentf7be12c3be8044b57f2ff58bbc8ad193433f5b02 (diff)
change some slab allocated memory into ep/emem allocated structures instead.
this primarily removes code and simplifies (==eliminates) the need to track the data that is allocated and should potentially be slightly faster than a slab allocator. however these functions are called A LOT so there might be a performance hit when using emem with full debugging canary values and all the bells and whistles activated. this change also makes any future attempt to parallellize dissection of frames easier if we just make the ep allocator allocate from a threads specific ep pool. (something we would have to do anyway to make ep allocations multithreaded) this works in all my tests so far but needs more test coverage. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@20194 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/ftypes')
-rw-r--r--epan/ftypes/ftype-ipv4.c1
-rw-r--r--epan/ftypes/ftype-string.c1
-rw-r--r--epan/ftypes/ftypes.c5
-rw-r--r--epan/ftypes/ftypes.h25
4 files changed, 2 insertions, 30 deletions
diff --git a/epan/ftypes/ftype-ipv4.c b/epan/ftypes/ftype-ipv4.c
index 045c9fbf10..6a17e528fa 100644
--- a/epan/ftypes/ftype-ipv4.c
+++ b/epan/ftypes/ftype-ipv4.c
@@ -105,7 +105,6 @@ val_from_unparsed(fvalue_t *fv, char *s, gboolean allow_partial_value _U_, LogFu
return FALSE;
}
nmask_bits = fvalue_get_integer(nmask_fvalue);
- FVALUE_FREE(nmask_fvalue);
if (nmask_bits > 32) {
logfunc("Netmask bits in a CIDR IPv4 address should be <= 32, not %u",
diff --git a/epan/ftypes/ftype-string.c b/epan/ftypes/ftype-string.c
index b24086363c..b156cb1d60 100644
--- a/epan/ftypes/ftype-string.c
+++ b/epan/ftypes/ftype-string.c
@@ -178,7 +178,6 @@ val_from_unparsed(fvalue_t *fv, char *s, gboolean allow_partial_value _U_, LogFu
memcpy(fv->value.string, fv_bytes->value.bytes->data, num_bytes);
fv->value.string[num_bytes] = '\0';
- FVALUE_FREE(fv_bytes);
return TRUE;
}
else {
diff --git a/epan/ftypes/ftypes.c b/epan/ftypes/ftypes.c
index a2305f97f9..a096f7a9d2 100644
--- a/epan/ftypes/ftypes.c
+++ b/epan/ftypes/ftypes.c
@@ -27,6 +27,7 @@
#include <ftypes-int.h>
#include <glib.h>
#include "../slab.h"
+#include "../emem.h"
#include "ftypes.h"
@@ -203,7 +204,7 @@ fvalue_new(ftenum_t ftype)
ftype_t *ft;
FvalueNewFunc new_value;
- SLAB_ALLOC(fv, fvalue_t);
+ fv=ep_alloc(sizeof(fvalue_t));
FTYPE_LOOKUP(ftype, ft);
fv->ftype = ft;
@@ -246,7 +247,6 @@ fvalue_from_unparsed(ftenum_t ftype, char *s, gboolean allow_partial_value, LogF
logfunc("\"%s\" cannot be converted to %s.",
s, ftype_pretty_name(ftype));
}
- FVALUE_FREE(fv);
return NULL;
}
@@ -265,7 +265,6 @@ fvalue_from_string(ftenum_t ftype, char *s, LogFunc logfunc)
logfunc("\"%s\" cannot be converted to %s.",
s, ftype_pretty_name(ftype));
}
- FVALUE_FREE(fv);
return NULL;
}
diff --git a/epan/ftypes/ftypes.h b/epan/ftypes/ftypes.h
index 6e42655693..145c3bc272 100644
--- a/epan/ftypes/ftypes.h
+++ b/epan/ftypes/ftypes.h
@@ -241,31 +241,6 @@ void
fvalue_init(fvalue_t *fv, ftenum_t ftype);
-/* Define type needed for the fvalue_t free list. */
-SLAB_ITEM_TYPE_DEFINE(fvalue_t)
-
-/* Free all memory used by an fvalue_t. With MSVC and a
- * libwireshark.dll, we need a special declaration.
- */
-WS_VAR_IMPORT SLAB_FREE_LIST_DECLARE(fvalue_t)
-
-
-#define FVALUE_CLEANUP(fv) \
- { \
- register FvalueFreeFunc free_value; \
- free_value = (fv)->ftype->free_value; \
- if (free_value) { \
- free_value((fv)); \
- } \
- }
-
-#define FVALUE_FREE(fv) \
- { \
- FVALUE_CLEANUP(fv) \
- SLAB_FREE(fv, fvalue_t); \
- }
-
-
fvalue_t*
fvalue_from_unparsed(ftenum_t ftype, char *s, gboolean allow_partial_value, LogFunc logfunc);