Lines Matching refs:bucket

74 	php_stream_bucket *bucket;  in php_stream_bucket_new()  local
76 bucket = (php_stream_bucket*)pemalloc(sizeof(php_stream_bucket), is_persistent); in php_stream_bucket_new()
78 if (bucket == NULL) { in php_stream_bucket_new()
82 bucket->next = bucket->prev = NULL; in php_stream_bucket_new()
86 bucket->buf = pemalloc(buflen, 1); in php_stream_bucket_new()
88 if (bucket->buf == NULL) { in php_stream_bucket_new()
89 pefree(bucket, 1); in php_stream_bucket_new()
93 memcpy(bucket->buf, buf, buflen); in php_stream_bucket_new()
94 bucket->buflen = buflen; in php_stream_bucket_new()
95 bucket->own_buf = 1; in php_stream_bucket_new()
97 bucket->buf = buf; in php_stream_bucket_new()
98 bucket->buflen = buflen; in php_stream_bucket_new()
99 bucket->own_buf = own_buf; in php_stream_bucket_new()
101 bucket->is_persistent = is_persistent; in php_stream_bucket_new()
102 bucket->refcount = 1; in php_stream_bucket_new()
103 bucket->brigade = NULL; in php_stream_bucket_new()
105 return bucket; in php_stream_bucket_new()
115 PHPAPI php_stream_bucket *php_stream_bucket_make_writeable(php_stream_bucket *bucket) in php_stream_bucket_make_writeable() argument
119 php_stream_bucket_unlink(bucket); in php_stream_bucket_make_writeable()
121 if (bucket->refcount == 1 && bucket->own_buf) { in php_stream_bucket_make_writeable()
122 return bucket; in php_stream_bucket_make_writeable()
125 retval = (php_stream_bucket*)pemalloc(sizeof(php_stream_bucket), bucket->is_persistent); in php_stream_bucket_make_writeable()
126 memcpy(retval, bucket, sizeof(*retval)); in php_stream_bucket_make_writeable()
129 memcpy(retval->buf, bucket->buf, retval->buflen); in php_stream_bucket_make_writeable()
134 php_stream_bucket_delref(bucket); in php_stream_bucket_make_writeable()
180 PHPAPI void php_stream_bucket_delref(php_stream_bucket *bucket) in php_stream_bucket_delref() argument
182 if (--bucket->refcount == 0) { in php_stream_bucket_delref()
183 if (bucket->own_buf) { in php_stream_bucket_delref()
184 pefree(bucket->buf, bucket->is_persistent); in php_stream_bucket_delref()
186 pefree(bucket, bucket->is_persistent); in php_stream_bucket_delref()
190 PHPAPI void php_stream_bucket_prepend(php_stream_bucket_brigade *brigade, php_stream_bucket *bucket) in php_stream_bucket_prepend() argument
192 bucket->next = brigade->head; in php_stream_bucket_prepend()
193 bucket->prev = NULL; in php_stream_bucket_prepend()
196 brigade->head->prev = bucket; in php_stream_bucket_prepend()
198 brigade->tail = bucket; in php_stream_bucket_prepend()
200 brigade->head = bucket; in php_stream_bucket_prepend()
201 bucket->brigade = brigade; in php_stream_bucket_prepend()
204 PHPAPI void php_stream_bucket_append(php_stream_bucket_brigade *brigade, php_stream_bucket *bucket) in php_stream_bucket_append() argument
206 if (brigade->tail == bucket) { in php_stream_bucket_append()
210 bucket->prev = brigade->tail; in php_stream_bucket_append()
211 bucket->next = NULL; in php_stream_bucket_append()
214 brigade->tail->next = bucket; in php_stream_bucket_append()
216 brigade->head = bucket; in php_stream_bucket_append()
218 brigade->tail = bucket; in php_stream_bucket_append()
219 bucket->brigade = brigade; in php_stream_bucket_append()
222 PHPAPI void php_stream_bucket_unlink(php_stream_bucket *bucket) in php_stream_bucket_unlink() argument
224 if (bucket->prev) { in php_stream_bucket_unlink()
225 bucket->prev->next = bucket->next; in php_stream_bucket_unlink()
226 } else if (bucket->brigade) { in php_stream_bucket_unlink()
227 bucket->brigade->head = bucket->next; in php_stream_bucket_unlink()
229 if (bucket->next) { in php_stream_bucket_unlink()
230 bucket->next->prev = bucket->prev; in php_stream_bucket_unlink()
231 } else if (bucket->brigade) { in php_stream_bucket_unlink()
232 bucket->brigade->tail = bucket->prev; in php_stream_bucket_unlink()
234 bucket->brigade = NULL; in php_stream_bucket_unlink()
235 bucket->next = bucket->prev = NULL; in php_stream_bucket_unlink()
354 php_stream_bucket *bucket; in php_stream_filter_append_ex() local
357bucket = php_stream_bucket_new(stream, (char*) stream->readbuf + stream->readpos, stream->writepos… in php_stream_filter_append_ex()
358 php_stream_bucket_append(brig_inp, bucket); in php_stream_filter_append_ex()
369 bucket = brig_in.head; in php_stream_filter_append_ex()
370 php_stream_bucket_unlink(bucket); in php_stream_filter_append_ex()
371 php_stream_bucket_delref(bucket); in php_stream_filter_append_ex()
374 bucket = brig_out.head; in php_stream_filter_append_ex()
375 php_stream_bucket_unlink(bucket); in php_stream_filter_append_ex()
376 php_stream_bucket_delref(bucket); in php_stream_filter_append_ex()
396 bucket = brig_outp->head; in php_stream_filter_append_ex()
399 if (stream->readbuflen - stream->writepos < bucket->buflen) { in php_stream_filter_append_ex()
400 stream->readbuflen += bucket->buflen; in php_stream_filter_append_ex()
403 memcpy(stream->readbuf + stream->writepos, bucket->buf, bucket->buflen); in php_stream_filter_append_ex()
404 stream->writepos += bucket->buflen; in php_stream_filter_append_ex()
406 php_stream_bucket_unlink(bucket); in php_stream_filter_append_ex()
407 php_stream_bucket_delref(bucket); in php_stream_filter_append_ex()
432 php_stream_bucket *bucket; in _php_stream_filter_flush() local
472 for(bucket = inp->head; bucket; bucket = bucket->next) { in _php_stream_filter_flush()
473 flushed_size += bucket->buflen; in _php_stream_filter_flush()
493 while ((bucket = inp->head)) { in _php_stream_filter_flush()
494 memcpy(stream->readbuf + stream->writepos, bucket->buf, bucket->buflen); in _php_stream_filter_flush()
495 stream->writepos += bucket->buflen; in _php_stream_filter_flush()
496 php_stream_bucket_unlink(bucket); in _php_stream_filter_flush()
497 php_stream_bucket_delref(bucket); in _php_stream_filter_flush()
501 while ((bucket = inp->head)) { in _php_stream_filter_flush()
502 stream->ops->write(stream, bucket->buf, bucket->buflen); in _php_stream_filter_flush()
503 php_stream_bucket_unlink(bucket); in _php_stream_filter_flush()
504 php_stream_bucket_delref(bucket); in _php_stream_filter_flush()