Consistently parse workspace numbers

Use ws_name_to_number() to parse workspace numbers where this
transformation takes place.
This commit is contained in:
Tony Crisci
2014-06-22 11:12:51 -04:00
committed by Michael Stapelberg
parent cd06da711c
commit c936232545
2 changed files with 9 additions and 31 deletions

View File

@ -177,15 +177,7 @@ Con *create_workspace_on_output(Output *output, Con *content) {
if (!exists) {
/* Set ->num to the number of the workspace, if the name actually
* is a number or starts with a number */
char *endptr = NULL;
long parsed_num = strtol(ws->name, &endptr, 10);
if (parsed_num == LONG_MIN ||
parsed_num == LONG_MAX ||
parsed_num < 0 ||
endptr == ws->name)
ws->num = -1;
else
ws->num = parsed_num;
ws->num = ws_name_to_number(ws->name);
LOG("Used number %d for workspace with name %s\n", ws->num, ws->name);
break;