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()
79 bucket->next = bucket->prev = NULL; in php_stream_bucket_new()
83 bucket->buf = pemalloc(buflen, 1); in php_stream_bucket_new()
84 memcpy(bucket->buf, buf, buflen); in php_stream_bucket_new()
85 bucket->buflen = buflen; in php_stream_bucket_new()
86 bucket->own_buf = 1; in php_stream_bucket_new()
88 bucket->buf = buf; in php_stream_bucket_new()
89 bucket->buflen = buflen; in php_stream_bucket_new()
90 bucket->own_buf = own_buf; in php_stream_bucket_new()
92 bucket->is_persistent = is_persistent; in php_stream_bucket_new()
93 bucket->refcount = 1; in php_stream_bucket_new()
94 bucket->brigade = NULL; in php_stream_bucket_new()
96 return bucket; in php_stream_bucket_new()
106 PHPAPI php_stream_bucket *php_stream_bucket_make_writeable(php_stream_bucket *bucket) in php_stream_bucket_make_writeable() argument
110 php_stream_bucket_unlink(bucket); in php_stream_bucket_make_writeable()
112 if (bucket->refcount == 1 && bucket->own_buf) { in php_stream_bucket_make_writeable()
113 return bucket; in php_stream_bucket_make_writeable()
116 retval = (php_stream_bucket*)pemalloc(sizeof(php_stream_bucket), bucket->is_persistent); in php_stream_bucket_make_writeable()
117 memcpy(retval, bucket, sizeof(*retval)); in php_stream_bucket_make_writeable()
120 memcpy(retval->buf, bucket->buf, retval->buflen); in php_stream_bucket_make_writeable()
125 php_stream_bucket_delref(bucket); in php_stream_bucket_make_writeable()
152 PHPAPI void php_stream_bucket_delref(php_stream_bucket *bucket) in php_stream_bucket_delref() argument
154 if (--bucket->refcount == 0) { in php_stream_bucket_delref()
155 if (bucket->own_buf) { in php_stream_bucket_delref()
156 pefree(bucket->buf, bucket->is_persistent); in php_stream_bucket_delref()
158 pefree(bucket, bucket->is_persistent); in php_stream_bucket_delref()
162 PHPAPI void php_stream_bucket_prepend(php_stream_bucket_brigade *brigade, php_stream_bucket *bucket) in php_stream_bucket_prepend() argument
164 bucket->next = brigade->head; in php_stream_bucket_prepend()
165 bucket->prev = NULL; in php_stream_bucket_prepend()
168 brigade->head->prev = bucket; in php_stream_bucket_prepend()
170 brigade->tail = bucket; in php_stream_bucket_prepend()
172 brigade->head = bucket; in php_stream_bucket_prepend()
173 bucket->brigade = brigade; in php_stream_bucket_prepend()
176 PHPAPI void php_stream_bucket_append(php_stream_bucket_brigade *brigade, php_stream_bucket *bucket) in php_stream_bucket_append() argument
178 if (brigade->tail == bucket) { in php_stream_bucket_append()
182 bucket->prev = brigade->tail; in php_stream_bucket_append()
183 bucket->next = NULL; in php_stream_bucket_append()
186 brigade->tail->next = bucket; in php_stream_bucket_append()
188 brigade->head = bucket; in php_stream_bucket_append()
190 brigade->tail = bucket; in php_stream_bucket_append()
191 bucket->brigade = brigade; in php_stream_bucket_append()
194 PHPAPI void php_stream_bucket_unlink(php_stream_bucket *bucket) in php_stream_bucket_unlink() argument
196 if (bucket->prev) { in php_stream_bucket_unlink()
197 bucket->prev->next = bucket->next; in php_stream_bucket_unlink()
198 } else if (bucket->brigade) { in php_stream_bucket_unlink()
199 bucket->brigade->head = bucket->next; in php_stream_bucket_unlink()
201 if (bucket->next) { in php_stream_bucket_unlink()
202 bucket->next->prev = bucket->prev; in php_stream_bucket_unlink()
203 } else if (bucket->brigade) { in php_stream_bucket_unlink()
204 bucket->brigade->tail = bucket->prev; in php_stream_bucket_unlink()
206 bucket->brigade = NULL; in php_stream_bucket_unlink()
207 bucket->next = bucket->prev = NULL; in php_stream_bucket_unlink()
327 php_stream_bucket *bucket; in php_stream_filter_append_ex() local
330bucket = php_stream_bucket_new(stream, (char*) stream->readbuf + stream->readpos, stream->writepos… in php_stream_filter_append_ex()
331 php_stream_bucket_append(brig_inp, bucket); in php_stream_filter_append_ex()
342 bucket = brig_in.head; in php_stream_filter_append_ex()
343 php_stream_bucket_unlink(bucket); in php_stream_filter_append_ex()
344 php_stream_bucket_delref(bucket); in php_stream_filter_append_ex()
347 bucket = brig_out.head; in php_stream_filter_append_ex()
348 php_stream_bucket_unlink(bucket); in php_stream_filter_append_ex()
349 php_stream_bucket_delref(bucket); in php_stream_filter_append_ex()
367 bucket = brig_outp->head; in php_stream_filter_append_ex()
370 if (stream->readbuflen - stream->writepos < bucket->buflen) { in php_stream_filter_append_ex()
371 stream->readbuflen += bucket->buflen; in php_stream_filter_append_ex()
374 memcpy(stream->readbuf + stream->writepos, bucket->buf, bucket->buflen); in php_stream_filter_append_ex()
375 stream->writepos += bucket->buflen; in php_stream_filter_append_ex()
377 php_stream_bucket_unlink(bucket); in php_stream_filter_append_ex()
378 php_stream_bucket_delref(bucket); in php_stream_filter_append_ex()
403 php_stream_bucket *bucket; in _php_stream_filter_flush() local
443 for(bucket = inp->head; bucket; bucket = bucket->next) { in _php_stream_filter_flush()
444 flushed_size += bucket->buflen; in _php_stream_filter_flush()
464 while ((bucket = inp->head)) { in _php_stream_filter_flush()
465 memcpy(stream->readbuf + stream->writepos, bucket->buf, bucket->buflen); in _php_stream_filter_flush()
466 stream->writepos += bucket->buflen; in _php_stream_filter_flush()
467 php_stream_bucket_unlink(bucket); in _php_stream_filter_flush()
468 php_stream_bucket_delref(bucket); in _php_stream_filter_flush()
472 while ((bucket = inp->head)) { in _php_stream_filter_flush()
473 ssize_t count = stream->ops->write(stream, bucket->buf, bucket->buflen); in _php_stream_filter_flush()
477 php_stream_bucket_unlink(bucket); in _php_stream_filter_flush()
478 php_stream_bucket_delref(bucket); in _php_stream_filter_flush()