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()
66 zend_hash_init(ctx->tags, 0, NULL, NULL, 1); in PHP_INI_MH()
84 zend_hash_add(ctx->tags, key, keylen, val, strlen(val)+1, NULL); in PHP_INI_MH()
215 static inline void tag_arg(url_adapt_state_ex_t *ctx, char quotes, char type TSRMLS_DC) in tag_arg() argument
219 if (strncasecmp(ctx->arg.c, ctx->lookup_data, ctx->arg.len) == 0) in tag_arg()
223 smart_str_appendc(&ctx->result, type); in tag_arg()
225 append_modified_url(&ctx->val, &ctx->result, &ctx->url_app, PG(arg_separator).output); in tag_arg()
227 smart_str_append(&ctx->result, &ctx->val); in tag_arg()
230 smart_str_appendc(&ctx->result, type); in tag_arg()
247 #define STATE ctx->state
249 #define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR TSRMLS_DC
250 #define STD_ARGS ctx, start, xp TSRMLS_CC
261 smart_str_appendl(&ctx->result, start, YYCURSOR - start); in passthru()
273 if (ctx->form_app.len > 0) { in handle_form()
274 switch (ctx->tag.len) { in handle_form()
276 if (!strncasecmp(ctx->tag.c, "form", sizeof("form") - 1)) { in handle_form()
279 if (doit && ctx->val.c && ctx->lookup_data && *ctx->lookup_data) { in handle_form()
280 char *e, *p = zend_memnstr(ctx->val.c, "://", sizeof("://") - 1, ctx->val.c + ctx->val.len); in handle_form()
282 e = memchr(p, '/', (ctx->val.c + ctx->val.len) - p); in handle_form()
284 e = ctx->val.c + ctx->val.len; in handle_form()
286 if ((e - p) && strncasecmp(p, ctx->lookup_data, (e - p))) { in handle_form()
294 if (!strncasecmp(ctx->tag.c, "fieldset", sizeof("fieldset") - 1)) { in handle_form()
301 smart_str_append(&ctx->result, &ctx->form_app); in handle_form()
317 ctx->tag.len = 0; in handle_tag()
318 smart_str_appendl(&ctx->tag, start, YYCURSOR - start); in handle_tag()
319 for (i = 0; i < ctx->tag.len; i++) in handle_tag()
320 ctx->tag.c[i] = tolower((int)(unsigned char)ctx->tag.c[i]); in handle_tag()
321 if (zend_hash_find(ctx->tags, ctx->tag.c, ctx->tag.len, (void **) &ctx->lookup_data) == SUCCESS) in handle_tag()
328 ctx->arg.len = 0; in handle_arg()
329 smart_str_appendl(&ctx->arg, start, YYCURSOR - start); in handle_arg()
334 smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2); in handle_val()
335 tag_arg(ctx, quotes, type TSRMLS_CC); in handle_val()
338 static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, size_t newlen TSRMLS… in xx_mainloop() argument
345 smart_str_appendl(&ctx->buf, newdata, newlen); in xx_mainloop()
347 YYCURSOR = ctx->buf.c; in xx_mainloop()
348 YYLIMIT = ctx->buf.c + ctx->buf.len; in xx_mainloop()
913 …scdebug(("stopped in state %d at pos %d (%d:%c) %d\n", STATE, YYCURSOR - ctx->buf.c, *YYCURSOR, *Y… in xx_mainloop()
917 if (rest) memmove(ctx->buf.c, start, rest); in xx_mainloop()
918 ctx->buf.len = rest; in xx_mainloop()
946 url_adapt_state_ex_t *ctx; in url_adapt_ext() local
949 ctx = &BG(url_adapt_state_ex); in url_adapt_ext()
951 xx_mainloop(ctx, src, srclen TSRMLS_CC); in url_adapt_ext()
953 *newlen = ctx->result.len; in url_adapt_ext()
954 if (!ctx->result.c) { in url_adapt_ext()
955 smart_str_appendl(&ctx->result, "", 0); in url_adapt_ext()
957 smart_str_0(&ctx->result); in url_adapt_ext()
959 smart_str_appendl(&ctx->result, ctx->buf.c, ctx->buf.len); in url_adapt_ext()
960 *newlen += ctx->buf.len; in url_adapt_ext()
961 smart_str_free(&ctx->buf); in url_adapt_ext()
963 retval = ctx->result.c; in url_adapt_ext()
964 ctx->result.c = NULL; in url_adapt_ext()
965 ctx->result.len = 0; in url_adapt_ext()
971 url_adapt_state_ex_t *ctx; in php_url_scanner_ex_activate() local
973 ctx = &BG(url_adapt_state_ex); in php_url_scanner_ex_activate()
975 memset(ctx, 0, ((size_t) &((url_adapt_state_ex_t *)0)->tags)); in php_url_scanner_ex_activate()
982 url_adapt_state_ex_t *ctx; in php_url_scanner_ex_deactivate() local
984 ctx = &BG(url_adapt_state_ex); in php_url_scanner_ex_deactivate()
986 smart_str_free(&ctx->result); in php_url_scanner_ex_deactivate()
987 smart_str_free(&ctx->buf); in php_url_scanner_ex_deactivate()
988 smart_str_free(&ctx->tag); in php_url_scanner_ex_deactivate()
989 smart_str_free(&ctx->arg); in php_url_scanner_ex_deactivate()
1006 url_adapt_state_ex_t *ctx = &BG(url_adapt_state_ex); in php_url_scanner_output_handler() local
1007 if (ctx->buf.len) { in php_url_scanner_output_handler()
1008 smart_str_appendl(&ctx->result, ctx->buf.c, ctx->buf.len); in php_url_scanner_output_handler()
1009 smart_str_appendl(&ctx->result, output, output_len); in php_url_scanner_output_handler()
1011 *handled_output = ctx->result.c; in php_url_scanner_output_handler()
1012 *handled_output_len = ctx->buf.len + output_len; in php_url_scanner_output_handler()
1014 ctx->result.c = NULL; in php_url_scanner_output_handler()
1015 ctx->result.len = 0; in php_url_scanner_output_handler()
1016 smart_str_free(&ctx->buf); in php_url_scanner_output_handler()