Lines Matching refs:buf

28 unchanged_array_size (struct scratch_buffer *buf, size_t a, size_t b)  in unchanged_array_size()  argument
30 size_t old_length = buf->length; in unchanged_array_size()
31 if (!scratch_buffer_set_array_size (buf, a, b)) in unchanged_array_size()
37 if (old_length != buf->length) in unchanged_array_size()
51 struct scratch_buffer buf; in array_size_must_fail() local
52 scratch_buffer_init (&buf); in array_size_must_fail()
54 if (!scratch_buffer_grow (&buf)) in array_size_must_fail()
59 if (scratch_buffer_set_array_size (&buf, a, b)) in array_size_must_fail()
65 if (buf.data != buf.__space.__c) in array_size_must_fail()
79 struct scratch_buffer buf; in do_test() local
80 scratch_buffer_init (&buf); in do_test()
81 memset (buf.data, ' ', buf.length); in do_test()
82 scratch_buffer_free (&buf); in do_test()
85 struct scratch_buffer buf; in do_test() local
86 scratch_buffer_init (&buf); in do_test()
87 memset (buf.data, ' ', buf.length); in do_test()
88 size_t old_length = buf.length; in do_test()
89 scratch_buffer_grow (&buf); in do_test()
90 if (buf.length <= old_length) in do_test()
95 memset (buf.data, ' ', buf.length); in do_test()
96 scratch_buffer_free (&buf); in do_test()
99 struct scratch_buffer buf; in do_test() local
100 scratch_buffer_init (&buf); in do_test()
101 memset (buf.data, '@', buf.length); in do_test()
102 strcpy (buf.data, "prefix"); in do_test()
103 size_t old_length = buf.length; in do_test()
104 scratch_buffer_grow_preserve (&buf); in do_test()
105 if (buf.length <= old_length) in do_test()
110 if (strcmp (buf.data, "prefix") != 0) in do_test()
116 if (((char *)buf.data)[i] != '@') in do_test()
122 scratch_buffer_free (&buf); in do_test()
125 struct scratch_buffer buf; in do_test() local
126 scratch_buffer_init (&buf); in do_test()
129 if (!(unchanged_array_size (&buf, 0, 0) in do_test()
130 && unchanged_array_size (&buf, 1, 0) in do_test()
131 && unchanged_array_size (&buf, 0, 1) in do_test()
132 && unchanged_array_size (&buf, -1, 0) in do_test()
133 && unchanged_array_size (&buf, 0, -1) in do_test()
134 && unchanged_array_size (&buf, 1ULL << 16, 0) in do_test()
135 && unchanged_array_size (&buf, 0, 1ULL << 16) in do_test()
136 && unchanged_array_size (&buf, (size_t) (1ULL << 32), 0) in do_test()
137 && unchanged_array_size (&buf, 0, (size_t) (1ULL << 32)))) in do_test()
139 if (!scratch_buffer_grow (&buf)) in do_test()
144 scratch_buffer_free (&buf); in do_test()
155 struct scratch_buffer buf; in do_test() local
156 scratch_buffer_init (&buf); in do_test()
157 memset (buf.data, '@', buf.length); in do_test()
159 size_t sizes[] = { 16, buf.length, buf.length + 16 }; in do_test()
163 size_t l = sizes[i] > buf.length ? sizes[i] : buf.length; in do_test()
164 void *r = scratch_buffer_dupfree (&buf, l); in do_test()
167 TEST_COMPARE_BLOB (r, l, buf.data, l); in do_test()
172 scratch_buffer_free (&buf); in do_test()