diff options
author | Guy Harris <guy@alum.mit.edu> | 2009-04-03 19:10:34 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2009-04-03 19:10:34 +0000 |
commit | 978f771a8d7c73d44585ae64a46874f643467edf (patch) | |
tree | 4a045e26791e00acd0986cf26f82bef2b2bf4fdb /epan/dissectors/packet-sita.c | |
parent | ed30baaa0d20b7e5e8d520ac07c849f1430ade08 (diff) |
Use an emem_strbuf_t where appropriate.
svn path=/trunk/; revision=27954
Diffstat (limited to 'epan/dissectors/packet-sita.c')
-rw-r--r-- | epan/dissectors/packet-sita.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/epan/dissectors/packet-sita.c b/epan/dissectors/packet-sita.c index 6ec84d7539..3ebfc3e9dd 100644 --- a/epan/dissectors/packet-sita.c +++ b/epan/dissectors/packet-sita.c @@ -82,20 +82,22 @@ format_flags_string(guchar value, const gchar *array[]) { int i; guint bpos; - size_t fpos = 0, returned_length = 0; - gchar *buf; + emem_strbuf_t *buf; + const char *sep = ""; - buf = ep_alloc(MAX_FLAGS_LEN); - buf[0] = 0; + buf = ep_strbuf_sized_new(MAX_FLAGS_LEN, MAX_FLAGS_LEN); for (i = 0; i < 8; i++) { bpos = 1 << i; if (value & bpos) { - if (array[i][0]) /* if there is a string to emit... */ - returned_length = g_snprintf(&buf[fpos], MAX_FLAGS_LEN-fpos, "%s%s", fpos ? ", " : "", array[i]); - fpos += MIN(returned_length, MAX_FLAGS_LEN-fpos); + if (array[i][0]) { + /* there is a string to emit... */ + ep_strbuf_append_printf(buf, "%s%s", sep, + array[i]); + sep = ", "; + } } } - return buf; + return buf->str; } static void |