Lines Matching refs:handler

55 static inline php_output_handler_status_t php_output_handler_op(php_output_handler *handler, php_ou…
56 static inline int php_output_handler_append(php_output_handler *handler, const php_output_buffer *b…
57 static inline zval *php_output_handler_status(php_output_handler *handler, zval *entry);
179 php_output_handler **handler = NULL; in php_output_deactivate() local
190 while ((handler = zend_stack_top(&OG(handlers)))) { in php_output_deactivate()
191 php_output_handler_free(handler); in php_output_deactivate()
417 php_output_handler *handler; in php_output_start_default() local
419handler = php_output_handler_create_internal(ZEND_STRL(php_output_default_handler_name), php_outpu… in php_output_start_default()
420 if (SUCCESS == php_output_handler_start(handler)) { in php_output_start_default()
423 php_output_handler_free(&handler); in php_output_start_default()
432 php_output_handler *handler; in php_output_start_devnull() local
434handler = php_output_handler_create_internal(ZEND_STRL(php_output_devnull_handler_name), php_outpu… in php_output_start_devnull()
435 if (SUCCESS == php_output_handler_start(handler)) { in php_output_start_devnull()
438 php_output_handler_free(&handler); in php_output_start_devnull()
447 php_output_handler *handler; in php_output_start_user() local
450 handler = php_output_handler_create_user(output_handler, chunk_size, flags); in php_output_start_user()
452handler = php_output_handler_create_internal(ZEND_STRL(php_output_default_handler_name), php_outpu… in php_output_start_user()
454 if (SUCCESS == php_output_handler_start(handler)) { in php_output_start_user()
457 php_output_handler_free(&handler); in php_output_start_user()
466 php_output_handler *handler; in php_output_start_internal() local
468handler = php_output_handler_create_internal(name, name_len, php_output_handler_compat_func, chunk… in php_output_start_internal()
469 php_output_handler_set_context(handler, output_handler, NULL); in php_output_start_internal()
470 if (SUCCESS == php_output_handler_start(handler)) { in php_output_start_internal()
473 php_output_handler_free(&handler); in php_output_start_internal()
484 php_output_handler *handler = NULL; in php_output_handler_create_user() local
490handler = php_output_handler_create_internal(ZEND_STRL(php_output_default_handler_name), php_outpu… in php_output_handler_create_user()
494 handler = alias(Z_STRVAL_P(output_handler), Z_STRLEN_P(output_handler), chunk_size, flags); in php_output_handler_create_user()
500handler = php_output_handler_init(handler_name, chunk_size, (flags & ~0xf) | PHP_OUTPUT_HANDLER_US… in php_output_handler_create_user()
502 handler->func.user = user; in php_output_handler_create_user()
515 return handler; in php_output_handler_create_user()
523 php_output_handler *handler; in php_output_handler_create_internal() local
526 handler = php_output_handler_init(str, chunk_size, (flags & ~0xf) | PHP_OUTPUT_HANDLER_INTERNAL); in php_output_handler_create_internal()
527 handler->func.internal = output_handler; in php_output_handler_create_internal()
530 return handler; in php_output_handler_create_internal()
536 PHPAPI void php_output_handler_set_context(php_output_handler *handler, void *opaq, void (*dtor)(vo… in php_output_handler_set_context() argument
538 if (handler->dtor && handler->opaq) { in php_output_handler_set_context()
539 handler->dtor(handler->opaq); in php_output_handler_set_context()
541 handler->dtor = dtor; in php_output_handler_set_context()
542 handler->opaq = opaq; in php_output_handler_set_context()
548 PHPAPI int php_output_handler_start(php_output_handler *handler) in php_output_handler_start() argument
553 if (php_output_lock_error(PHP_OUTPUT_HANDLER_START) || !handler) { in php_output_handler_start()
556 if (NULL != (conflict = zend_hash_find_ptr(&php_output_handler_conflicts, handler->name))) { in php_output_handler_start()
557 if (SUCCESS != conflict(ZSTR_VAL(handler->name), ZSTR_LEN(handler->name))) { in php_output_handler_start()
561 …if (NULL != (rconflicts = zend_hash_find_ptr(&php_output_handler_reverse_conflicts, handler->name)… in php_output_handler_start()
563 if (SUCCESS != conflict(ZSTR_VAL(handler->name), ZSTR_LEN(handler->name))) { in php_output_handler_start()
569 handler->level = zend_stack_push(&OG(handlers), &handler); in php_output_handler_start()
570 OG(active) = handler; in php_output_handler_start()
714 PHPAPI void php_output_handler_dtor(php_output_handler *handler) in php_output_handler_dtor() argument
716 if (handler->name) { in php_output_handler_dtor()
717 zend_string_release_ex(handler->name, 0); in php_output_handler_dtor()
719 if (handler->buffer.data) { in php_output_handler_dtor()
720 efree(handler->buffer.data); in php_output_handler_dtor()
722 if (handler->flags & PHP_OUTPUT_HANDLER_USER) { in php_output_handler_dtor()
723 zval_ptr_dtor(&handler->func.user->zoh); in php_output_handler_dtor()
724 efree(handler->func.user); in php_output_handler_dtor()
726 if (handler->dtor && handler->opaq) { in php_output_handler_dtor()
727 handler->dtor(handler->opaq); in php_output_handler_dtor()
729 memset(handler, 0, sizeof(*handler)); in php_output_handler_dtor()
874 php_output_handler *handler; in php_output_handler_init() local
876 handler = ecalloc(1, sizeof(php_output_handler)); in php_output_handler_init()
877 handler->name = zend_string_copy(name); in php_output_handler_init()
878 handler->size = chunk_size; in php_output_handler_init()
879 handler->flags = flags; in php_output_handler_init()
880 handler->buffer.size = PHP_OUTPUT_HANDLER_INITBUF_SIZE(chunk_size); in php_output_handler_init()
881 handler->buffer.data = emalloc(handler->buffer.size); in php_output_handler_init()
883 return handler; in php_output_handler_init()
889 static inline int php_output_handler_append(php_output_handler *handler, const php_output_buffer *b… in php_output_handler_append() argument
894 if ((handler->buffer.size - handler->buffer.used) <= buf->used) { in php_output_handler_append()
895 size_t grow_int = PHP_OUTPUT_HANDLER_INITBUF_SIZE(handler->size); in php_output_handler_append()
896 …size_t grow_buf = PHP_OUTPUT_HANDLER_INITBUF_SIZE(buf->used - (handler->buffer.size - handler->buf… in php_output_handler_append()
899 handler->buffer.data = safe_erealloc(handler->buffer.data, 1, handler->buffer.size, grow_max); in php_output_handler_append()
900 handler->buffer.size += grow_max; in php_output_handler_append()
902 memcpy(handler->buffer.data + handler->buffer.used, buf->data, buf->used); in php_output_handler_append()
903 handler->buffer.used += buf->used; in php_output_handler_append()
906 if (handler->size && (handler->buffer.used >= handler->size)) { in php_output_handler_append()
917 static inline php_output_handler_status_t php_output_handler_op(php_output_handler *handler, php_ou… in php_output_handler_op() argument
933 handler, in php_output_handler_op()
934 handler->name, in php_output_handler_op()
935 handler->flags, in php_output_handler_op()
936 handler->buffer.used?handler->buffer.data:"", in php_output_handler_op()
937 handler->buffer.used, in php_output_handler_op()
938 handler->buffer.size, in php_output_handler_op()
950 if (php_output_handler_append(handler, &context->in) && !context->op) { in php_output_handler_op()
955 if (!(handler->flags & PHP_OUTPUT_HANDLER_STARTED)) { in php_output_handler_op()
959 OG(running) = handler; in php_output_handler_op()
960 if (handler->flags & PHP_OUTPUT_HANDLER_USER) { in php_output_handler_op()
963 ZVAL_STRINGL(&ob_data, handler->buffer.data, handler->buffer.used); in php_output_handler_op()
965 zend_fcall_info_argn(&handler->func.user->fci, 2, &ob_data, &ob_mode); in php_output_handler_op()
969 …if (SUCCESS == zend_fcall_info_call(&handler->func.user->fci, &handler->func.user->fcc, &retval, N… in php_output_handler_op()
986 zend_fcall_info_argn(&handler->func.user->fci, 0); in php_output_handler_op()
991 …php_output_context_feed(context, handler->buffer.data, handler->buffer.size, handler->buffer.used,… in php_output_handler_op()
993 if (SUCCESS == handler->func.internal(&handler->opaq, context)) { in php_output_handler_op()
1003 handler->flags |= PHP_OUTPUT_HANDLER_STARTED; in php_output_handler_op()
1010 handler->flags |= PHP_OUTPUT_HANDLER_DISABLED; in php_output_handler_op()
1016 context->out.data = handler->buffer.data; in php_output_handler_op()
1017 context->out.used = handler->buffer.used; in php_output_handler_op()
1019 handler->buffer.data = NULL; in php_output_handler_op()
1020 handler->buffer.used = 0; in php_output_handler_op()
1021 handler->buffer.size = 0; in php_output_handler_op()
1029 handler->buffer.used = 0; in php_output_handler_op()
1030 handler->flags |= PHP_OUTPUT_HANDLER_PROCESSED; in php_output_handler_op()
1101 php_output_handler *handler = *(php_output_handler **) h; in php_output_stack_apply_op() local
1104 if ((was_disabled = (handler->flags & PHP_OUTPUT_HANDLER_DISABLED))) { in php_output_stack_apply_op()
1107 status = php_output_handler_op(handler, context); in php_output_stack_apply_op()
1120 if (handler->level) { in php_output_stack_apply_op()
1129 if (!handler->level) { in php_output_stack_apply_op()
1134 if (handler->level) { in php_output_stack_apply_op()
1147 php_output_handler *handler = *(php_output_handler **) h; in php_output_stack_apply_clean() local
1150 handler->buffer.used = 0; in php_output_stack_apply_clean()
1151 php_output_handler_op(handler, context); in php_output_stack_apply_clean()
1161 php_output_handler *handler = *(php_output_handler **) h; in php_output_stack_apply_list() local
1164 add_next_index_str(array, zend_string_copy(handler->name)); in php_output_stack_apply_list()
1173 php_output_handler *handler = *(php_output_handler **) h; in php_output_stack_apply_status() local
1176 add_next_index_zval(array, php_output_handler_status(handler, &arr)); in php_output_stack_apply_status()
1183 static inline zval *php_output_handler_status(php_output_handler *handler, zval *entry) in php_output_handler_status() argument
1188 add_assoc_str(entry, "name", zend_string_copy(handler->name)); in php_output_handler_status()
1189 add_assoc_long(entry, "type", (zend_long) (handler->flags & 0xf)); in php_output_handler_status()
1190 add_assoc_long(entry, "flags", (zend_long) handler->flags); in php_output_handler_status()
1191 add_assoc_long(entry, "level", (zend_long) handler->level); in php_output_handler_status()
1192 add_assoc_long(entry, "chunk_size", (zend_long) handler->size); in php_output_handler_status()
1193 add_assoc_long(entry, "buffer_size", (zend_long) handler->buffer.size); in php_output_handler_status()
1194 add_assoc_long(entry, "buffer_used", (zend_long) handler->buffer.used); in php_output_handler_status()