MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / loadConfigDir

Function loadConfigDir

Trash/stringTable.c:422–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

420 */
421
422int
423loadConfigDir(
424 char *bundleName, // bundle directory name (e.g. "System.config")
425 INTN useDefault, // use Default.table instead of instance tables
426 char **table, // returns pointer to config table
427 INTN allocTable // malloc the table and return in *table
428)
429{
430 char *buf;
431 INTN i, ret;
432
433 buf = malloc(256);
434 ret = 0;
435
436 // load up to 99 instance tables
437 for (i=0; i < 99; i++) {
438 sprintf(buf, "%s%s.config/Instance%d.table", IO_CONFIG_DIR,
439 bundleName, i);
440 if (useDefault || (loadConfigFile(buf, table, allocTable) != 0)) {
441 if (i == 0) {
442 // couldn't load first instance table;
443 // try the default table
444 sprintf(buf, "%s%s.config/%s", IO_CONFIG_DIR, bundleName,
445 IO_DEFAULT_TABLE_FILENAME);
446 if (loadConfigFile(buf, table, allocTable) == 0) {
447 ret = 1;
448 } else {
449 if (!allocTable)
450 error("Config file \"%s\" not found\n", buf);
451 ret = -1;
452 }
453 }
454 // we must be done.
455 break;
456 }
457 }
458 free(buf);
459 return ret;
460}
461
462
463#define SYSTEM_DEFAULT_FILE \

Callers 2

loadSystemConfigFunction · 0.85
loadOtherConfigsFunction · 0.85

Calls 4

loadConfigFileFunction · 0.85
mallocFunction · 0.50
errorFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected