config: fix uninitialized variables and accept trailing for geom

This commit is contained in:
Tony Crisci 2017-08-26 11:53:16 -04:00
parent 0a97b68278
commit dc7e32552d

View file

@ -32,7 +32,11 @@ static struct wlr_geometry *parse_geometry(const char *str) {
char *buf = strdup(str); char *buf = strdup(str);
struct wlr_geometry *geo = calloc(1, sizeof(struct wlr_geometry)); struct wlr_geometry *geo = calloc(1, sizeof(struct wlr_geometry));
bool has_width, has_height, has_x, has_y; bool has_width = false;
bool has_height = false;
bool has_x = false;
bool has_y = false;
char *pch = strtok(buf, "x+"); char *pch = strtok(buf, "x+");
while (pch != NULL) { while (pch != NULL) {
errno = 0; errno = 0;
@ -61,7 +65,7 @@ static struct wlr_geometry *parse_geometry(const char *str) {
geo->y = val; geo->y = val;
has_y = true; has_y = true;
} else { } else {
goto invalid_input; break;
} }
pch = strtok(NULL, "x+"); pch = strtok(NULL, "x+");
} }