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);
275 php_output_context context; in php_output_flush() local
278 php_output_context_init(&context, PHP_OUTPUT_HANDLER_FLUSH); in php_output_flush()
279 php_output_handler_op(OG(active), &context); in php_output_flush()
280 if (context.out.data && context.out.used) { in php_output_flush()
282 php_output_write(context.out.data, context.out.used); in php_output_flush()
285 php_output_context_dtor(&context); in php_output_flush()
306 php_output_context context; in php_output_clean() local
309 php_output_context_init(&context, PHP_OUTPUT_HANDLER_CLEAN); in php_output_clean()
310 php_output_handler_op(OG(active), &context); in php_output_clean()
311 php_output_context_dtor(&context); in php_output_clean()
322 php_output_context context; in php_output_clean_all() local
325 php_output_context_init(&context, PHP_OUTPUT_HANDLER_CLEAN); in php_output_clean_all()
326 …ply_with_argument(&OG(handlers), ZEND_STACK_APPLY_TOPDOWN, php_output_stack_apply_clean, &context); in php_output_clean_all()
795 static inline void php_output_context_init(php_output_context *context, int op) in php_output_context_init() argument
797 memset(context, 0, sizeof(php_output_context)); in php_output_context_init()
798 context->op = op; in php_output_context_init()
804 static inline void php_output_context_reset(php_output_context *context) in php_output_context_reset() argument
806 int op = context->op; in php_output_context_reset()
807 php_output_context_dtor(context); in php_output_context_reset()
808 memset(context, 0, sizeof(php_output_context)); in php_output_context_reset()
809 context->op = op; in php_output_context_reset()
815 static inline void php_output_context_feed(php_output_context *context, char *data, size_t size, si… in php_output_context_feed() argument
817 if (context->in.free && context->in.data) { in php_output_context_feed()
818 efree(context->in.data); in php_output_context_feed()
820 context->in.data = data; in php_output_context_feed()
821 context->in.used = used; in php_output_context_feed()
822 context->in.free = free; in php_output_context_feed()
823 context->in.size = size; in php_output_context_feed()
829 static inline void php_output_context_swap(php_output_context *context) in php_output_context_swap() argument
831 if (context->in.free && context->in.data) { in php_output_context_swap()
832 efree(context->in.data); in php_output_context_swap()
834 context->in.data = context->out.data; in php_output_context_swap()
835 context->in.used = context->out.used; in php_output_context_swap()
836 context->in.free = context->out.free; in php_output_context_swap()
837 context->in.size = context->out.size; in php_output_context_swap()
838 context->out.data = NULL; in php_output_context_swap()
839 context->out.used = 0; in php_output_context_swap()
840 context->out.free = 0; in php_output_context_swap()
841 context->out.size = 0; in php_output_context_swap()
847 static inline void php_output_context_pass(php_output_context *context) in php_output_context_pass() argument
849 context->out.data = context->in.data; in php_output_context_pass()
850 context->out.used = context->in.used; in php_output_context_pass()
851 context->out.size = context->in.size; in php_output_context_pass()
852 context->out.free = context->in.free; in php_output_context_pass()
853 context->in.data = NULL; in php_output_context_pass()
854 context->in.used = 0; in php_output_context_pass()
855 context->in.free = 0; in php_output_context_pass()
856 context->in.size = 0; in php_output_context_pass()
862 static inline void php_output_context_dtor(php_output_context *context) in php_output_context_dtor() argument
864 if (context->in.free && context->in.data) { in php_output_context_dtor()
865 efree(context->in.data); in php_output_context_dtor()
866 context->in.data = NULL; in php_output_context_dtor()
868 if (context->out.free && context->out.data) { in php_output_context_dtor()
869 efree(context->out.data); in php_output_context_dtor()
870 context->out.data = NULL; in php_output_context_dtor()
922 …ut_handler_status_t php_output_handler_op(php_output_handler *handler, php_output_context *context) in php_output_handler_op() argument
925 int original_op = context->op; in php_output_handler_op()
937 context->op, in php_output_handler_op()
944 context->in.used?context->in.data:"", in php_output_handler_op()
945 context->in.used in php_output_handler_op()
949 if (php_output_lock_error(context->op)) { in php_output_handler_op()
955 if (php_output_handler_append(handler, &context->in) && !context->op) { in php_output_handler_op()
956 context->op = original_op; in php_output_handler_op()
961 context->op |= PHP_OUTPUT_HANDLER_START; in php_output_handler_op()
969 ZVAL_LONG(&ob_mode, (zend_long) context->op); in php_output_handler_op()
980 context->out.data = estrndup(Z_STRVAL(retval), Z_STRLEN(retval)); in php_output_handler_op()
981 context->out.used = Z_STRLEN(retval); in php_output_handler_op()
982 context->out.free = 1; in php_output_handler_op()
996 …php_output_context_feed(context, handler->buffer.data, handler->buffer.size, handler->buffer.used,… in php_output_handler_op()
998 if (SUCCESS == handler->func.internal(&handler->opaq, context)) { in php_output_handler_op()
999 if (context->out.used) { in php_output_handler_op()
1017 if (context->out.data && context->out.free) { in php_output_handler_op()
1018 efree(context->out.data); in php_output_handler_op()
1021 context->out.data = handler->buffer.data; in php_output_handler_op()
1022 context->out.used = handler->buffer.used; in php_output_handler_op()
1023 context->out.free = 1; in php_output_handler_op()
1030 php_output_context_reset(context); in php_output_handler_op()
1039 context->op = original_op; in php_output_handler_op()
1049 php_output_context context; in php_output_op() local
1057 php_output_context_init(&context, op); in php_output_op()
1065 context.in.data = (char *) str; in php_output_op()
1066 context.in.used = len; in php_output_op()
1069 …_apply_with_argument(&OG(handlers), ZEND_STACK_APPLY_TOPDOWN, php_output_stack_apply_op, &context); in php_output_op()
1071 php_output_handler_op(*active, &context); in php_output_op()
1073 php_output_context_pass(&context); in php_output_op()
1076 context.out.data = (char *) str; in php_output_op()
1077 context.out.used = len; in php_output_op()
1080 if (context.out.data && context.out.used) { in php_output_op()
1085 fprintf(stderr, "::: sapi_write('%s', %zu)\n", context.out.data, context.out.used); in php_output_op()
1087 sapi_module.ub_write(context.out.data, context.out.used); in php_output_op()
1096 php_output_context_dtor(&context); in php_output_op()
1107 php_output_context *context = (php_output_context *) c; in php_output_stack_apply_op() local
1112 status = php_output_handler_op(handler, context); in php_output_stack_apply_op()
1126 php_output_context_swap(context); in php_output_stack_apply_op()
1135 php_output_context_pass(context); in php_output_stack_apply_op()
1140 php_output_context_swap(context); in php_output_stack_apply_op()
1153 php_output_context *context = (php_output_context *) c; in php_output_stack_apply_clean() local
1156 php_output_handler_op(handler, context); in php_output_stack_apply_clean()
1157 php_output_context_reset(context); in php_output_stack_apply_clean()
1209 php_output_context context; in php_output_stack_pop() local
1223 php_output_context_init(&context, PHP_OUTPUT_HANDLER_FINAL); in php_output_stack_pop()
1229 context.op |= PHP_OUTPUT_HANDLER_START; in php_output_stack_pop()
1233 context.op |= PHP_OUTPUT_HANDLER_CLEAN; in php_output_stack_pop()
1235 php_output_handler_op(orphan, &context); in php_output_stack_pop()
1247 if (context.out.data && context.out.used && !(flags & PHP_OUTPUT_POP_DISCARD)) { in php_output_stack_pop()
1248 php_output_write(context.out.data, context.out.used); in php_output_stack_pop()
1253 php_output_context_dtor(&context); in php_output_stack_pop()