From 8531d6695f7363e5fa24141c53253e699d99ca0a Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 11 Apr 2019 07:16:02 +0200 Subject: tweak OSMO_STRBUF_APPEND(), add OSMO_STRBUF_APPEND_NOLEN() In OSMO_STRBUF_APPEND, use local variable names that are less likely to shadow other local variables: prefix with _sb_. In OSMO_STRBUF_APPEND, add a check to add to .pos only if it is not NULL. Add OSMO_STRBUF_APPEND_NOLEN(), which works for function signatures that don't return a length. This is useful for any osmo_*_buf() string writing functions, so that these write directly to the strbuf. Change-Id: I108cadf72deb3a3bcab9a07e50572d9da1ab0359 --- tests/utils/utils_test.ok | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests/utils/utils_test.ok') diff --git a/tests/utils/utils_test.ok b/tests/utils/utils_test.ok index 5783eb16..587c6f09 100644 --- a/tests/utils/utils_test.ok +++ b/tests/utils/utils_test.ok @@ -341,6 +341,11 @@ cascade: T minus 10 9 8 7 6 5 4 3 2 1 ... Lift off! -- T minus 10 9 8 7 6 5 4 3 2 1 ... Lift off! -- T minus 10 9 8 7 6 5 4 3 2 1 ... Lift off! (need 134 chars, had size=63) T minus 10 9 8 7 6 5 4 3 2 1 ... Lift off! -- T minus 10 9 8 7 +strbuf_test_nolen +20: 0001011100101010 (need=16) +more: 0001011100101010000 (need=19) +10: 000101110 (need=9) + startswith_test() osmo_str_startswith(NULL, NULL) == true osmo_str_startswith("", NULL) == true -- cgit v1.2.3