Initialize the destination location early

Fixes #1196.
Closes #1197.
This commit is contained in:
Bastien Dejean 2020-09-08 10:58:12 +02:00
parent 760b148a5f
commit 8e6f769d6f

View file

@ -527,6 +527,8 @@ monitor_select_t make_monitor_select(void)
int node_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
{
dst->node = NULL;
coordinates_t ref_copy = *ref;
ref = &ref_copy;
char *desc_copy = copy_string(desc, strlen(desc));
@ -565,8 +567,6 @@ int node_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
return SELECTOR_BAD_MODIFIERS;
}
dst->node = NULL;
direction_t dir;
cycle_dir_t cyc;
history_dir_t hdi;
@ -676,6 +676,8 @@ int node_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
int desktop_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
{
dst->desktop = NULL;
if (*desc == '%') {
locate_desktop(desc + 1, dst);
goto end;
@ -708,8 +710,6 @@ int desktop_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
return SELECTOR_BAD_MODIFIERS;
}
dst->desktop = NULL;
cycle_dir_t cyc;
history_dir_t hdi;
uint16_t idx;
@ -794,6 +794,8 @@ end:
int monitor_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
{
dst->monitor = NULL;
if (*desc == '%') {
locate_monitor(desc + 1, dst);
goto end;
@ -825,8 +827,6 @@ int monitor_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
return SELECTOR_BAD_MODIFIERS;
}
dst->monitor = NULL;
direction_t dir;
cycle_dir_t cyc;
history_dir_t hdi;