diff options
author | Mattias Andrée <m@maandree.se> | 2025-03-05 20:36:07 +0100 |
---|---|---|
committer | Mattias Andrée <m@maandree.se> | 2025-03-05 20:36:07 +0100 |
commit | 61821405d8f48117b82ce839c7196eb68c2d8266 (patch) | |
tree | 8255c88a57d6ec4771284809763349f61267356f /src/location-manual.c | |
parent | Just use double, no mixing in float (diff) | |
download | redshift-ng-61821405d8f48117b82ce839c7196eb68c2d8266.tar.gz redshift-ng-61821405d8f48117b82ce839c7196eb68c2d8266.tar.bz2 redshift-ng-61821405d8f48117b82ce839c7196eb68c2d8266.tar.xz |
Style and warnings
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'src/location-manual.c')
-rw-r--r-- | src/location-manual.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/location-manual.c b/src/location-manual.c index b07ca4f..1a9b044 100644 --- a/src/location-manual.c +++ b/src/location-manual.c @@ -28,12 +28,11 @@ struct location_state { static int location_manual_init(struct location_state **state) { - *state = malloc(sizeof(struct location_state)); + *state = malloc(sizeof(**state)); if (*state == NULL) return -1; - struct location_state *s = *state; - s->loc.lat = NAN; - s->loc.lon = NAN; + (*state)->loc.lat = NAN; + (*state)->loc.lon = NAN; return 0; } @@ -78,8 +77,10 @@ location_manual_set_option(struct location_state *state, const char *key, { /* Parse float value */ char *end; + double v; + errno = 0; - double v = strtod(value, &end); + v = strtod(value, &end); if (errno != 0 || *end != '\0') { fputs(_("Malformed argument.\n"), stderr); return -1; |