/* * Copyright (c) 2026, Apollo Telephone Laboratories. * Provided under the BSD-3 clause. */ #include #include "defconf/state.h" int defconf_state_init(const char *in_path, struct defconf_state *state) { if (in_path == NULL || state == NULL) { return -1; } state->in_fp = fopen(in_path, "r"); if (state->in_fp == NULL) { perror("fopen"); return -1; } state->lex_cache = '\0'; return 0; } void defconf_state_destroy(struct defconf_state *state) { if (state == NULL) { return; } fclose(state->in_fp); state->in_fp = NULL; }