forked from osmocom/wireshark
replace some more silly rotating buffers with ep_alloc() calls
svn path=/trunk/; revision=15386
This commit is contained in:
parent
19e3bae487
commit
d4267d1272
|
@ -118,6 +118,7 @@
|
|||
#include "addr_resolv.h"
|
||||
#include "filesystem.h"
|
||||
#include <epan/prefs.h>
|
||||
#include <epan/emem.h>
|
||||
|
||||
#define ENAME_HOSTS "hosts"
|
||||
#define ENAME_ETHERS "ethers"
|
||||
|
@ -1868,17 +1869,10 @@ extern void add_ipv6_name(struct e_in6_addr *addrp, const gchar *name)
|
|||
|
||||
extern gchar *get_udp_port(guint port)
|
||||
{
|
||||
static gchar str[3][MAXNAMELEN];
|
||||
static gchar *cur;
|
||||
gchar *cur;
|
||||
|
||||
if (!(g_resolv_flags & RESOLV_TRANSPORT)) {
|
||||
if (cur == &str[0][0]) {
|
||||
cur = &str[1][0];
|
||||
} else if (cur == &str[1][0]) {
|
||||
cur = &str[2][0];
|
||||
} else {
|
||||
cur = &str[0][0];
|
||||
}
|
||||
cur=ep_alloc(MAXNAMELEN);
|
||||
g_snprintf(cur, MAXNAMELEN, "%u", port);
|
||||
return cur;
|
||||
}
|
||||
|
@ -1889,17 +1883,10 @@ extern gchar *get_udp_port(guint port)
|
|||
|
||||
extern gchar *get_tcp_port(guint port)
|
||||
{
|
||||
static gchar str[3][MAXNAMELEN];
|
||||
static gchar *cur;
|
||||
gchar *cur;
|
||||
|
||||
if (!(g_resolv_flags & RESOLV_TRANSPORT)) {
|
||||
if (cur == &str[0][0]) {
|
||||
cur = &str[1][0];
|
||||
} else if (cur == &str[1][0]) {
|
||||
cur = &str[2][0];
|
||||
} else {
|
||||
cur = &str[0][0];
|
||||
}
|
||||
cur=ep_alloc(MAXNAMELEN);
|
||||
g_snprintf(cur, MAXNAMELEN, "%u", port);
|
||||
return cur;
|
||||
}
|
||||
|
@ -1910,17 +1897,10 @@ extern gchar *get_tcp_port(guint port)
|
|||
|
||||
extern gchar *get_sctp_port(guint port)
|
||||
{
|
||||
static gchar str[3][MAXNAMELEN];
|
||||
static gchar *cur;
|
||||
gchar *cur;
|
||||
|
||||
if (!(g_resolv_flags & RESOLV_TRANSPORT)) {
|
||||
if (cur == &str[0][0]) {
|
||||
cur = &str[1][0];
|
||||
} else if (cur == &str[1][0]) {
|
||||
cur = &str[2][0];
|
||||
} else {
|
||||
cur = &str[0][0];
|
||||
}
|
||||
cur=ep_alloc(MAXNAMELEN);
|
||||
g_snprintf(cur, MAXNAMELEN, "%u", port);
|
||||
return cur;
|
||||
}
|
||||
|
@ -2106,8 +2086,7 @@ extern guint32 get_ipxnet_addr(const gchar *name, gboolean *known)
|
|||
|
||||
extern const gchar *get_manuf_name(const guint8 *addr)
|
||||
{
|
||||
static gchar str[3][MAXMANUFLEN];
|
||||
static gchar *cur;
|
||||
gchar *cur;
|
||||
hashmanuf_t *manufp;
|
||||
|
||||
if ((g_resolv_flags & RESOLV_MAC) && !eth_resolution_initialized) {
|
||||
|
@ -2116,13 +2095,7 @@ extern const gchar *get_manuf_name(const guint8 *addr)
|
|||
}
|
||||
|
||||
if (!(g_resolv_flags & RESOLV_MAC) || ((manufp = manuf_name_lookup(addr)) == NULL)) {
|
||||
if (cur == &str[0][0]) {
|
||||
cur = &str[1][0];
|
||||
} else if (cur == &str[1][0]) {
|
||||
cur = &str[2][0];
|
||||
} else {
|
||||
cur = &str[0][0];
|
||||
}
|
||||
cur=ep_alloc(MAXMANUFLEN);
|
||||
g_snprintf(cur, MAXMANUFLEN, "%02x:%02x:%02x", addr[0], addr[1], addr[2]);
|
||||
return cur;
|
||||
}
|
||||
|
|
|
@ -25,20 +25,14 @@
|
|||
#endif
|
||||
|
||||
#include "atalk-utils.h"
|
||||
#include "emem.h"
|
||||
|
||||
gchar *
|
||||
atalk_addr_to_str(const struct atalk_ddp_addr *addrp)
|
||||
{
|
||||
static gchar str[3][14];
|
||||
static gchar *cur;
|
||||
gchar *cur;
|
||||
|
||||
if (cur == &str[0][0]) {
|
||||
cur = &str[1][0];
|
||||
} else if (cur == &str[1][0]) {
|
||||
cur = &str[2][0];
|
||||
} else {
|
||||
cur = &str[0][0];
|
||||
}
|
||||
cur=ep_alloc(14);
|
||||
atalk_addr_to_str_buf(addrp, cur, 14);
|
||||
return cur;
|
||||
}
|
||||
|
|
|
@ -34,14 +34,14 @@
|
|||
#include <glib.h>
|
||||
|
||||
#include "osi-utils.h"
|
||||
#include "emem.h"
|
||||
|
||||
gchar *
|
||||
print_nsap_net( const guint8 *ad, int length )
|
||||
{
|
||||
static gchar str[MAX_NSAP_LEN * 3 + 50]; /* reserve space for nice layout */
|
||||
gchar *cur;
|
||||
|
||||
cur = str;
|
||||
cur = ep_alloc(MAX_NSAP_LEN * 3 + 50);
|
||||
print_nsap_net_buf( ad, length, cur );
|
||||
return( cur );
|
||||
}
|
||||
|
@ -77,10 +77,9 @@ print_nsap_net_buf( const guint8 *ad, int length, gchar *buf )
|
|||
gchar *
|
||||
print_system_id( const guint8 *ad, int length )
|
||||
{
|
||||
static gchar str[MAX_SYSTEMID_LEN * 3 + 5]; /* Don't trust exact matching */
|
||||
gchar *cur;
|
||||
|
||||
cur = str;
|
||||
cur = ep_alloc(MAX_SYSTEMID_LEN * 3 + 5);
|
||||
print_system_id_buf(ad, length, cur );
|
||||
return( cur );
|
||||
}
|
||||
|
@ -132,10 +131,9 @@ print_system_id_buf( const guint8 *ad, int length, gchar *buf )
|
|||
gchar *
|
||||
print_area(const guint8 *ad, int length)
|
||||
{
|
||||
static gchar str[MAX_AREA_LEN * 3 + 20]; /* reserve space for nice layout */
|
||||
gchar *cur;
|
||||
|
||||
cur = str;
|
||||
cur = ep_alloc(MAX_AREA_LEN * 3 + 20);
|
||||
print_area_buf( ad, length, cur );
|
||||
return cur;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <ctype.h>
|
||||
#include <glib.h>
|
||||
#include "strutil.h"
|
||||
#include "emem.h"
|
||||
|
||||
|
||||
/*
|
||||
|
@ -274,18 +275,13 @@ bytes_to_str(const guint8 *bd, int bd_len) {
|
|||
*/
|
||||
gchar *
|
||||
bytes_to_str_punct(const guint8 *bd, int bd_len, gchar punct) {
|
||||
static gchar str[N_BYTES_TO_STR_STRINGS][MAX_BYTE_STR_LEN+3+1];
|
||||
static int cur_idx;
|
||||
gchar *cur;
|
||||
gchar *p;
|
||||
int len;
|
||||
static const char hex[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
|
||||
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
|
||||
|
||||
cur_idx++;
|
||||
if (cur_idx >= N_BYTES_TO_STR_STRINGS)
|
||||
cur_idx = 0;
|
||||
cur = &str[cur_idx][0];
|
||||
cur=ep_alloc(MAX_BYTE_STR_LEN+3+1);
|
||||
p = cur;
|
||||
len = MAX_BYTE_STR_LEN;
|
||||
while (bd_len > 0 && len > 0) {
|
||||
|
|
Loading…
Reference in New Issue