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);
254 php_output_context context; in php_output_flush() local
257 php_output_context_init(&context, PHP_OUTPUT_HANDLER_FLUSH); in php_output_flush()
258 php_output_handler_op(OG(active), &context); in php_output_flush()
259 if (context.out.data && context.out.used) { in php_output_flush()
261 php_output_write(context.out.data, context.out.used); in php_output_flush()
264 php_output_context_dtor(&context); in php_output_flush()
285 php_output_context context; in php_output_clean() local
288 php_output_context_init(&context, PHP_OUTPUT_HANDLER_CLEAN); in php_output_clean()
289 php_output_handler_op(OG(active), &context); in php_output_clean()
290 php_output_context_dtor(&context); in php_output_clean()
301 php_output_context context; in php_output_clean_all() local
304 php_output_context_init(&context, PHP_OUTPUT_HANDLER_CLEAN); in php_output_clean_all()
305 …ply_with_argument(&OG(handlers), ZEND_STACK_APPLY_TOPDOWN, php_output_stack_apply_clean, &context); in php_output_clean_all()
774 static inline void php_output_context_init(php_output_context *context, int op) in php_output_context_init() argument
776 memset(context, 0, sizeof(php_output_context)); in php_output_context_init()
777 context->op = op; in php_output_context_init()
783 static inline void php_output_context_reset(php_output_context *context) in php_output_context_reset() argument
785 int op = context->op; in php_output_context_reset()
786 php_output_context_dtor(context); in php_output_context_reset()
787 memset(context, 0, sizeof(php_output_context)); in php_output_context_reset()
788 context->op = op; in php_output_context_reset()
794 static inline void php_output_context_feed(php_output_context *context, char *data, size_t size, si… in php_output_context_feed() argument
796 if (context->in.free && context->in.data) { in php_output_context_feed()
797 efree(context->in.data); in php_output_context_feed()
799 context->in.data = data; in php_output_context_feed()
800 context->in.used = used; in php_output_context_feed()
801 context->in.free = free; in php_output_context_feed()
802 context->in.size = size; in php_output_context_feed()
808 static inline void php_output_context_swap(php_output_context *context) in php_output_context_swap() argument
810 if (context->in.free && context->in.data) { in php_output_context_swap()
811 efree(context->in.data); in php_output_context_swap()
813 context->in.data = context->out.data; in php_output_context_swap()
814 context->in.used = context->out.used; in php_output_context_swap()
815 context->in.free = context->out.free; in php_output_context_swap()
816 context->in.size = context->out.size; in php_output_context_swap()
817 context->out.data = NULL; in php_output_context_swap()
818 context->out.used = 0; in php_output_context_swap()
819 context->out.free = 0; in php_output_context_swap()
820 context->out.size = 0; in php_output_context_swap()
826 static inline void php_output_context_pass(php_output_context *context) in php_output_context_pass() argument
828 context->out.data = context->in.data; in php_output_context_pass()
829 context->out.used = context->in.used; in php_output_context_pass()
830 context->out.size = context->in.size; in php_output_context_pass()
831 context->out.free = context->in.free; in php_output_context_pass()
832 context->in.data = NULL; in php_output_context_pass()
833 context->in.used = 0; in php_output_context_pass()
834 context->in.free = 0; in php_output_context_pass()
835 context->in.size = 0; in php_output_context_pass()
841 static inline void php_output_context_dtor(php_output_context *context) in php_output_context_dtor() argument
843 if (context->in.free && context->in.data) { in php_output_context_dtor()
844 efree(context->in.data); in php_output_context_dtor()
845 context->in.data = NULL; in php_output_context_dtor()
847 if (context->out.free && context->out.data) { in php_output_context_dtor()
848 efree(context->out.data); in php_output_context_dtor()
849 context->out.data = NULL; in php_output_context_dtor()
901 …ut_handler_status_t php_output_handler_op(php_output_handler *handler, php_output_context *context) in php_output_handler_op() argument
904 int original_op = context->op; in php_output_handler_op()
916 context->op, in php_output_handler_op()
923 context->in.used?context->in.data:"", in php_output_handler_op()
924 context->in.used in php_output_handler_op()
932 if (php_output_lock_error(context->op)) { in php_output_handler_op()
938 if (php_output_handler_append(handler, &context->in) && !context->op) { in php_output_handler_op()
939 context->op = original_op; in php_output_handler_op()
944 context->op |= PHP_OUTPUT_HANDLER_START; in php_output_handler_op()
955 ZVAL_LONG(&ob_args[1], (zend_long) context->op); in php_output_handler_op()
969 context->out.data = estrndup(Z_STRVAL(retval), Z_STRLEN(retval)); in php_output_handler_op()
970 context->out.used = Z_STRLEN(retval); in php_output_handler_op()
971 context->out.free = 1; in php_output_handler_op()
987 …php_output_context_feed(context, handler->buffer.data, handler->buffer.size, handler->buffer.used,… in php_output_handler_op()
989 if (SUCCESS == handler->func.internal(&handler->opaq, context)) { in php_output_handler_op()
990 if (context->out.used) { in php_output_handler_op()
1008 if (context->out.data && context->out.free) { in php_output_handler_op()
1009 efree(context->out.data); in php_output_handler_op()
1012 context->out.data = handler->buffer.data; in php_output_handler_op()
1013 context->out.used = handler->buffer.used; in php_output_handler_op()
1014 context->out.free = 1; in php_output_handler_op()
1021 php_output_context_reset(context); in php_output_handler_op()
1030 context->op = original_op; in php_output_handler_op()
1040 php_output_context context; in php_output_op() local
1048 php_output_context_init(&context, op); in php_output_op()
1056 context.in.data = (char *) str; in php_output_op()
1057 context.in.used = len; in php_output_op()
1060 …_apply_with_argument(&OG(handlers), ZEND_STACK_APPLY_TOPDOWN, php_output_stack_apply_op, &context); in php_output_op()
1062 php_output_handler_op(*active, &context); in php_output_op()
1064 php_output_context_pass(&context); in php_output_op()
1067 context.out.data = (char *) str; in php_output_op()
1068 context.out.used = len; in php_output_op()
1071 if (context.out.data && context.out.used) { in php_output_op()
1076 fprintf(stderr, "::: sapi_write('%s', %zu)\n", context.out.data, context.out.used); in php_output_op()
1078 sapi_module.ub_write(context.out.data, context.out.used); in php_output_op()
1087 php_output_context_dtor(&context); in php_output_op()
1098 php_output_context *context = (php_output_context *) c; in php_output_stack_apply_op() local
1103 status = php_output_handler_op(handler, context); in php_output_stack_apply_op()
1117 php_output_context_swap(context); in php_output_stack_apply_op()
1126 php_output_context_pass(context); in php_output_stack_apply_op()
1131 php_output_context_swap(context); in php_output_stack_apply_op()
1144 php_output_context *context = (php_output_context *) c; in php_output_stack_apply_clean() local
1147 php_output_handler_op(handler, context); in php_output_stack_apply_clean()
1148 php_output_context_reset(context); in php_output_stack_apply_clean()
1200 php_output_context context; in php_output_stack_pop() local
1214 php_output_context_init(&context, PHP_OUTPUT_HANDLER_FINAL); in php_output_stack_pop()
1220 context.op |= PHP_OUTPUT_HANDLER_START; in php_output_stack_pop()
1224 context.op |= PHP_OUTPUT_HANDLER_CLEAN; in php_output_stack_pop()
1226 php_output_handler_op(orphan, &context); in php_output_stack_pop()
1238 if (context.out.data && context.out.used && !(flags & PHP_OUTPUT_POP_DISCARD)) { in php_output_stack_pop()
1239 php_output_write(context.out.data, context.out.used); in php_output_stack_pop()
1244 php_output_context_dtor(&context); in php_output_stack_pop()