diff options
author | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2006-12-23 00:10:49 +0000 |
---|---|---|
committer | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2006-12-23 00:10:49 +0000 |
commit | 44535d37b287fd2833b316130881f0b863f361cf (patch) | |
tree | 9dd5cef9401e4757ed0042b54a6eedcccc818ccf /epan/ftypes/ftype-ipv4.c | |
parent | b90006ac6f2722495057802a1891cf2a44b8f319 (diff) |
make ipv4 ftype use cheap ep_ memory isntead of slightly less cheap g_ memory
for the temporary storage while parsing
svn path=/trunk/; revision=20205
Diffstat (limited to 'epan/ftypes/ftype-ipv4.c')
-rw-r--r-- | epan/ftypes/ftype-ipv4.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/epan/ftypes/ftype-ipv4.c b/epan/ftypes/ftype-ipv4.c index 045c9fbf10..bb81272d5e 100644 --- a/epan/ftypes/ftype-ipv4.c +++ b/epan/ftypes/ftype-ipv4.c @@ -29,6 +29,7 @@ #include <ftypes-int.h> #include <epan/ipv4.h> #include <epan/addr_resolv.h> +#include <epan/emem.h> static void @@ -59,7 +60,7 @@ val_from_unparsed(fvalue_t *fv, char *s, gboolean allow_partial_value _U_, LogFu if (has_slash) { /* Make a copy of the string and use strtok() to * get the address portion. */ - s_copy = g_strdup(s); + s_copy = ep_strdup(s); addr_str = strtok(s_copy, "/"); /* I just checked for slash! I shouldn't get NULL here. @@ -67,7 +68,6 @@ val_from_unparsed(fvalue_t *fv, char *s, gboolean allow_partial_value _U_, LogFu if (!addr_str) { logfunc("Unexpected strtok() error parsing IP address: %s", s_copy); - g_free(s_copy); return FALSE; } } @@ -78,9 +78,6 @@ val_from_unparsed(fvalue_t *fv, char *s, gboolean allow_partial_value _U_, LogFu if (!get_host_ipaddr(addr_str, &addr)) { logfunc("\"%s\" is not a valid hostname or IPv4 address.", addr_str); - if (has_slash) { - g_free(s_copy); - } return FALSE; } @@ -94,13 +91,11 @@ val_from_unparsed(fvalue_t *fv, char *s, gboolean allow_partial_value _U_, LogFu if (!net_str) { logfunc("Unexpected strtok() error parsing netmask: %s", s_copy); - g_free(s_copy); return FALSE; } /* XXX - this is inefficient */ nmask_fvalue = fvalue_from_unparsed(FT_UINT32, net_str, FALSE, logfunc); - g_free(s_copy); if (!nmask_fvalue) { return FALSE; } |