diff options
author | Stefan Fritsch <sf@apache.org> | 2012-10-27 22:38:33 +0000 |
---|---|---|
committer | Stefan Fritsch <sf@apache.org> | 2012-10-27 22:38:33 +0000 |
commit | aa8ba3d9d5dea490d376494b4f50b0e7c8480d11 (patch) | |
tree | 23a6eb5cfb86eb65ba9cf563e155c2fbac81acbc /test/testbuckets.c | |
parent | 6af644673a9ff6f5c2583b0499dc455698185682 (diff) | |
download | apr-aa8ba3d9d5dea490d376494b4f50b0e7c8480d11.tar.gz |
Make apr_brigade_(v)putstrs more efficient by using apr_brigade_writev
instead of apr_brigade_write
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1402903 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/testbuckets.c')
-rw-r--r-- | test/testbuckets.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/testbuckets.c b/test/testbuckets.c index ec65fa760..e00f61eb1 100644 --- a/test/testbuckets.c +++ b/test/testbuckets.c @@ -488,6 +488,29 @@ static void test_write_split(abts_case *tc, void *data) apr_bucket_alloc_destroy(ba); } +static void test_write_putstrs(abts_case *tc, void *data) +{ + apr_bucket_alloc_t *ba = apr_bucket_alloc_create(p); + apr_bucket_brigade *bb = apr_brigade_create(p, ba); + apr_bucket *e; + char buf[30]; + apr_size_t len = sizeof(buf); + const char *expect = "123456789abcdefghij"; + + e = apr_bucket_heap_create("1", 1, NULL, ba); + APR_BRIGADE_INSERT_HEAD(bb, e); + + apr_brigade_putstrs(bb, NULL, NULL, "2", "34", "567", "8", "9a", "bcd", + "e", "f", "gh", "i", NULL); + apr_brigade_putstrs(bb, NULL, NULL, "j", NULL); + APR_ASSERT_SUCCESS(tc, "apr_brigade_flatten", + apr_brigade_flatten(bb, buf, &len)); + ABTS_STR_NEQUAL(tc, expect, buf, strlen(expect)); + + apr_brigade_destroy(bb); + apr_bucket_alloc_destroy(ba); +} + abts_suite *testbuckets(abts_suite *suite) { suite = ADD_SUITE(suite); @@ -504,6 +527,7 @@ abts_suite *testbuckets(abts_suite *suite) abts_run_test(suite, test_truncfile, NULL); abts_run_test(suite, test_partition, NULL); abts_run_test(suite, test_write_split, NULL); + abts_run_test(suite, test_write_putstrs, NULL); return suite; } |