Lines Matching refs:ctx

108 	struct hesiod_p	*ctx;
114 ctx = calloc(1, sizeof(struct hesiod_p));
115 if (ctx) {
116 *context = ctx;
129 if (read_config_file(ctx, configname) >= 0) {
141 if (ctx->rhs)
142 free(ctx->rhs);
143 ctx->rhs = malloc(strlen(p) + 2);
144 if (ctx->rhs) {
145 *ctx->rhs = '.';
146 strcpy(ctx->rhs + 1,
158 if (ctx) {
159 if (ctx->lhs)
160 free(ctx->lhs);
161 if (ctx->rhs)
162 free(ctx->rhs);
163 free(ctx);
176 struct hesiod_p *ctx = (struct hesiod_p *) context;
180 free(ctx->rhs);
181 if (ctx->lhs)
182 free(ctx->lhs);
183 free(ctx);
194 struct hesiod_p *ctx = (struct hesiod_p *) context;
227 rhs = ctx->rhs;
231 if (ctx->lhs)
232 len += strlen(ctx->lhs) + ((ctx->lhs[0] != '.') ? 1 : 0);
244 if (ctx->lhs && ctx->lhs[0] != '\0' ) {
245 if (ctx->lhs[0] != '.')
247 strlcat(bindname, ctx->lhs, sizeof(bindname));
272 struct hesiod_p *ctx = (struct hesiod_p *) context;
283 retvec = get_txt_records(ctx->classes[0], bindname);
284 if (retvec == NULL && errno == ENOENT && ctx->classes[1])
285 retvec = get_txt_records(ctx->classes[1], bindname);
309 * -1 on failure. On failure, it might leave values in ctx->lhs
310 * or ctx->rhs which need to be freed by the caller.
313 read_config_file(struct hesiod_p *ctx, const char *filename)
319 assert(ctx != NULL);
323 ctx->classes[0] = C_IN;
324 ctx->classes[1] = C_HS;
330 ctx->lhs = strdup(DEF_LHS);
331 ctx->rhs = strdup(DEF_RHS);
332 if (ctx->lhs && ctx->rhs)
339 ctx->lhs = NULL;
340 ctx->rhs = NULL;
370 ? &ctx->lhs : &ctx->rhs;
388 ctx->classes[n++] = C_IN;
391 ctx->classes[n++] =
396 ctx->classes[n++] = 0;
402 if (!ctx->rhs || ctx->classes[0] == 0 ||
403 ctx->classes[0] == ctx->classes[1]) {