remove alloca() dependency
This commit is contained in:
2
spot.c
2
spot.c
@@ -29,7 +29,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
void spot_update_bar(int spot, int mon)
|
void spot_update_bar(int spot, int mon)
|
||||||
{
|
{
|
||||||
int i, n = 0, len = 0; client *o, *c = NULL;
|
int i, n = 0, len = 0; client *o, *c = NULL;
|
||||||
char *title = alloca(SPOT_BUFF); *title = 0;
|
char title[SPOT_BUFF]; *title = 0;
|
||||||
monitor *m = &monitors[mon];
|
monitor *m = &monitors[mon];
|
||||||
|
|
||||||
for_windows(i, o) if (o->manage && o->spot == spot && o->monitor == mon)
|
for_windows(i, o) if (o->manage && o->spot == spot && o->monitor == mon)
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ void textbox_font(textbox *tb, char *font, char *fg, char *bg)
|
|||||||
void textbox_extents(textbox *tb)
|
void textbox_extents(textbox *tb)
|
||||||
{
|
{
|
||||||
int length = strlen(tb->text) + strlen(tb->prompt);
|
int length = strlen(tb->text) + strlen(tb->prompt);
|
||||||
char *line = alloca(length + 1);
|
char line[length + 1];
|
||||||
sprintf(line, "%s%s", tb->prompt, tb->text);
|
sprintf(line, "%s%s", tb->prompt, tb->text);
|
||||||
XftTextExtents8(display, tb->font, (unsigned char*)line, length, &tb->extents);
|
XftTextExtents8(display, tb->font, (unsigned char*)line, length, &tb->extents);
|
||||||
}
|
}
|
||||||
@@ -190,7 +190,7 @@ void textbox_draw(textbox *tb)
|
|||||||
length = text_len + prompt_len;
|
length = text_len + prompt_len;
|
||||||
cursor_offset = MIN(tb->cursor + prompt_len, length);
|
cursor_offset = MIN(tb->cursor + prompt_len, length);
|
||||||
|
|
||||||
line = alloca(length + 10);
|
char eline[length + 10]; line = eline;
|
||||||
sprintf(line, "%s%s", prompt, text);
|
sprintf(line, "%s%s", prompt, text);
|
||||||
|
|
||||||
// replace spaces so XftTextExtents8 includes their width
|
// replace spaces so XftTextExtents8 includes their width
|
||||||
|
|||||||
Reference in New Issue
Block a user