diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2009-04-03 19:10:34 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2009-04-03 19:10:34 +0000 |
commit | c731ff89282ba0eee2bab9599fa7d9be61531ef0 (patch) | |
tree | 4a045e26791e00acd0986cf26f82bef2b2bf4fdb /epan/dissectors/packet-sita.c | |
parent | eddcb4dc2259f62e96fb2232a3ce9c59c50779ea (diff) |
Use an emem_strbuf_t where appropriate.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27954 f5534014-38df-0310-8fa8-9805f1628bb7
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 |