Added convenience function for adding an unsigned 32bit integer in network byte-order to a strbuf. Signed-off-by: Henrik Grubbström <grubba@xxxxxxxxxx> --- New trivial function. strbuf.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/strbuf.h b/strbuf.h index fac2dbc..52cd71e 100644 --- a/strbuf.h +++ b/strbuf.h @@ -107,6 +107,10 @@ static inline void strbuf_addbuf(struct strbuf *sb, const struct strbuf *sb2) { strbuf_grow(sb, sb2->len); strbuf_add(sb, sb2->buf, sb2->len); } +static inline void strbuf_add_uint32(struct strbuf *sb, uint32_t val) { + val = htonl(val); + strbuf_add(sb, &val, sizeof(val)); +} extern void strbuf_adddup(struct strbuf *sb, size_t pos, size_t len); typedef size_t (*expand_fn_t) (struct strbuf *sb, const char *placeholder, void *context); -- 1.7.0.4.369.g81e89 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html