Lines Matching refs:context

59 …t_handler_status_t php_output_handler_op(php_output_handler *handler, php_output_context *context);
63 static inline php_output_context *php_output_context_init(php_output_context *context, int op);
64 static inline void php_output_context_reset(php_output_context *context);
65 static inline void php_output_context_swap(php_output_context *context);
66 static inline void php_output_context_dtor(php_output_context *context);
271 php_output_context context; in php_output_flush() local
274 php_output_context_init(&context, PHP_OUTPUT_HANDLER_FLUSH); in php_output_flush()
275 php_output_handler_op(OG(active), &context); in php_output_flush()
276 if (context.out.data && context.out.used) { in php_output_flush()
278 php_output_write(context.out.data, context.out.used); in php_output_flush()
281 php_output_context_dtor(&context); in php_output_flush()
302 php_output_context context; in php_output_clean() local
305 php_output_context_init(&context, PHP_OUTPUT_HANDLER_CLEAN); in php_output_clean()
306 php_output_handler_op(OG(active), &context); in php_output_clean()
307 php_output_context_dtor(&context); in php_output_clean()
318 php_output_context context; in php_output_clean_all() local
321 php_output_context_init(&context, PHP_OUTPUT_HANDLER_CLEAN); in php_output_clean_all()
322 …ply_with_argument(&OG(handlers), ZEND_STACK_APPLY_TOPDOWN, php_output_stack_apply_clean, &context); in php_output_clean_all()
775 static inline php_output_context *php_output_context_init(php_output_context *context, int op) in php_output_context_init() argument
777 if (!context) { in php_output_context_init()
778 context = emalloc(sizeof(php_output_context)); in php_output_context_init()
781 memset(context, 0, sizeof(php_output_context)); in php_output_context_init()
782 context->op = op; in php_output_context_init()
784 return context; in php_output_context_init()
790 static inline void php_output_context_reset(php_output_context *context) in php_output_context_reset() argument
792 int op = context->op; in php_output_context_reset()
793 php_output_context_dtor(context); in php_output_context_reset()
794 memset(context, 0, sizeof(php_output_context)); in php_output_context_reset()
795 context->op = op; in php_output_context_reset()
801 static inline void php_output_context_feed(php_output_context *context, char *data, size_t size, si… in php_output_context_feed() argument
803 if (context->in.free && context->in.data) { in php_output_context_feed()
804 efree(context->in.data); in php_output_context_feed()
806 context->in.data = data; in php_output_context_feed()
807 context->in.used = used; in php_output_context_feed()
808 context->in.free = free; in php_output_context_feed()
809 context->in.size = size; in php_output_context_feed()
815 static inline void php_output_context_swap(php_output_context *context) in php_output_context_swap() argument
817 if (context->in.free && context->in.data) { in php_output_context_swap()
818 efree(context->in.data); in php_output_context_swap()
820 context->in.data = context->out.data; in php_output_context_swap()
821 context->in.used = context->out.used; in php_output_context_swap()
822 context->in.free = context->out.free; in php_output_context_swap()
823 context->in.size = context->out.size; in php_output_context_swap()
824 context->out.data = NULL; in php_output_context_swap()
825 context->out.used = 0; in php_output_context_swap()
826 context->out.free = 0; in php_output_context_swap()
827 context->out.size = 0; in php_output_context_swap()
833 static inline void php_output_context_pass(php_output_context *context) in php_output_context_pass() argument
835 context->out.data = context->in.data; in php_output_context_pass()
836 context->out.used = context->in.used; in php_output_context_pass()
837 context->out.size = context->in.size; in php_output_context_pass()
838 context->out.free = context->in.free; in php_output_context_pass()
839 context->in.data = NULL; in php_output_context_pass()
840 context->in.used = 0; in php_output_context_pass()
841 context->in.free = 0; in php_output_context_pass()
842 context->in.size = 0; in php_output_context_pass()
848 static inline void php_output_context_dtor(php_output_context *context) in php_output_context_dtor() argument
850 if (context->in.free && context->in.data) { in php_output_context_dtor()
851 efree(context->in.data); in php_output_context_dtor()
852 context->in.data = NULL; in php_output_context_dtor()
854 if (context->out.free && context->out.data) { in php_output_context_dtor()
855 efree(context->out.data); in php_output_context_dtor()
856 context->out.data = NULL; in php_output_context_dtor()
908 …ut_handler_status_t php_output_handler_op(php_output_handler *handler, php_output_context *context) in php_output_handler_op() argument
911 int original_op = context->op; in php_output_handler_op()
923 context->op, in php_output_handler_op()
930 context->in.used?context->in.data:"", in php_output_handler_op()
931 context->in.used in php_output_handler_op()
935 if (php_output_lock_error(context->op)) { in php_output_handler_op()
941 if (php_output_handler_append(handler, &context->in) && !context->op) { in php_output_handler_op()
942 context->op = original_op; in php_output_handler_op()
947 context->op |= PHP_OUTPUT_HANDLER_START; in php_output_handler_op()
955 ZVAL_LONG(&ob_mode, (zend_long) context->op); in php_output_handler_op()
966 context->out.data = estrndup(Z_STRVAL(retval), Z_STRLEN(retval)); in php_output_handler_op()
967 context->out.used = Z_STRLEN(retval); in php_output_handler_op()
968 context->out.free = 1; in php_output_handler_op()
982 …php_output_context_feed(context, handler->buffer.data, handler->buffer.size, handler->buffer.used,… in php_output_handler_op()
984 if (SUCCESS == handler->func.internal(&handler->opaq, context)) { in php_output_handler_op()
985 if (context->out.used) { in php_output_handler_op()
1003 if (context->out.data && context->out.free) { in php_output_handler_op()
1004 efree(context->out.data); in php_output_handler_op()
1007 context->out.data = handler->buffer.data; in php_output_handler_op()
1008 context->out.used = handler->buffer.used; in php_output_handler_op()
1009 context->out.free = 1; in php_output_handler_op()
1016 php_output_context_reset(context); in php_output_handler_op()
1025 context->op = original_op; in php_output_handler_op()
1035 php_output_context context; in php_output_op() local
1043 php_output_context_init(&context, op); in php_output_op()
1051 context.in.data = (char *) str; in php_output_op()
1052 context.in.used = len; in php_output_op()
1055 …_apply_with_argument(&OG(handlers), ZEND_STACK_APPLY_TOPDOWN, php_output_stack_apply_op, &context); in php_output_op()
1057 php_output_handler_op(*active, &context); in php_output_op()
1059 php_output_context_pass(&context); in php_output_op()
1062 context.out.data = (char *) str; in php_output_op()
1063 context.out.used = len; in php_output_op()
1066 if (context.out.data && context.out.used) { in php_output_op()
1071 fprintf(stderr, "::: sapi_write('%s', %zu)\n", context.out.data, context.out.used); in php_output_op()
1073 sapi_module.ub_write(context.out.data, context.out.used); in php_output_op()
1082 php_output_context_dtor(&context); in php_output_op()
1093 php_output_context *context = (php_output_context *) c; in php_output_stack_apply_op() local
1098 status = php_output_handler_op(handler, context); in php_output_stack_apply_op()
1112 php_output_context_swap(context); in php_output_stack_apply_op()
1121 php_output_context_pass(context); in php_output_stack_apply_op()
1126 php_output_context_swap(context); in php_output_stack_apply_op()
1139 php_output_context *context = (php_output_context *) c; in php_output_stack_apply_clean() local
1142 php_output_handler_op(handler, context); in php_output_stack_apply_clean()
1143 php_output_context_reset(context); in php_output_stack_apply_clean()
1195 php_output_context context; in php_output_stack_pop() local
1209 php_output_context_init(&context, PHP_OUTPUT_HANDLER_FINAL); in php_output_stack_pop()
1215 context.op |= PHP_OUTPUT_HANDLER_START; in php_output_stack_pop()
1219 context.op |= PHP_OUTPUT_HANDLER_CLEAN; in php_output_stack_pop()
1221 php_output_handler_op(orphan, &context); in php_output_stack_pop()
1233 if (context.out.data && context.out.used && !(flags & PHP_OUTPUT_POP_DISCARD)) { in php_output_stack_pop()
1234 php_output_write(context.out.data, context.out.used); in php_output_stack_pop()
1239 php_output_context_dtor(&context); in php_output_stack_pop()