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()
77 bucket->next = bucket->prev = NULL; in php_stream_bucket_new()
81 bucket->buf = pemalloc(buflen, 1); in php_stream_bucket_new()
82 memcpy(bucket->buf, buf, buflen); in php_stream_bucket_new()
83 bucket->buflen = buflen; in php_stream_bucket_new()
84 bucket->own_buf = 1; in php_stream_bucket_new()
86 bucket->buf = buf; in php_stream_bucket_new()
87 bucket->buflen = buflen; in php_stream_bucket_new()
88 bucket->own_buf = own_buf; in php_stream_bucket_new()
90 bucket->is_persistent = is_persistent; in php_stream_bucket_new()
91 bucket->refcount = 1; in php_stream_bucket_new()
92 bucket->brigade = NULL; in php_stream_bucket_new()
94 return bucket; in php_stream_bucket_new()
104 PHPAPI php_stream_bucket *php_stream_bucket_make_writeable(php_stream_bucket *bucket) in php_stream_bucket_make_writeable() argument
108 php_stream_bucket_unlink(bucket); in php_stream_bucket_make_writeable()
110 if (bucket->refcount == 1 && bucket->own_buf) { in php_stream_bucket_make_writeable()
111 return bucket; in php_stream_bucket_make_writeable()
114 retval = (php_stream_bucket*)pemalloc(sizeof(php_stream_bucket), bucket->is_persistent); in php_stream_bucket_make_writeable()
115 memcpy(retval, bucket, sizeof(*retval)); in php_stream_bucket_make_writeable()
118 memcpy(retval->buf, bucket->buf, retval->buflen); in php_stream_bucket_make_writeable()
123 php_stream_bucket_delref(bucket); in php_stream_bucket_make_writeable()
150 PHPAPI void php_stream_bucket_delref(php_stream_bucket *bucket) in php_stream_bucket_delref() argument
152 if (--bucket->refcount == 0) { in php_stream_bucket_delref()
153 if (bucket->own_buf) { in php_stream_bucket_delref()
154 pefree(bucket->buf, bucket->is_persistent); in php_stream_bucket_delref()
156 pefree(bucket, bucket->is_persistent); in php_stream_bucket_delref()
160 PHPAPI void php_stream_bucket_prepend(php_stream_bucket_brigade *brigade, php_stream_bucket *bucket) in php_stream_bucket_prepend() argument
162 bucket->next = brigade->head; in php_stream_bucket_prepend()
163 bucket->prev = NULL; in php_stream_bucket_prepend()
166 brigade->head->prev = bucket; in php_stream_bucket_prepend()
168 brigade->tail = bucket; in php_stream_bucket_prepend()
170 brigade->head = bucket; in php_stream_bucket_prepend()
171 bucket->brigade = brigade; in php_stream_bucket_prepend()
174 PHPAPI void php_stream_bucket_append(php_stream_bucket_brigade *brigade, php_stream_bucket *bucket) in php_stream_bucket_append() argument
176 if (brigade->tail == bucket) { in php_stream_bucket_append()
180 bucket->prev = brigade->tail; in php_stream_bucket_append()
181 bucket->next = NULL; in php_stream_bucket_append()
184 brigade->tail->next = bucket; in php_stream_bucket_append()
186 brigade->head = bucket; in php_stream_bucket_append()
188 brigade->tail = bucket; in php_stream_bucket_append()
189 bucket->brigade = brigade; in php_stream_bucket_append()
192 PHPAPI void php_stream_bucket_unlink(php_stream_bucket *bucket) in php_stream_bucket_unlink() argument
194 if (bucket->prev) { in php_stream_bucket_unlink()
195 bucket->prev->next = bucket->next; in php_stream_bucket_unlink()
196 } else if (bucket->brigade) { in php_stream_bucket_unlink()
197 bucket->brigade->head = bucket->next; in php_stream_bucket_unlink()
199 if (bucket->next) { in php_stream_bucket_unlink()
200 bucket->next->prev = bucket->prev; in php_stream_bucket_unlink()
201 } else if (bucket->brigade) { in php_stream_bucket_unlink()
202 bucket->brigade->tail = bucket->prev; in php_stream_bucket_unlink()
204 bucket->brigade = NULL; in php_stream_bucket_unlink()
205 bucket->next = bucket->prev = NULL; in php_stream_bucket_unlink()
325 php_stream_bucket *bucket; in php_stream_filter_append_ex() local
328 …bucket = php_stream_bucket_new(stream, (char*) stream->readbuf + stream->readpos, stream->writepos… in php_stream_filter_append_ex()
329 php_stream_bucket_append(brig_inp, bucket); in php_stream_filter_append_ex()
340 bucket = brig_in.head; in php_stream_filter_append_ex()
341 php_stream_bucket_unlink(bucket); in php_stream_filter_append_ex()
342 php_stream_bucket_delref(bucket); in php_stream_filter_append_ex()
345 bucket = brig_out.head; in php_stream_filter_append_ex()
346 php_stream_bucket_unlink(bucket); in php_stream_filter_append_ex()
347 php_stream_bucket_delref(bucket); in php_stream_filter_append_ex()
365 bucket = brig_outp->head; in php_stream_filter_append_ex()
368 if (stream->readbuflen - stream->writepos < bucket->buflen) { in php_stream_filter_append_ex()
369 stream->readbuflen += bucket->buflen; in php_stream_filter_append_ex()
372 memcpy(stream->readbuf + stream->writepos, bucket->buf, bucket->buflen); in php_stream_filter_append_ex()
373 stream->writepos += bucket->buflen; 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()
401 php_stream_bucket *bucket; in _php_stream_filter_flush() local
441 for(bucket = inp->head; bucket; bucket = bucket->next) { in _php_stream_filter_flush()
442 flushed_size += bucket->buflen; in _php_stream_filter_flush()
462 while ((bucket = inp->head)) { in _php_stream_filter_flush()
463 memcpy(stream->readbuf + stream->writepos, bucket->buf, bucket->buflen); in _php_stream_filter_flush()
464 stream->writepos += bucket->buflen; in _php_stream_filter_flush()
465 php_stream_bucket_unlink(bucket); in _php_stream_filter_flush()
466 php_stream_bucket_delref(bucket); in _php_stream_filter_flush()
470 while ((bucket = inp->head)) { in _php_stream_filter_flush()
471 ssize_t count = stream->ops->write(stream, bucket->buf, bucket->buflen); in _php_stream_filter_flush()
475 php_stream_bucket_unlink(bucket); in _php_stream_filter_flush()
476 php_stream_bucket_delref(bucket); in _php_stream_filter_flush()