Lines Matching refs:context

57 …t_handler_status_t php_output_handler_op(php_output_handler *handler, php_output_context *context);
61 static inline php_output_context *php_output_context_init(php_output_context *context, int op);
62 static inline void php_output_context_reset(php_output_context *context);
63 static inline void php_output_context_swap(php_output_context *context);
64 static inline void php_output_context_dtor(php_output_context *context);
269 php_output_context context; in php_output_flush() local
272 php_output_context_init(&context, PHP_OUTPUT_HANDLER_FLUSH); in php_output_flush()
273 php_output_handler_op(OG(active), &context); in php_output_flush()
274 if (context.out.data && context.out.used) { in php_output_flush()
276 php_output_write(context.out.data, context.out.used); in php_output_flush()
279 php_output_context_dtor(&context); in php_output_flush()
300 php_output_context context; in php_output_clean() local
303 php_output_context_init(&context, PHP_OUTPUT_HANDLER_CLEAN); in php_output_clean()
304 php_output_handler_op(OG(active), &context); in php_output_clean()
305 php_output_context_dtor(&context); in php_output_clean()
316 php_output_context context; in php_output_clean_all() local
319 php_output_context_init(&context, PHP_OUTPUT_HANDLER_CLEAN); in php_output_clean_all()
320 …ply_with_argument(&OG(handlers), ZEND_STACK_APPLY_TOPDOWN, php_output_stack_apply_clean, &context); in php_output_clean_all()
784 static inline php_output_context *php_output_context_init(php_output_context *context, int op) in php_output_context_init() argument
786 if (!context) { in php_output_context_init()
787 context = emalloc(sizeof(php_output_context)); in php_output_context_init()
790 memset(context, 0, sizeof(php_output_context)); in php_output_context_init()
791 context->op = op; in php_output_context_init()
793 return context; in php_output_context_init()
799 static inline void php_output_context_reset(php_output_context *context) in php_output_context_reset() argument
801 int op = context->op; in php_output_context_reset()
802 php_output_context_dtor(context); in php_output_context_reset()
803 memset(context, 0, sizeof(php_output_context)); in php_output_context_reset()
804 context->op = op; in php_output_context_reset()
810 static inline void php_output_context_feed(php_output_context *context, char *data, size_t size, si… in php_output_context_feed() argument
812 if (context->in.free && context->in.data) { in php_output_context_feed()
813 efree(context->in.data); in php_output_context_feed()
815 context->in.data = data; in php_output_context_feed()
816 context->in.used = used; in php_output_context_feed()
817 context->in.free = free; in php_output_context_feed()
818 context->in.size = size; in php_output_context_feed()
824 static inline void php_output_context_swap(php_output_context *context) in php_output_context_swap() argument
826 if (context->in.free && context->in.data) { in php_output_context_swap()
827 efree(context->in.data); in php_output_context_swap()
829 context->in.data = context->out.data; in php_output_context_swap()
830 context->in.used = context->out.used; in php_output_context_swap()
831 context->in.free = context->out.free; in php_output_context_swap()
832 context->in.size = context->out.size; in php_output_context_swap()
833 context->out.data = NULL; in php_output_context_swap()
834 context->out.used = 0; in php_output_context_swap()
835 context->out.free = 0; in php_output_context_swap()
836 context->out.size = 0; in php_output_context_swap()
842 static inline void php_output_context_pass(php_output_context *context) in php_output_context_pass() argument
844 context->out.data = context->in.data; in php_output_context_pass()
845 context->out.used = context->in.used; in php_output_context_pass()
846 context->out.size = context->in.size; in php_output_context_pass()
847 context->out.free = context->in.free; in php_output_context_pass()
848 context->in.data = NULL; in php_output_context_pass()
849 context->in.used = 0; in php_output_context_pass()
850 context->in.free = 0; in php_output_context_pass()
851 context->in.size = 0; in php_output_context_pass()
857 static inline void php_output_context_dtor(php_output_context *context) in php_output_context_dtor() argument
859 if (context->in.free && context->in.data) { in php_output_context_dtor()
860 efree(context->in.data); in php_output_context_dtor()
861 context->in.data = NULL; in php_output_context_dtor()
863 if (context->out.free && context->out.data) { in php_output_context_dtor()
864 efree(context->out.data); in php_output_context_dtor()
865 context->out.data = NULL; in php_output_context_dtor()
917 …ut_handler_status_t php_output_handler_op(php_output_handler *handler, php_output_context *context) in php_output_handler_op() argument
920 int original_op = context->op; in php_output_handler_op()
932 context->op, in php_output_handler_op()
939 context->in.used?context->in.data:"", in php_output_handler_op()
940 context->in.used in php_output_handler_op()
944 if (php_output_lock_error(context->op)) { in php_output_handler_op()
950 if (php_output_handler_append(handler, &context->in) && !context->op) { in php_output_handler_op()
951 context->op = original_op; in php_output_handler_op()
956 context->op |= PHP_OUTPUT_HANDLER_START; in php_output_handler_op()
964 ZVAL_LONG(&ob_mode, (zend_long) context->op); in php_output_handler_op()
975 context->out.data = estrndup(Z_STRVAL(retval), Z_STRLEN(retval)); in php_output_handler_op()
976 context->out.used = Z_STRLEN(retval); in php_output_handler_op()
977 context->out.free = 1; 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()
994 if (context->out.used) { in php_output_handler_op()
1012 if (context->out.data && context->out.free) { in php_output_handler_op()
1013 efree(context->out.data); 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()
1018 context->out.free = 1; in php_output_handler_op()
1025 php_output_context_reset(context); in php_output_handler_op()
1034 context->op = original_op; in php_output_handler_op()
1044 php_output_context context; in php_output_op() local
1052 php_output_context_init(&context, op); in php_output_op()
1060 context.in.data = (char *) str; in php_output_op()
1061 context.in.used = len; in php_output_op()
1064 …_apply_with_argument(&OG(handlers), ZEND_STACK_APPLY_TOPDOWN, php_output_stack_apply_op, &context); in php_output_op()
1066 php_output_handler_op(*active, &context); in php_output_op()
1068 php_output_context_pass(&context); in php_output_op()
1071 context.out.data = (char *) str; in php_output_op()
1072 context.out.used = len; in php_output_op()
1075 if (context.out.data && context.out.used) { in php_output_op()
1080 fprintf(stderr, "::: sapi_write('%s', %zu)\n", context.out.data, context.out.used); in php_output_op()
1082 sapi_module.ub_write(context.out.data, context.out.used); in php_output_op()
1091 php_output_context_dtor(&context); in php_output_op()
1102 php_output_context *context = (php_output_context *) c; in php_output_stack_apply_op() local
1107 status = php_output_handler_op(handler, context); in php_output_stack_apply_op()
1121 php_output_context_swap(context); in php_output_stack_apply_op()
1130 php_output_context_pass(context); in php_output_stack_apply_op()
1135 php_output_context_swap(context); in php_output_stack_apply_op()
1148 php_output_context *context = (php_output_context *) c; in php_output_stack_apply_clean() local
1151 php_output_handler_op(handler, context); in php_output_stack_apply_clean()
1152 php_output_context_reset(context); in php_output_stack_apply_clean()
1204 php_output_context context; in php_output_stack_pop() local
1218 php_output_context_init(&context, PHP_OUTPUT_HANDLER_FINAL); in php_output_stack_pop()
1224 context.op |= PHP_OUTPUT_HANDLER_START; in php_output_stack_pop()
1228 context.op |= PHP_OUTPUT_HANDLER_CLEAN; in php_output_stack_pop()
1230 php_output_handler_op(orphan, &context); in php_output_stack_pop()
1242 if (context.out.data && context.out.used && !(flags & PHP_OUTPUT_POP_DISCARD)) { in php_output_stack_pop()
1243 php_output_write(context.out.data, context.out.used); in php_output_stack_pop()
1248 php_output_context_dtor(&context); in php_output_stack_pop()