MCPcopy Create free account
hub / github.com/FedeDP/Clight / load_cache_location

Function load_cache_location

src/modules/location.c:140–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140static void load_cache_location(void) {
141 FILE *f = fopen(cache_file, "r");
142 if (f) {
143 double new_lat, new_lon;
144 if (fscanf(f, "%lf %lf\n", &new_lat, &new_lon) == 2) {
145 publish_location(new_lat, new_lon, &loc_req);
146 DEBUG("%.2lf %.2lf loaded from cache file.\n", new_lat, new_lon);
147 } else {
148 WARN("Could not load cached location, wrong format.\n");
149 }
150 fclose(f);
151 } else {
152 DEBUG("Could not find location cache file.\n");
153 }
154}
155
156static void init_cache_file(void) {
157 if (getenv("XDG_CACHE_HOME")) {

Callers 1

receiveFunction · 0.85

Calls 1

publish_locationFunction · 0.85

Tested by

no test coverage detected