Lines Matching refs:context
55 …t_handler_status_t php_output_handler_op(php_output_handler *handler, php_output_context *context);
59 static inline void php_output_context_init(php_output_context *context, int op);
60 static inline void php_output_context_reset(php_output_context *context);
61 static inline void php_output_context_swap(php_output_context *context);
62 static inline void php_output_context_dtor(php_output_context *context);
255 php_output_context context; in php_output_flush() local
258 php_output_context_init(&context, PHP_OUTPUT_HANDLER_FLUSH); in php_output_flush()
259 php_output_handler_op(OG(active), &context); in php_output_flush()
260 if (context.out.data && context.out.used) { in php_output_flush()
262 php_output_write(context.out.data, context.out.used); in php_output_flush()
265 php_output_context_dtor(&context); in php_output_flush()
286 php_output_context context; in php_output_clean() local
289 php_output_context_init(&context, PHP_OUTPUT_HANDLER_CLEAN); in php_output_clean()
290 php_output_handler_op(OG(active), &context); in php_output_clean()
291 php_output_context_dtor(&context); in php_output_clean()
302 php_output_context context; in php_output_clean_all() local
305 php_output_context_init(&context, PHP_OUTPUT_HANDLER_CLEAN); in php_output_clean_all()
306 …ply_with_argument(&OG(handlers), ZEND_STACK_APPLY_TOPDOWN, php_output_stack_apply_clean, &context); in php_output_clean_all()
775 static inline void php_output_context_init(php_output_context *context, int op) in php_output_context_init() argument
777 memset(context, 0, sizeof(php_output_context)); in php_output_context_init()
778 context->op = op; in php_output_context_init()
784 static inline void php_output_context_reset(php_output_context *context) in php_output_context_reset() argument
786 int op = context->op; in php_output_context_reset()
787 php_output_context_dtor(context); in php_output_context_reset()
788 memset(context, 0, sizeof(php_output_context)); in php_output_context_reset()
789 context->op = op; in php_output_context_reset()
795 static inline void php_output_context_feed(php_output_context *context, char *data, size_t size, si… in php_output_context_feed() argument
797 if (context->in.free && context->in.data) { in php_output_context_feed()
798 efree(context->in.data); in php_output_context_feed()
800 context->in.data = data; in php_output_context_feed()
801 context->in.used = used; in php_output_context_feed()
802 context->in.free = free; in php_output_context_feed()
803 context->in.size = size; in php_output_context_feed()
809 static inline void php_output_context_swap(php_output_context *context) in php_output_context_swap() argument
811 if (context->in.free && context->in.data) { in php_output_context_swap()
812 efree(context->in.data); in php_output_context_swap()
814 context->in.data = context->out.data; in php_output_context_swap()
815 context->in.used = context->out.used; in php_output_context_swap()
816 context->in.free = context->out.free; in php_output_context_swap()
817 context->in.size = context->out.size; in php_output_context_swap()
818 context->out.data = NULL; in php_output_context_swap()
819 context->out.used = 0; in php_output_context_swap()
820 context->out.free = 0; in php_output_context_swap()
821 context->out.size = 0; in php_output_context_swap()
827 static inline void php_output_context_pass(php_output_context *context) in php_output_context_pass() argument
829 context->out.data = context->in.data; in php_output_context_pass()
830 context->out.used = context->in.used; in php_output_context_pass()
831 context->out.size = context->in.size; in php_output_context_pass()
832 context->out.free = context->in.free; in php_output_context_pass()
833 context->in.data = NULL; in php_output_context_pass()
834 context->in.used = 0; in php_output_context_pass()
835 context->in.free = 0; in php_output_context_pass()
836 context->in.size = 0; in php_output_context_pass()
842 static inline void php_output_context_dtor(php_output_context *context) in php_output_context_dtor() argument
844 if (context->in.free && context->in.data) { in php_output_context_dtor()
845 efree(context->in.data); in php_output_context_dtor()
846 context->in.data = NULL; in php_output_context_dtor()
848 if (context->out.free && context->out.data) { in php_output_context_dtor()
849 efree(context->out.data); in php_output_context_dtor()
850 context->out.data = NULL; in php_output_context_dtor()
902 …ut_handler_status_t php_output_handler_op(php_output_handler *handler, php_output_context *context) in php_output_handler_op() argument
905 int original_op = context->op; in php_output_handler_op()
917 context->op, in php_output_handler_op()
924 context->in.used?context->in.data:"", in php_output_handler_op()
925 context->in.used in php_output_handler_op()
929 if (php_output_lock_error(context->op)) { in php_output_handler_op()
935 if (php_output_handler_append(handler, &context->in) && !context->op) { in php_output_handler_op()
936 context->op = original_op; in php_output_handler_op()
941 context->op |= PHP_OUTPUT_HANDLER_START; in php_output_handler_op()
952 ZVAL_LONG(&ob_args[1], (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()
984 …php_output_context_feed(context, handler->buffer.data, handler->buffer.size, handler->buffer.used,… in php_output_handler_op()
986 if (SUCCESS == handler->func.internal(&handler->opaq, context)) { in php_output_handler_op()
987 if (context->out.used) { in php_output_handler_op()
1005 if (context->out.data && context->out.free) { in php_output_handler_op()
1006 efree(context->out.data); in php_output_handler_op()
1009 context->out.data = handler->buffer.data; in php_output_handler_op()
1010 context->out.used = handler->buffer.used; in php_output_handler_op()
1011 context->out.free = 1; in php_output_handler_op()
1018 php_output_context_reset(context); in php_output_handler_op()
1027 context->op = original_op; in php_output_handler_op()
1037 php_output_context context; in php_output_op() local
1045 php_output_context_init(&context, op); in php_output_op()
1053 context.in.data = (char *) str; in php_output_op()
1054 context.in.used = len; in php_output_op()
1057 …_apply_with_argument(&OG(handlers), ZEND_STACK_APPLY_TOPDOWN, php_output_stack_apply_op, &context); in php_output_op()
1059 php_output_handler_op(*active, &context); in php_output_op()
1061 php_output_context_pass(&context); in php_output_op()
1064 context.out.data = (char *) str; in php_output_op()
1065 context.out.used = len; in php_output_op()
1068 if (context.out.data && context.out.used) { in php_output_op()
1073 fprintf(stderr, "::: sapi_write('%s', %zu)\n", context.out.data, context.out.used); in php_output_op()
1075 sapi_module.ub_write(context.out.data, context.out.used); in php_output_op()
1084 php_output_context_dtor(&context); in php_output_op()
1095 php_output_context *context = (php_output_context *) c; in php_output_stack_apply_op() local
1100 status = php_output_handler_op(handler, context); in php_output_stack_apply_op()
1114 php_output_context_swap(context); in php_output_stack_apply_op()
1123 php_output_context_pass(context); in php_output_stack_apply_op()
1128 php_output_context_swap(context); in php_output_stack_apply_op()
1141 php_output_context *context = (php_output_context *) c; in php_output_stack_apply_clean() local
1144 php_output_handler_op(handler, context); in php_output_stack_apply_clean()
1145 php_output_context_reset(context); in php_output_stack_apply_clean()
1197 php_output_context context; in php_output_stack_pop() local
1211 php_output_context_init(&context, PHP_OUTPUT_HANDLER_FINAL); in php_output_stack_pop()
1217 context.op |= PHP_OUTPUT_HANDLER_START; in php_output_stack_pop()
1221 context.op |= PHP_OUTPUT_HANDLER_CLEAN; in php_output_stack_pop()
1223 php_output_handler_op(orphan, &context); in php_output_stack_pop()
1235 if (context.out.data && context.out.used && !(flags & PHP_OUTPUT_POP_DISCARD)) { in php_output_stack_pop()
1236 php_output_write(context.out.data, context.out.used); in php_output_stack_pop()
1241 php_output_context_dtor(&context); in php_output_stack_pop()