Lines Matching refs:bucket

76 	php_stream_bucket *bucket;  in php_stream_bucket_new()  local
78 bucket = (php_stream_bucket*)pemalloc(sizeof(php_stream_bucket), is_persistent); in php_stream_bucket_new()
80 if (bucket == NULL) { in php_stream_bucket_new()
84 bucket->next = bucket->prev = NULL; in php_stream_bucket_new()
88 bucket->buf = pemalloc(buflen, 1); in php_stream_bucket_new()
90 if (bucket->buf == NULL) { in php_stream_bucket_new()
91 pefree(bucket, 1); in php_stream_bucket_new()
95 memcpy(bucket->buf, buf, buflen); in php_stream_bucket_new()
96 bucket->buflen = buflen; in php_stream_bucket_new()
97 bucket->own_buf = 1; in php_stream_bucket_new()
99 bucket->buf = buf; in php_stream_bucket_new()
100 bucket->buflen = buflen; in php_stream_bucket_new()
101 bucket->own_buf = own_buf; in php_stream_bucket_new()
103 bucket->is_persistent = is_persistent; in php_stream_bucket_new()
104 bucket->refcount = 1; in php_stream_bucket_new()
105 bucket->brigade = NULL; in php_stream_bucket_new()
107 return bucket; in php_stream_bucket_new()
117 PHPAPI php_stream_bucket *php_stream_bucket_make_writeable(php_stream_bucket *bucket TSRMLS_DC) in php_stream_bucket_make_writeable()
121 php_stream_bucket_unlink(bucket TSRMLS_CC); in php_stream_bucket_make_writeable()
123 if (bucket->refcount == 1 && bucket->own_buf) { in php_stream_bucket_make_writeable()
124 return bucket; in php_stream_bucket_make_writeable()
127 retval = (php_stream_bucket*)pemalloc(sizeof(php_stream_bucket), bucket->is_persistent); in php_stream_bucket_make_writeable()
128 memcpy(retval, bucket, sizeof(*retval)); in php_stream_bucket_make_writeable()
131 memcpy(retval->buf, bucket->buf, retval->buflen); in php_stream_bucket_make_writeable()
136 php_stream_bucket_delref(bucket TSRMLS_CC); in php_stream_bucket_make_writeable()
182 PHPAPI void php_stream_bucket_delref(php_stream_bucket *bucket TSRMLS_DC) in php_stream_bucket_delref()
184 if (--bucket->refcount == 0) { in php_stream_bucket_delref()
185 if (bucket->own_buf) { in php_stream_bucket_delref()
186 pefree(bucket->buf, bucket->is_persistent); in php_stream_bucket_delref()
188 pefree(bucket, bucket->is_persistent); in php_stream_bucket_delref()
192 PHPAPI void php_stream_bucket_prepend(php_stream_bucket_brigade *brigade, php_stream_bucket *bucket in php_stream_bucket_prepend()
194 bucket->next = brigade->head; in php_stream_bucket_prepend()
195 bucket->prev = NULL; in php_stream_bucket_prepend()
198 brigade->head->prev = bucket; in php_stream_bucket_prepend()
200 brigade->tail = bucket; in php_stream_bucket_prepend()
202 brigade->head = bucket; in php_stream_bucket_prepend()
203 bucket->brigade = brigade; in php_stream_bucket_prepend()
206 PHPAPI void php_stream_bucket_append(php_stream_bucket_brigade *brigade, php_stream_bucket *bucket in php_stream_bucket_append()
208 if (brigade->tail == bucket) { in php_stream_bucket_append()
212 bucket->prev = brigade->tail; in php_stream_bucket_append()
213 bucket->next = NULL; in php_stream_bucket_append()
216 brigade->tail->next = bucket; in php_stream_bucket_append()
218 brigade->head = bucket; in php_stream_bucket_append()
220 brigade->tail = bucket; in php_stream_bucket_append()
221 bucket->brigade = brigade; in php_stream_bucket_append()
224 PHPAPI void php_stream_bucket_unlink(php_stream_bucket *bucket TSRMLS_DC) in php_stream_bucket_unlink()
226 if (bucket->prev) { in php_stream_bucket_unlink()
227 bucket->prev->next = bucket->next; in php_stream_bucket_unlink()
228 } else if (bucket->brigade) { in php_stream_bucket_unlink()
229 bucket->brigade->head = bucket->next; in php_stream_bucket_unlink()
231 if (bucket->next) { in php_stream_bucket_unlink()
232 bucket->next->prev = bucket->prev; in php_stream_bucket_unlink()
233 } else if (bucket->brigade) { in php_stream_bucket_unlink()
234 bucket->brigade->tail = bucket->prev; in php_stream_bucket_unlink()
236 bucket->brigade = NULL; in php_stream_bucket_unlink()
237 bucket->next = bucket->prev = NULL; in php_stream_bucket_unlink()
356 php_stream_bucket *bucket; in php_stream_filter_append_ex() local
359bucket = php_stream_bucket_new(stream, (char*) stream->readbuf + stream->readpos, stream->writepos… in php_stream_filter_append_ex()
360 php_stream_bucket_append(brig_inp, bucket TSRMLS_CC); in php_stream_filter_append_ex()
371 bucket = brig_in.head; in php_stream_filter_append_ex()
372 php_stream_bucket_unlink(bucket TSRMLS_CC); in php_stream_filter_append_ex()
373 php_stream_bucket_delref(bucket TSRMLS_CC); in php_stream_filter_append_ex()
376 bucket = brig_out.head; in php_stream_filter_append_ex()
377 php_stream_bucket_unlink(bucket TSRMLS_CC); in php_stream_filter_append_ex()
378 php_stream_bucket_delref(bucket TSRMLS_CC); in php_stream_filter_append_ex()
398 bucket = brig_outp->head; in php_stream_filter_append_ex()
401 if (stream->readbuflen - stream->writepos < bucket->buflen) { in php_stream_filter_append_ex()
402 stream->readbuflen += bucket->buflen; in php_stream_filter_append_ex()
405 memcpy(stream->readbuf + stream->writepos, bucket->buf, bucket->buflen); in php_stream_filter_append_ex()
406 stream->writepos += bucket->buflen; in php_stream_filter_append_ex()
408 php_stream_bucket_unlink(bucket TSRMLS_CC); in php_stream_filter_append_ex()
409 php_stream_bucket_delref(bucket TSRMLS_CC); in php_stream_filter_append_ex()
434 php_stream_bucket *bucket; in _php_stream_filter_flush() local
474 for(bucket = inp->head; bucket; bucket = bucket->next) { in _php_stream_filter_flush()
475 flushed_size += bucket->buflen; in _php_stream_filter_flush()
495 while ((bucket = inp->head)) { in _php_stream_filter_flush()
496 memcpy(stream->readbuf + stream->writepos, bucket->buf, bucket->buflen); in _php_stream_filter_flush()
497 stream->writepos += bucket->buflen; in _php_stream_filter_flush()
498 php_stream_bucket_unlink(bucket TSRMLS_CC); in _php_stream_filter_flush()
499 php_stream_bucket_delref(bucket TSRMLS_CC); in _php_stream_filter_flush()
503 while ((bucket = inp->head)) { in _php_stream_filter_flush()
504 stream->ops->write(stream, bucket->buf, bucket->buflen TSRMLS_CC); in _php_stream_filter_flush()
505 php_stream_bucket_unlink(bucket TSRMLS_CC); in _php_stream_filter_flush()
506 php_stream_bucket_delref(bucket TSRMLS_CC); in _php_stream_filter_flush()