Clear or copy whole selectionvar
This commit is contained in:
@@ -92,8 +92,7 @@ l_selection_push(lua_State *L)
|
|||||||
luaL_getmetatable(L, "selection");
|
luaL_getmetatable(L, "selection");
|
||||||
lua_setmetatable(L, -2);
|
lua_setmetatable(L, -2);
|
||||||
|
|
||||||
sel->wid = tmp->wid;
|
*sel = *tmp;
|
||||||
sel->hei = tmp->hei;
|
|
||||||
sel->map = dupstr(tmp->map);
|
sel->map = dupstr(tmp->map);
|
||||||
selection_free(tmp, TRUE);
|
selection_free(tmp, TRUE);
|
||||||
|
|
||||||
@@ -120,9 +119,8 @@ l_selection_clone(lua_State *L)
|
|||||||
tmp = l_selection_check(L, 2);
|
tmp = l_selection_check(L, 2);
|
||||||
if (tmp->map)
|
if (tmp->map)
|
||||||
free(tmp->map);
|
free(tmp->map);
|
||||||
|
*tmp = *sel;
|
||||||
tmp->map = dupstr(sel->map);
|
tmp->map = dupstr(sel->map);
|
||||||
tmp->wid = sel->wid;
|
|
||||||
tmp->hei = sel->hei;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4381,7 +4381,7 @@ selection_free(struct selectionvar* sel, boolean freesel)
|
|||||||
if (freesel)
|
if (freesel)
|
||||||
free((genericptr_t) sel);
|
free((genericptr_t) sel);
|
||||||
else
|
else
|
||||||
sel->wid = sel->hei = 0;
|
(void) memset((genericptr_t) sel, 0, sizeof *sel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4390,8 +4390,7 @@ selection_clone(struct selectionvar* sel)
|
|||||||
{
|
{
|
||||||
struct selectionvar *tmps = (struct selectionvar *) alloc(sizeof *tmps);
|
struct selectionvar *tmps = (struct selectionvar *) alloc(sizeof *tmps);
|
||||||
|
|
||||||
tmps->wid = sel->wid;
|
*tmps = *sel;
|
||||||
tmps->hei = sel->hei;
|
|
||||||
tmps->map = dupstr(sel->map);
|
tmps->map = dupstr(sel->map);
|
||||||
|
|
||||||
return tmps;
|
return tmps;
|
||||||
|
|||||||
Reference in New Issue
Block a user