Tags: FoxIO-LLC/ja4
Tags
Wireshark: minor tweaks to wmem_strbuf use (#241) Minor changes to some cases of how wmem strbufs are used. There is minimal performance benefit, but hopefully improved code clarity. Replace `wmem_strbuf_append_printf(buf, "%s", str)` with `wmem_strbuf_append(buf, str)`. Replace `wmem_strbuf_append_printf(buf, "%c", c)` with `wmem_strbuf_append_c(buf, c)`. These changes avoid the overhead of parsing a printf format string when it's redundant. Use `wmem_strbuf_dup()` to duplicate a strbuf instead of `wmem_strbuf_new(..., wmem_strbuf_get_str(oldbuf))` for slight improvement in readability. (This change may cause a conflict with #240 that is trivial to resolve.) Use `wmem_strbuf_finalize()` when getting the final value of a strbuf. For strings allocated in the file scope, this reduces the memory used by the final string. The function is effectively a no-op for strings allocated in the packet scope, but still makes clear to future readers when a string is expected to undergo no further changes.
PreviousNext