Lines Matching refs:ctx

53 	url_adapt_state_ex_t *ctx;
58 ctx = &BG(url_adapt_state_ex);
62 if (ctx->tags)
63 zend_hash_destroy(ctx->tags);
65 ctx->tags = malloc(sizeof(HashTable));
66 if (!ctx->tags) {
71 zend_hash_init(ctx->tags, 0, NULL, tag_dtor, 1);
89 zend_hash_str_add_mem(ctx->tags, key, keylen, val, strlen(val)+1);
188 static inline void tag_arg(url_adapt_state_ex_t *ctx, char quotes, char type)
192 if (strncasecmp(ZSTR_VAL(ctx->arg.s), ctx->lookup_data, ZSTR_LEN(ctx->arg.s)) == 0)
196 smart_str_appendc(&ctx->result, type);
198 append_modified_url(&ctx->val, &ctx->result, &ctx->url_app, PG(arg_separator).output);
200 smart_str_append_smart_str(&ctx->result, &ctx->val);
203 smart_str_appendc(&ctx->result, type);
220 #define STATE ctx->state
222 #define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR
223 #define STD_ARGS ctx, start, xp
234 smart_str_appendl(&ctx->result, start, YYCURSOR - start);
246 if (ZSTR_LEN(ctx->form_app.s) > 0) {
247 switch (ZSTR_LEN(ctx->tag.s)) {
249 if (!strncasecmp(ZSTR_VAL(ctx->tag.s), "form", sizeof("form") - 1)) {
252 if (doit && ctx->val.s && ctx->lookup_data && *ctx->lookup_data) {
253 …*e, *p = (char *)zend_memnstr(ZSTR_VAL(ctx->val.s), "://", sizeof("://") - 1, ZSTR_VAL(ctx->val.s)…
255 e = memchr(p, '/', (ZSTR_VAL(ctx->val.s) + ZSTR_LEN(ctx->val.s)) - p);
257 e = ZSTR_VAL(ctx->val.s) + ZSTR_LEN(ctx->val.s);
259 if ((e - p) && strncasecmp(p, ctx->lookup_data, (e - p))) {
267 if (!strncasecmp(ZSTR_VAL(ctx->tag.s), "fieldset", sizeof("fieldset") - 1)) {
274 smart_str_append_smart_str(&ctx->result, &ctx->form_app);
290 if (ctx->tag.s) {
291 ZSTR_LEN(ctx->tag.s) = 0;
293 smart_str_appendl(&ctx->tag, start, YYCURSOR - start);
294 for (i = 0; i < ZSTR_LEN(ctx->tag.s); i++)
295 ZSTR_VAL(ctx->tag.s)[i] = tolower((int)(unsigned char)ZSTR_VAL(ctx->tag.s)[i]);
297 …if ((ctx->lookup_data = zend_hash_str_find_ptr(ctx->tags, ZSTR_VAL(ctx->tag.s), ZSTR_LEN(ctx->tag.…
304 if (ctx->arg.s) {
305 ZSTR_LEN(ctx->arg.s) = 0;
307 smart_str_appendl(&ctx->arg, start, YYCURSOR - start);
312 smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2);
313 tag_arg(ctx, quotes, type);
316 static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, size_t newlen)
323 smart_str_appendl(&ctx->buf, newdata, newlen);
325 YYCURSOR = ZSTR_VAL(ctx->buf.s);
326 YYLIMIT = ZSTR_VAL(ctx->buf.s) + ZSTR_LEN(ctx->buf.s);
397 …scdebug(("stopped in state %d at pos %d (%d:%c) %d\n", STATE, YYCURSOR - ctx->buf.c, *YYCURSOR, *Y…
400 if (rest) memmove(ZSTR_VAL(ctx->buf.s), start, rest);
401 ZSTR_LEN(ctx->buf.s) = rest;
446 url_adapt_state_ex_t *ctx;
449 ctx = &BG(url_adapt_state_ex);
451 xx_mainloop(ctx, src, srclen);
453 if (!ctx->result.s) {
454 smart_str_appendl(&ctx->result, "", 0);
457 *newlen = ZSTR_LEN(ctx->result.s);
459 smart_str_0(&ctx->result);
461 smart_str_append(&ctx->result, ctx->buf.s);
462 *newlen += ZSTR_LEN(ctx->buf.s);
463 smart_str_free(&ctx->buf);
464 smart_str_free(&ctx->val);
466 retval = estrndup(ZSTR_VAL(ctx->result.s), ZSTR_LEN(ctx->result.s));
467 smart_str_free(&ctx->result);
473 url_adapt_state_ex_t *ctx;
475 ctx = &BG(url_adapt_state_ex);
477 memset(ctx, 0, ((size_t) &((url_adapt_state_ex_t *)0)->tags));
484 url_adapt_state_ex_t *ctx;
486 ctx = &BG(url_adapt_state_ex);
488 smart_str_free(&ctx->result);
489 smart_str_free(&ctx->buf);
490 smart_str_free(&ctx->tag);
491 smart_str_free(&ctx->arg);
508 url_adapt_state_ex_t *ctx = &BG(url_adapt_state_ex);
509 if (ctx->buf.s && ZSTR_LEN(ctx->buf.s)) {
510 smart_str_append(&ctx->result, ctx->buf.s);
511 smart_str_appendl(&ctx->result, output, output_len);
513 *handled_output = estrndup(ZSTR_VAL(ctx->result.s), ZSTR_LEN(ctx->result.s));
514 *handled_output_len = ZSTR_LEN(ctx->buf.s) + output_len;
516 smart_str_free(&ctx->buf);
517 smart_str_free(&ctx->result);