Fix draw_align_fromstr calls.
Note that it's undefined to have side effects on an argument and pass this argument again to another function. Signed-off-by: Pierre Habouzit <madcoder@debian.org>
This commit is contained in:
parent
7b3983bfa0
commit
b19aace542
|
@ -210,7 +210,6 @@ static void
|
|||
draw_markup_on_element(markup_parser_data_t *p, const char *elem,
|
||||
const char **names, const char **values)
|
||||
{
|
||||
size_t len;
|
||||
draw_parser_data_t *data = p->priv;
|
||||
|
||||
/* hack: markup.c validates tags so we can avoid strcmps here */
|
||||
|
@ -236,10 +235,10 @@ draw_markup_on_element(markup_parser_data_t *p, const char *elem,
|
|||
break;
|
||||
case 't': /* text */
|
||||
for(; *names; names++, values++)
|
||||
switch(a_tokenize(*names, (len = a_strlen(*names))))
|
||||
switch(a_tokenize(*names, -1))
|
||||
{
|
||||
case A_TK_ALIGN:
|
||||
data->align = draw_align_fromstr(*values, len);
|
||||
data->align = draw_align_fromstr(*values, -1);
|
||||
break;
|
||||
case A_TK_SHADOW:
|
||||
xcolor_new(data->connection, data->phys_screen, *values,
|
||||
|
|
|
@ -517,7 +517,8 @@ luaA_statusbar_new(lua_State *L)
|
|||
else
|
||||
sb->colors.bg = globalconf.colors.bg;
|
||||
|
||||
sb->align = draw_align_fromstr(luaA_getopt_string(L, 1, "align", "left", &len), len);
|
||||
buf = luaA_getopt_string(L, 1, "align", "left", &len);
|
||||
sb->align = draw_align_fromstr(buf, len);
|
||||
|
||||
sb->width = luaA_getopt_number(L, 1, "width", 0);
|
||||
if(sb->width > 0)
|
||||
|
|
|
@ -304,7 +304,8 @@ luaA_titlebar_new(lua_State *L)
|
|||
|
||||
tb = p_new(titlebar_t, 1);
|
||||
|
||||
tb->align = draw_align_fromstr(luaA_getopt_string(L, 1, "align", "left", &len), len);
|
||||
buf = luaA_getopt_string(L, 1, "align", "left", &len);
|
||||
tb->align = draw_align_fromstr(buf, len);
|
||||
|
||||
tb->width = luaA_getopt_number(L, 1, "width", 0);
|
||||
tb->height = luaA_getopt_number(L, 1, "height", 0);
|
||||
|
|
5
widget.c
5
widget.c
|
@ -306,14 +306,15 @@ widget_invalidate_bywidget(widget_t *widget)
|
|||
static int
|
||||
luaA_widget_new(lua_State *L)
|
||||
{
|
||||
const char *type;
|
||||
const char *type, *buf;
|
||||
widget_t *w = NULL;
|
||||
widget_constructor_t *wc;
|
||||
alignment_t align;
|
||||
size_t len;
|
||||
|
||||
luaA_checktable(L, 1);
|
||||
align = draw_align_fromstr(luaA_getopt_string(L, 1, "align", "left", &len), len);
|
||||
buf = luaA_getopt_string(L, 1, "align", "left", &len);
|
||||
align = draw_align_fromstr(buf, len);
|
||||
|
||||
type = luaA_getopt_string(L, 1, "type", NULL, NULL);
|
||||
|
||||
|
|
Loading…
Reference in New Issue