Lines Matching defs:ctx

185 	idn_checker_t ctx = NULL;
193 ctx = (idn_checker_t) malloc(sizeof(struct idn_checker));
194 if (ctx == NULL) {
199 ctx->schemes = (check_scheme_t *) malloc(sizeof(check_scheme_t)
201 if (ctx->schemes == NULL) {
206 ctx->nschemes = 0;
207 ctx->scheme_size = MAPPER_INITIAL_SCHEME_SIZE;
208 ctx->reference_count = 1;
209 *ctxp = ctx;
213 if (ctx != NULL)
214 free(ctx->schemes);
215 free(ctx);
222 idn_checker_destroy(idn_checker_t ctx) {
226 assert(ctx != NULL);
230 ctx->reference_count--;
231 if (ctx->reference_count <= 0) {
233 for (i = 0; i < ctx->nschemes; i++)
234 ctx->schemes[i].destroy(ctx->schemes[i].context);
235 free(ctx->schemes);
236 free(ctx);
240 ctx->reference_count + 1, ctx->reference_count));
245 idn_checker_incrref(idn_checker_t ctx) {
246 assert(ctx != NULL && scheme_hash != NULL);
250 ctx->reference_count, ctx->reference_count + 1));
252 ctx->reference_count++;
256 idn_checker_add(idn_checker_t ctx, const char *scheme_name) {
265 assert(ctx != NULL);
308 assert(ctx->nschemes <= ctx->scheme_size);
310 if (ctx->nschemes == ctx->scheme_size) {
313 new_schemes = (check_scheme_t *) realloc(ctx->schemes,
314 sizeof(check_scheme_t) * ctx->scheme_size * 2);
319 ctx->schemes = new_schemes;
320 ctx->scheme_size *= 2;
327 memcpy(ctx->schemes + ctx->nschemes, scheme, sizeof(check_scheme_t));
328 ctx->schemes[ctx->nschemes].context = scheme_context;
329 ctx->nschemes++;
341 idn_checker_addall(idn_checker_t ctx, const char **scheme_names,
347 assert(ctx != NULL && scheme_names != NULL);
352 r = idn_checker_add(ctx, (const char *)*scheme_names);
365 idn_checker_lookup(idn_checker_t ctx, const unsigned long *ucs4,
371 assert(ctx != NULL && ucs4 != NULL && found != NULL);
381 for (i = 0; i < ctx->nschemes; i++) {
383 ctx->schemes[i].prefix));
385 r = (ctx->schemes[i].lookup)(ctx->schemes[i].context, ucs4,