Lines Matching refs:q

40 static const char *tail_err(struct bufq *q)  in tail_err()  argument
44 if(!q->tail) { in tail_err()
45 return q->head ? "tail is NULL, but head is not" : NULL; in tail_err()
48 chunk = q->head; in tail_err()
50 if(chunk == q->tail) { in tail_err()
61 static void dump_bufq(struct bufq *q, const char *msg) in dump_bufq() argument
68 q->chunk_size, q->max_chunks, msg); in dump_bufq()
70 chunk = q->head; in dump_bufq()
77 terr = tail_err(q); in dump_bufq()
80 chunk = q->spare; in dump_bufq()
85 fprintf(stderr, "- chunks: %zu\n", q->chunk_count); in dump_bufq()
95 struct bufq q; in check_bufq() local
104 Curl_bufq_initp(&q, &pool, max_chunks, opts); in check_bufq()
107 Curl_bufq_init2(&q, chunk_size, max_chunks, opts); in check_bufq()
110 fail_unless(q.chunk_size == chunk_size, "chunk_size init wrong"); in check_bufq()
111 fail_unless(q.max_chunks == max_chunks, "max_chunks init wrong"); in check_bufq()
112 fail_unless(q.head == NULL, "init: head not NULL"); in check_bufq()
113 fail_unless(q.tail == NULL, "init: tail not NULL"); in check_bufq()
114 fail_unless(q.spare == NULL, "init: spare not NULL"); in check_bufq()
115 fail_unless(Curl_bufq_len(&q) == 0, "init: bufq length != 0"); in check_bufq()
117 n = Curl_bufq_write(&q, test_data, wsize, &result); in check_bufq()
124 Curl_bufq_reset(&q); in check_bufq()
125 while(!Curl_bufq_is_full(&q)) { in check_bufq()
126 n = Curl_bufq_write(&q, test_data, wsize, &result); in check_bufq()
138 dump_bufq(&q, "after writing full"); in check_bufq()
144 while(!Curl_bufq_is_empty(&q)) { in check_bufq()
145 n = Curl_bufq_read(&q, test_data, rsize, &result); in check_bufq()
157 dump_bufq(&q, "after reading empty"); in check_bufq()
160 if(q.tail) { in check_bufq()
161 dump_bufq(&q, "after reading empty"); in check_bufq()
166 n = Curl_bufq_write(&q, test_data, wsize, &result); in check_bufq()
171 n = Curl_bufq_read(&q, test_data, rsize, &result); in check_bufq()
179 Curl_bufq_free(&q); in check_bufq()
180 Curl_bufq_init2(&q, chunk_size, max_chunks, (opts|BUFQ_OPT_SOFT_LIMIT)); in check_bufq()
182 while(!Curl_bufq_is_full(&q)) { in check_bufq()
183 n = Curl_bufq_write(&q, test_data, wsize, &result); in check_bufq()
193 dump_bufq(&q, "after writing full"); in check_bufq()
197 n = Curl_bufq_write(&q, test_data, wsize, &result); in check_bufq()
202 while(!Curl_bufq_is_empty(&q)) { in check_bufq()
203 n = Curl_bufq_read(&q, test_data, rsize, &result); in check_bufq()
219 Curl_bufq_reset(&q); in check_bufq()
220 while(Curl_bufq_len(&q) < chunk_size) { in check_bufq()
221 n = Curl_bufq_write(&q, buf, sizeof(buf), &result); in check_bufq()
226 result = Curl_bufq_unwrite(&q, 1); in check_bufq()
228 while(!Curl_bufq_is_empty(&q)) { in check_bufq()
230 n = Curl_bufq_read(&q, rbuf, sizeof(rbuf), &result); in check_bufq()
235 fail_unless(Curl_bufq_is_empty(&q), "should be last read"); in check_bufq()
244 Curl_bufq_reset(&q); in check_bufq()
247 dump_bufq(&q, "at end of test"); in check_bufq()
248 Curl_bufq_free(&q); in check_bufq()
254 struct bufq q; variable
259 Curl_bufq_init(&q, 8*1024, 12);
260 n = Curl_bufq_read(&q, buf, 128, &result);
262 Curl_bufq_free(&q);