remove more unused code
Change-Id: I7275aafe7d7216b85bbb34ba959b74358d102a91 Reviewed-on: https://code.wireshark.org/review/2255 Reviewed-by: Evan Huus <eapache@gmail.com>
This commit is contained in:
parent
e0aabd97d8
commit
b166553279
48
epan/emem.c
48
epan/emem.c
|
@ -1264,7 +1264,7 @@ ep_strbuf_grow(emem_strbuf_t *strbuf, gsize wanted_alloc_len)
|
|||
strbuf->str = new_str;
|
||||
}
|
||||
|
||||
emem_strbuf_t *
|
||||
static emem_strbuf_t *
|
||||
ep_strbuf_sized_new(gsize alloc_len, gsize max_alloc_len)
|
||||
{
|
||||
emem_strbuf_t *strbuf;
|
||||
|
@ -1303,32 +1303,6 @@ ep_strbuf_new(const gchar *init)
|
|||
return strbuf;
|
||||
}
|
||||
|
||||
emem_strbuf_t *
|
||||
ep_strbuf_append(emem_strbuf_t *strbuf, const gchar *str)
|
||||
{
|
||||
gsize add_len, full_len;
|
||||
|
||||
if (!strbuf || !str || str[0] == '\0') {
|
||||
return strbuf;
|
||||
}
|
||||
|
||||
/* Be optimistic; try the g_strlcpy first & see if enough room. */
|
||||
/* Note: full_len doesn't count the trailing '\0'; add_len does allow for same */
|
||||
add_len = strbuf->alloc_len - strbuf->len;
|
||||
full_len = g_strlcpy(&strbuf->str[strbuf->len], str, add_len);
|
||||
if (full_len < add_len) {
|
||||
strbuf->len += full_len;
|
||||
} else {
|
||||
strbuf->str[strbuf->len] = '\0'; /* end string at original length again */
|
||||
ep_strbuf_grow(strbuf, strbuf->len + full_len + 1);
|
||||
add_len = strbuf->alloc_len - strbuf->len;
|
||||
full_len = g_strlcpy(&strbuf->str[strbuf->len], str, add_len);
|
||||
strbuf->len += MIN(add_len-1, full_len);
|
||||
}
|
||||
|
||||
return strbuf;
|
||||
}
|
||||
|
||||
static void
|
||||
ep_strbuf_append_vprintf(emem_strbuf_t *strbuf, const gchar *format, va_list ap)
|
||||
{
|
||||
|
@ -1379,26 +1353,6 @@ ep_strbuf_printf(emem_strbuf_t *strbuf, const gchar *format, ...)
|
|||
va_end(ap);
|
||||
}
|
||||
|
||||
emem_strbuf_t *
|
||||
ep_strbuf_append_c(emem_strbuf_t *strbuf, const gchar c)
|
||||
{
|
||||
if (!strbuf) {
|
||||
return strbuf;
|
||||
}
|
||||
|
||||
/* +1 for the new character & +1 for the trailing '\0'. */
|
||||
if (strbuf->alloc_len < strbuf->len + 1 + 1) {
|
||||
ep_strbuf_grow(strbuf, strbuf->len + 1 + 1);
|
||||
}
|
||||
if (strbuf->alloc_len >= strbuf->len + 1 + 1) {
|
||||
strbuf->str[strbuf->len] = c;
|
||||
strbuf->len++;
|
||||
strbuf->str[strbuf->len] = '\0';
|
||||
}
|
||||
|
||||
return strbuf;
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines
|
||||
*
|
||||
|
|
36
epan/emem.h
36
epan/emem.h
|
@ -168,20 +168,6 @@ typedef struct _emem_strbuf_t {
|
|||
WS_DLL_PUBLIC
|
||||
emem_strbuf_t *ep_strbuf_new(const gchar *init) G_GNUC_MALLOC;
|
||||
|
||||
/**
|
||||
* Allocate an ephemeral string buffer with enough initial space for alloc_len bytes
|
||||
* and a maximum of max_alloc_len bytes.
|
||||
*
|
||||
* @param alloc_len The initial size of the buffer. This value can be 0, but a nonzero
|
||||
* value is recommended.
|
||||
* @param max_alloc_len The maximum size of the buffer. 0 means "unlimited" (within
|
||||
* reason).
|
||||
*
|
||||
* @return A newly-allocated string buffer. str will be empty.
|
||||
*/
|
||||
WS_DLL_PUBLIC
|
||||
emem_strbuf_t *ep_strbuf_sized_new(gsize alloc_len, gsize max_alloc_len) G_GNUC_MALLOC;
|
||||
|
||||
/**
|
||||
* Apply printf-style formatted text to a string buffer.
|
||||
*
|
||||
|
@ -202,28 +188,6 @@ WS_DLL_PUBLIC
|
|||
void ep_strbuf_append_printf(emem_strbuf_t *strbuf, const gchar *format, ...)
|
||||
G_GNUC_PRINTF(2, 3);
|
||||
|
||||
/**
|
||||
* Append a string to a string buffer.
|
||||
*
|
||||
* @param strbuf The ep_strbuf-allocated string buffer to append to.
|
||||
* @param str A null-terminated string.
|
||||
*
|
||||
* @return strbuf
|
||||
*/
|
||||
WS_DLL_PUBLIC
|
||||
emem_strbuf_t *ep_strbuf_append(emem_strbuf_t *strbuf, const gchar *str);
|
||||
|
||||
/**
|
||||
* Append a character to a string buffer.
|
||||
*
|
||||
* @param strbuf The ep_strbuf-allocated string buffer to append to.
|
||||
* @param c The character to append.
|
||||
*
|
||||
* @return strbuf
|
||||
*/
|
||||
WS_DLL_PUBLIC
|
||||
emem_strbuf_t *ep_strbuf_append_c(emem_strbuf_t *strbuf, const gchar c);
|
||||
|
||||
/* #define DEBUG_INTENSE_CANARY_CHECKS */
|
||||
|
||||
/** Helper to troubleshoot ep memory corruption.
|
||||
|
|
Loading…
Reference in New Issue