| 194 | } |
| 195 | |
| 196 | int readConfigBuffer(void *buffer, int size, ConfigEntry *entries, int n_entries) { |
| 197 | int res = 0; |
| 198 | char line[MAX_CONFIG_LINE_LENGTH]; |
| 199 | char *p = buffer; |
| 200 | |
| 201 | // Skip UTF-8 bom |
| 202 | uint32_t bom = 0xBFBBEF; |
| 203 | if (memcmp(p, &bom, 3) == 0) { |
| 204 | p += 3; |
| 205 | size -= 3; |
| 206 | } |
| 207 | |
| 208 | do { |
| 209 | memset(line, 0, sizeof(line)); |
| 210 | res = GetLine(p, size, line); |
| 211 | |
| 212 | if (res > 0) { |
| 213 | readEntry(line, entries, n_entries); |
| 214 | size -= res; |
| 215 | p += res; |
| 216 | } |
| 217 | } while (res > 0); |
| 218 | |
| 219 | return 0; |
| 220 | } |
| 221 | |
| 222 | int readConfig(const char *path, ConfigEntry *entries, int n_entries) { |
| 223 | void *buffer = NULL; |
no test coverage detected