aboutsummaryrefslogtreecommitdiffstats
path: root/src/location-manual.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/location-manual.c')
-rw-r--r--src/location-manual.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/location-manual.c b/src/location-manual.c
index 368076b..f59bddd 100644
--- a/src/location-manual.c
+++ b/src/location-manual.c
@@ -28,12 +28,9 @@ struct location_state {
static int
location_manual_init(struct location_state **state)
{
- *state = malloc(sizeof(**state));
- if (*state == NULL) return -1;
-
+ *state = emalloc(sizeof(**state));
(*state)->loc.lat = NAN;
(*state)->loc.lon = NAN;
-
return 0;
}
@@ -45,7 +42,6 @@ location_manual_start(struct location_state *state)
fputs(_("Latitude and longitude must be set.\n"), stderr);
exit(EXIT_FAILURE);
}
-
return 0;
}
@@ -86,12 +82,12 @@ location_manual_set_option(struct location_state *state, const char *key,
return -1;
}
- if (strcasecmp(key, "lat") == 0) {
+ if (!strcasecmp(key, "lat")) {
state->loc.lat = v;
- } else if (strcasecmp(key, "lon") == 0) {
+ } else if (!strcasecmp(key, "lon")) {
state->loc.lon = v;
} else {
- fprintf(stderr, _("Unknown method parameter: `%s'.\n"), key);
+ weprintf(_("Unknown method parameter: `%s'.\n"), key);
return -1;
}
@@ -106,12 +102,10 @@ location_manual_get_fd(struct location_state *state)
}
static int
-location_manual_handle(
- struct location_state *state, struct location *location, int *available)
+location_manual_handle(struct location_state *state, struct location *location, int *available)
{
*location = state->loc;
*available = 1;
-
return 0;
}