Lines Matching refs:ctx
49 url_adapt_state_ex_t *ctx; in PHP_INI_MH() local
54 ctx = &BG(url_adapt_state_ex); in PHP_INI_MH()
58 if (ctx->tags) in PHP_INI_MH()
59 zend_hash_destroy(ctx->tags); in PHP_INI_MH()
61 ctx->tags = malloc(sizeof(HashTable)); in PHP_INI_MH()
62 if (!ctx->tags) { in PHP_INI_MH()
67 zend_hash_init(ctx->tags, 0, NULL, NULL, 1); in PHP_INI_MH()
85 zend_hash_add(ctx->tags, key, keylen, val, strlen(val)+1, NULL); in PHP_INI_MH()
216 static inline void tag_arg(url_adapt_state_ex_t *ctx, char quotes, char type TSRMLS_DC) in tag_arg() argument
220 if (strncasecmp(ctx->arg.c, ctx->lookup_data, ctx->arg.len) == 0) in tag_arg()
224 smart_str_appendc(&ctx->result, type); in tag_arg()
226 append_modified_url(&ctx->val, &ctx->result, &ctx->url_app, PG(arg_separator).output); in tag_arg()
228 smart_str_append(&ctx->result, &ctx->val); in tag_arg()
231 smart_str_appendc(&ctx->result, type); in tag_arg()
248 #define STATE ctx->state
250 #define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR TSRMLS_DC
251 #define STD_ARGS ctx, start, xp TSRMLS_CC
262 smart_str_appendl(&ctx->result, start, YYCURSOR - start); in passthru()
274 if (ctx->form_app.len > 0) { in handle_form()
275 switch (ctx->tag.len) { in handle_form()
277 if (!strncasecmp(ctx->tag.c, "form", sizeof("form") - 1)) { in handle_form()
280 if (doit && ctx->val.c && ctx->lookup_data && *ctx->lookup_data) { in handle_form()
281 char *e, *p = zend_memnstr(ctx->val.c, "://", sizeof("://") - 1, ctx->val.c + ctx->val.len); in handle_form()
283 e = memchr(p, '/', (ctx->val.c + ctx->val.len) - p); in handle_form()
285 e = ctx->val.c + ctx->val.len; in handle_form()
287 if ((e - p) && strncasecmp(p, ctx->lookup_data, (e - p))) { in handle_form()
295 if (!strncasecmp(ctx->tag.c, "fieldset", sizeof("fieldset") - 1)) { in handle_form()
302 smart_str_append(&ctx->result, &ctx->form_app); in handle_form()
318 ctx->tag.len = 0; in handle_tag()
319 smart_str_appendl(&ctx->tag, start, YYCURSOR - start); in handle_tag()
320 for (i = 0; i < ctx->tag.len; i++) in handle_tag()
321 ctx->tag.c[i] = tolower((int)(unsigned char)ctx->tag.c[i]); in handle_tag()
322 if (zend_hash_find(ctx->tags, ctx->tag.c, ctx->tag.len, (void **) &ctx->lookup_data) == SUCCESS) in handle_tag()
329 ctx->arg.len = 0; in handle_arg()
330 smart_str_appendl(&ctx->arg, start, YYCURSOR - start); in handle_arg()
335 smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2); in handle_val()
336 tag_arg(ctx, quotes, type TSRMLS_CC); in handle_val()
339 static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, size_t newlen TSRMLS… in xx_mainloop() argument
346 smart_str_appendl(&ctx->buf, newdata, newlen); in xx_mainloop()
348 YYCURSOR = ctx->buf.c; in xx_mainloop()
349 YYLIMIT = ctx->buf.c + ctx->buf.len; in xx_mainloop()
900 …scdebug(("stopped in state %d at pos %d (%d:%c) %d\n", STATE, YYCURSOR - ctx->buf.c, *YYCURSOR, *Y… in xx_mainloop()
904 if (rest) memmove(ctx->buf.c, start, rest); in xx_mainloop()
905 ctx->buf.len = rest; in xx_mainloop()
933 url_adapt_state_ex_t *ctx; in url_adapt_ext() local
936 ctx = &BG(url_adapt_state_ex); in url_adapt_ext()
938 xx_mainloop(ctx, src, srclen TSRMLS_CC); in url_adapt_ext()
940 *newlen = ctx->result.len; in url_adapt_ext()
941 if (!ctx->result.c) { in url_adapt_ext()
942 smart_str_appendl(&ctx->result, "", 0); in url_adapt_ext()
944 smart_str_0(&ctx->result); in url_adapt_ext()
946 smart_str_appendl(&ctx->result, ctx->buf.c, ctx->buf.len); in url_adapt_ext()
947 *newlen += ctx->buf.len; in url_adapt_ext()
948 smart_str_free(&ctx->buf); in url_adapt_ext()
950 retval = ctx->result.c; in url_adapt_ext()
951 ctx->result.c = NULL; in url_adapt_ext()
952 ctx->result.len = 0; in url_adapt_ext()
958 url_adapt_state_ex_t *ctx; in php_url_scanner_ex_activate() local
960 ctx = &BG(url_adapt_state_ex); in php_url_scanner_ex_activate()
962 memset(ctx, 0, ((size_t) &((url_adapt_state_ex_t *)0)->tags)); in php_url_scanner_ex_activate()
969 url_adapt_state_ex_t *ctx; in php_url_scanner_ex_deactivate() local
971 ctx = &BG(url_adapt_state_ex); in php_url_scanner_ex_deactivate()
973 smart_str_free(&ctx->result); in php_url_scanner_ex_deactivate()
974 smart_str_free(&ctx->buf); in php_url_scanner_ex_deactivate()
975 smart_str_free(&ctx->tag); in php_url_scanner_ex_deactivate()
976 smart_str_free(&ctx->arg); in php_url_scanner_ex_deactivate()
993 url_adapt_state_ex_t *ctx = &BG(url_adapt_state_ex); in php_url_scanner_output_handler() local
994 if (ctx->buf.len) { in php_url_scanner_output_handler()
995 smart_str_appendl(&ctx->result, ctx->buf.c, ctx->buf.len); in php_url_scanner_output_handler()
996 smart_str_appendl(&ctx->result, output, output_len); in php_url_scanner_output_handler()
998 *handled_output = ctx->result.c; in php_url_scanner_output_handler()
999 *handled_output_len = ctx->buf.len + output_len; in php_url_scanner_output_handler()
1001 ctx->result.c = NULL; in php_url_scanner_output_handler()
1002 ctx->result.len = 0; in php_url_scanner_output_handler()
1003 smart_str_free(&ctx->buf); in php_url_scanner_output_handler()