Lines Matching refs:ctx

55 	url_adapt_state_ex_t *ctx;  in PHP_INI_MH()  local
60 ctx = &BG(url_adapt_state_ex); in PHP_INI_MH()
64 if (ctx->tags) in PHP_INI_MH()
65 zend_hash_destroy(ctx->tags); in PHP_INI_MH()
67 ctx->tags = malloc(sizeof(HashTable)); in PHP_INI_MH()
68 if (!ctx->tags) { in PHP_INI_MH()
73 zend_hash_init(ctx->tags, 0, NULL, tag_dtor, 1); in PHP_INI_MH()
91 zend_hash_str_add_mem(ctx->tags, key, keylen, val, strlen(val)+1); in PHP_INI_MH()
253 static inline void tag_arg(url_adapt_state_ex_t *ctx, char quotes, char type) in tag_arg() argument
257 if (strncasecmp(ZSTR_VAL(ctx->arg.s), ctx->lookup_data, ZSTR_LEN(ctx->arg.s)) == 0) in tag_arg()
261 smart_str_appendc(&ctx->result, type); in tag_arg()
263 append_modified_url(&ctx->val, &ctx->result, &ctx->url_app, PG(arg_separator).output); in tag_arg()
265 smart_str_append_smart_str(&ctx->result, &ctx->val); in tag_arg()
268 smart_str_appendc(&ctx->result, type); in tag_arg()
285 #define STATE ctx->state
287 #define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR
288 #define STD_ARGS ctx, start, xp
299 smart_str_appendl(&ctx->result, start, YYCURSOR - start); in passthru()
311 if (ZSTR_LEN(ctx->form_app.s) > 0) { in handle_form()
312 switch (ZSTR_LEN(ctx->tag.s)) { in handle_form()
314 if (!strncasecmp(ZSTR_VAL(ctx->tag.s), "form", sizeof("form") - 1)) { in handle_form()
317 if (doit && ctx->val.s && ctx->lookup_data && *ctx->lookup_data) { in handle_form()
318 …*e, *p = (char *)zend_memnstr(ZSTR_VAL(ctx->val.s), "://", sizeof("://") - 1, ZSTR_VAL(ctx->val.s)… in handle_form()
320 e = memchr(p, '/', (ZSTR_VAL(ctx->val.s) + ZSTR_LEN(ctx->val.s)) - p); in handle_form()
322 e = ZSTR_VAL(ctx->val.s) + ZSTR_LEN(ctx->val.s); in handle_form()
324 if ((e - p) && strncasecmp(p, ctx->lookup_data, (e - p))) { in handle_form()
332 if (!strncasecmp(ZSTR_VAL(ctx->tag.s), "fieldset", sizeof("fieldset") - 1)) { in handle_form()
339 smart_str_append_smart_str(&ctx->result, &ctx->form_app); in handle_form()
355 if (ctx->tag.s) { in handle_tag()
356 ZSTR_LEN(ctx->tag.s) = 0; in handle_tag()
358 smart_str_appendl(&ctx->tag, start, YYCURSOR - start); in handle_tag()
359 for (i = 0; i < ZSTR_LEN(ctx->tag.s); i++) in handle_tag()
360 ZSTR_VAL(ctx->tag.s)[i] = tolower((int)(unsigned char)ZSTR_VAL(ctx->tag.s)[i]); in handle_tag() local
362 …if ((ctx->lookup_data = zend_hash_str_find_ptr(ctx->tags, ZSTR_VAL(ctx->tag.s), ZSTR_LEN(ctx->tag.… in handle_tag()
369 if (ctx->arg.s) { in handle_arg()
370 ZSTR_LEN(ctx->arg.s) = 0; in handle_arg()
372 smart_str_appendl(&ctx->arg, start, YYCURSOR - start); in handle_arg()
377 smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2); in handle_val()
378 tag_arg(ctx, quotes, type); in handle_val()
381 static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, size_t newlen) in xx_mainloop() argument
388 smart_str_appendl(&ctx->buf, newdata, newlen); in xx_mainloop()
390 YYCURSOR = ZSTR_VAL(ctx->buf.s); in xx_mainloop()
391 YYLIMIT = ZSTR_VAL(ctx->buf.s) + ZSTR_LEN(ctx->buf.s); in xx_mainloop()
880 …scdebug(("stopped in state %d at pos %d (%d:%c) %d\n", STATE, YYCURSOR - ctx->buf.c, *YYCURSOR, *Y… in xx_mainloop()
883 if (rest) memmove(ZSTR_VAL(ctx->buf.s), start, rest); in xx_mainloop()
884 ZSTR_LEN(ctx->buf.s) = rest; in xx_mainloop()
929 url_adapt_state_ex_t *ctx; in url_adapt_ext() local
932 ctx = &BG(url_adapt_state_ex); in url_adapt_ext()
934 xx_mainloop(ctx, src, srclen); in url_adapt_ext()
936 if (!ctx->result.s) { in url_adapt_ext()
937 smart_str_appendl(&ctx->result, "", 0); in url_adapt_ext()
940 *newlen = ZSTR_LEN(ctx->result.s); in url_adapt_ext()
942 smart_str_0(&ctx->result); in url_adapt_ext()
944 smart_str_append(&ctx->result, ctx->buf.s); in url_adapt_ext()
945 *newlen += ZSTR_LEN(ctx->buf.s); in url_adapt_ext()
946 smart_str_free(&ctx->buf); in url_adapt_ext()
947 smart_str_free(&ctx->val); in url_adapt_ext()
949 retval = estrndup(ZSTR_VAL(ctx->result.s), ZSTR_LEN(ctx->result.s)); in url_adapt_ext()
950 smart_str_free(&ctx->result); in url_adapt_ext()
956 url_adapt_state_ex_t *ctx; in php_url_scanner_ex_activate() local
958 ctx = &BG(url_adapt_state_ex); in php_url_scanner_ex_activate()
960 memset(ctx, 0, ((size_t) &((url_adapt_state_ex_t *)0)->tags)); in php_url_scanner_ex_activate()
967 url_adapt_state_ex_t *ctx; in php_url_scanner_ex_deactivate() local
969 ctx = &BG(url_adapt_state_ex); in php_url_scanner_ex_deactivate()
971 smart_str_free(&ctx->result); in php_url_scanner_ex_deactivate()
972 smart_str_free(&ctx->buf); in php_url_scanner_ex_deactivate()
973 smart_str_free(&ctx->tag); in php_url_scanner_ex_deactivate()
974 smart_str_free(&ctx->arg); in php_url_scanner_ex_deactivate()
991 url_adapt_state_ex_t *ctx = &BG(url_adapt_state_ex); in php_url_scanner_output_handler() local
992 if (ctx->buf.s && ZSTR_LEN(ctx->buf.s)) { in php_url_scanner_output_handler()
993 smart_str_append(&ctx->result, ctx->buf.s); in php_url_scanner_output_handler()
994 smart_str_appendl(&ctx->result, output, output_len); in php_url_scanner_output_handler()
996 *handled_output = estrndup(ZSTR_VAL(ctx->result.s), ZSTR_LEN(ctx->result.s)); in php_url_scanner_output_handler()
997 *handled_output_len = ZSTR_LEN(ctx->buf.s) + output_len; in php_url_scanner_output_handler()
999 smart_str_free(&ctx->buf); in php_url_scanner_output_handler()
1000 smart_str_free(&ctx->result); in php_url_scanner_output_handler()