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 TSRML…
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);
280 php_output_context context; in php_output_flush() local
283 php_output_context_init(&context, PHP_OUTPUT_HANDLER_FLUSH TSRMLS_CC); in php_output_flush()
284 php_output_handler_op(OG(active), &context); in php_output_flush()
285 if (context.out.data && context.out.used) { in php_output_flush()
287 php_output_write(context.out.data, context.out.used TSRMLS_CC); in php_output_flush()
290 php_output_context_dtor(&context); in php_output_flush()
311 php_output_context context; in php_output_clean() local
314 php_output_context_init(&context, PHP_OUTPUT_HANDLER_CLEAN TSRMLS_CC); in php_output_clean()
315 php_output_handler_op(OG(active), &context); in php_output_clean()
316 php_output_context_dtor(&context); in php_output_clean()
327 php_output_context context; in php_output_clean_all() local
330 php_output_context_init(&context, PHP_OUTPUT_HANDLER_CLEAN TSRMLS_CC); in php_output_clean_all()
331 …ply_with_argument(&OG(handlers), ZEND_STACK_APPLY_TOPDOWN, php_output_stack_apply_clean, &context); in php_output_clean_all()
787 static inline php_output_context *php_output_context_init(php_output_context *context, int op TSRML… in php_output_context_init() argument
789 if (!context) { in php_output_context_init()
790 context = emalloc(sizeof(php_output_context)); in php_output_context_init()
793 memset(context, 0, sizeof(php_output_context)); in php_output_context_init()
794 TSRMLS_SET_CTX(context->tsrm_ls); in php_output_context_init()
795 context->op = op; in php_output_context_init()
797 return context; in php_output_context_init()
803 static inline void php_output_context_reset(php_output_context *context) in php_output_context_reset() argument
805 int op = context->op; in php_output_context_reset()
806 php_output_context_dtor(context); in php_output_context_reset()
807 memset(context, 0, sizeof(php_output_context)); in php_output_context_reset()
808 context->op = op; in php_output_context_reset()
814 static inline void php_output_context_feed(php_output_context *context, char *data, size_t size, si… in php_output_context_feed() argument
816 if (context->in.free && context->in.data) { in php_output_context_feed()
817 efree(context->in.data); in php_output_context_feed()
819 context->in.data = data; in php_output_context_feed()
820 context->in.used = used; in php_output_context_feed()
821 context->in.free = free; in php_output_context_feed()
822 context->in.size = size; in php_output_context_feed()
828 static inline void php_output_context_swap(php_output_context *context) in php_output_context_swap() argument
830 if (context->in.free && context->in.data) { in php_output_context_swap()
831 efree(context->in.data); in php_output_context_swap()
833 context->in.data = context->out.data; in php_output_context_swap()
834 context->in.used = context->out.used; in php_output_context_swap()
835 context->in.free = context->out.free; in php_output_context_swap()
836 context->in.size = context->out.size; in php_output_context_swap()
837 context->out.data = NULL; in php_output_context_swap()
838 context->out.used = 0; in php_output_context_swap()
839 context->out.free = 0; in php_output_context_swap()
840 context->out.size = 0; in php_output_context_swap()
846 static inline void php_output_context_pass(php_output_context *context) in php_output_context_pass() argument
848 context->out.data = context->in.data; in php_output_context_pass()
849 context->out.used = context->in.used; in php_output_context_pass()
850 context->out.size = context->in.size; in php_output_context_pass()
851 context->out.free = context->in.free; in php_output_context_pass()
852 context->in.data = NULL; in php_output_context_pass()
853 context->in.used = 0; in php_output_context_pass()
854 context->in.free = 0; in php_output_context_pass()
855 context->in.size = 0; in php_output_context_pass()
861 static inline void php_output_context_dtor(php_output_context *context) in php_output_context_dtor() argument
863 if (context->in.free && context->in.data) { in php_output_context_dtor()
864 efree(context->in.data); in php_output_context_dtor()
865 context->in.data = NULL; in php_output_context_dtor()
867 if (context->out.free && context->out.data) { in php_output_context_dtor()
868 efree(context->out.data); in php_output_context_dtor()
869 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()
926 PHP_OUTPUT_TSRMLS(context); in php_output_handler_op()
938 context->op, in php_output_handler_op()
945 context->in.used?context->in.data:"", in php_output_handler_op()
946 context->in.used in php_output_handler_op()
950 if (php_output_lock_error(context->op TSRMLS_CC)) { in php_output_handler_op()
956 if (php_output_handler_append(handler, &context->in TSRMLS_CC) && !context->op) { in php_output_handler_op()
957 context->op = original_op; in php_output_handler_op()
962 context->op |= PHP_OUTPUT_HANDLER_START; in php_output_handler_op()
972 ZVAL_LONG(ob_mode, (long) context->op); in php_output_handler_op()
982 context->out.data = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); in php_output_handler_op()
983 context->out.used = Z_STRLEN_P(retval); in php_output_handler_op()
984 context->out.free = 1; in php_output_handler_op()
1002 …php_output_context_feed(context, handler->buffer.data, handler->buffer.size, handler->buffer.used,… in php_output_handler_op()
1004 if (SUCCESS == handler->func.internal(&handler->opaq, context)) { in php_output_handler_op()
1005 if (context->out.used) { in php_output_handler_op()
1023 if (context->out.data && context->out.free) { in php_output_handler_op()
1024 efree(context->out.data); in php_output_handler_op()
1027 context->out.data = handler->buffer.data; in php_output_handler_op()
1028 context->out.used = handler->buffer.used; in php_output_handler_op()
1029 context->out.free = 1; in php_output_handler_op()
1036 php_output_context_reset(context); in php_output_handler_op()
1045 context->op = original_op; in php_output_handler_op()
1055 php_output_context context; in php_output_op() local
1063 php_output_context_init(&context, op TSRMLS_CC); in php_output_op()
1071 context.in.data = (char *) str; in php_output_op()
1072 context.in.used = len; in php_output_op()
1075 …_apply_with_argument(&OG(handlers), ZEND_STACK_APPLY_TOPDOWN, php_output_stack_apply_op, &context); in php_output_op()
1077 php_output_handler_op(*active, &context); in php_output_op()
1079 php_output_context_pass(&context); in php_output_op()
1082 context.out.data = (char *) str; in php_output_op()
1083 context.out.used = len; in php_output_op()
1086 if (context.out.data && context.out.used) { in php_output_op()
1091 fprintf(stderr, "::: sapi_write('%s', %zu)\n", context.out.data, context.out.used); in php_output_op()
1093 sapi_module.ub_write(context.out.data, context.out.used TSRMLS_CC); in php_output_op()
1102 php_output_context_dtor(&context); in php_output_op()
1113 php_output_context *context = (php_output_context *) c; in php_output_stack_apply_op() local
1118 status = php_output_handler_op(handler, context); in php_output_stack_apply_op()
1132 php_output_context_swap(context); in php_output_stack_apply_op()
1141 php_output_context_pass(context); in php_output_stack_apply_op()
1146 php_output_context_swap(context); in php_output_stack_apply_op()
1159 php_output_context *context = (php_output_context *) c; in php_output_stack_apply_clean() local
1162 php_output_handler_op(handler, context); in php_output_stack_apply_clean()
1163 php_output_context_reset(context); in php_output_stack_apply_clean()
1217 php_output_context context; in php_output_stack_pop() local
1231 php_output_context_init(&context, PHP_OUTPUT_HANDLER_FINAL TSRMLS_CC); in php_output_stack_pop()
1237 context.op |= PHP_OUTPUT_HANDLER_START; in php_output_stack_pop()
1241 context.op |= PHP_OUTPUT_HANDLER_CLEAN; in php_output_stack_pop()
1243 php_output_handler_op(orphan, &context); in php_output_stack_pop()
1255 if (context.out.data && context.out.used && !(flags & PHP_OUTPUT_POP_DISCARD)) { in php_output_stack_pop()
1256 php_output_write(context.out.data, context.out.used TSRMLS_CC); in php_output_stack_pop()
1261 php_output_context_dtor(&context); in php_output_stack_pop()