static char *gpps_raw(void *handle, const char *name, const char *def) { char *ret = read_setting_s(handle, name); if (!ret) ret = platform_default_s(name); if (!ret) ret = def ? dupstr(def) : NULL; /* permit NULL as final fallback */ return ret; }
static void gpps(void *handle, const char *name, const char *def, char *val, int len) { if (!read_setting_s(handle, name, val, len)) { char *pdef; pdef = platform_default_s(name); if (pdef) { strncpy(val, pdef, len); sfree(pdef); } else { strncpy(val, def, len); } val[len - 1] = '\0'; } }