Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/screen.c @ 2136:54548cf8f646
screen.c: Remove one memory allocation in scr_draw_roster()
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sun, 06 Jul 2014 11:06:31 +0200 |
parents | f56c214a19dc |
children | 2f294c2b6778 |
comparison
equal
deleted
inserted
replaced
2135:361603828d9e | 2136:54548cf8f646 |
---|---|
1 /* | 1 /* |
2 * screen.c -- UI stuff | 2 * screen.c -- UI stuff |
3 * | 3 * |
4 * Copyright (C) 2005-2010 Mikael Berthe <mikael@lilotux.net> | 4 * Copyright (C) 2005-2014 Mikael Berthe <mikael@lilotux.net> |
5 * Parts of this file come from the Cabber project <cabber@ajmacias.com> | 5 * Parts of this file come from the Cabber project <cabber@ajmacias.com> |
6 * | 6 * |
7 * This program is free software; you can redistribute it and/or modify | 7 * This program is free software; you can redistribute it and/or modify |
8 * it under the terms of the GNU General Public License as published by | 8 * it under the terms of the GNU General Public License as published by |
9 * the Free Software Foundation; either version 2 of the License, or (at | 9 * the Free Software Foundation; either version 2 of the License, or (at |
2039 int rOffset; | 2039 int rOffset; |
2040 int cursor_backup; | 2040 int cursor_backup; |
2041 guint status, pending; | 2041 guint status, pending; |
2042 enum imstatus currentstatus = xmpp_getstatus(); | 2042 enum imstatus currentstatus = xmpp_getstatus(); |
2043 int x_pos; | 2043 int x_pos; |
2044 char *space; | |
2045 int prefix_length; | 2044 int prefix_length; |
2045 char space[2] = " "; | |
2046 | 2046 |
2047 // We can reset update_roster | 2047 // We can reset update_roster |
2048 update_roster = FALSE; | 2048 update_roster = FALSE; |
2049 | 2049 |
2050 getmaxyx(rosterWnd, maxy, maxx); | 2050 getmaxyx(rosterWnd, maxy, maxx); |
2097 if (roster_win_on_right) | 2097 if (roster_win_on_right) |
2098 x_pos = 1; // 1 char offset (vertical line) | 2098 x_pos = 1; // 1 char offset (vertical line) |
2099 else | 2099 else |
2100 x_pos = 0; | 2100 x_pos = 0; |
2101 | 2101 |
2102 space = g_new0(char, 2); | |
2103 if (roster_no_leading_space) { | 2102 if (roster_no_leading_space) { |
2104 space[0] = '\0'; | 2103 space[0] = '\0'; |
2105 prefix_length = 6; | 2104 prefix_length = 6; |
2106 } else { | 2105 } else { |
2107 space[0] = ' '; | |
2108 prefix_length = 7; | 2106 prefix_length = 7; |
2109 } | 2107 } |
2110 | 2108 |
2111 name = g_new0(char, 4*Roster_Width); | 2109 name = g_new0(char, 4*Roster_Width); |
2112 rline = g_new0(char, 4*Roster_Width+1); | 2110 rline = g_new0(char, 4*Roster_Width+1); |
2245 mvwprintw(rosterWnd, i, x_pos, "%s", rline_locale); | 2243 mvwprintw(rosterWnd, i, x_pos, "%s", rline_locale); |
2246 g_free(rline_locale); | 2244 g_free(rline_locale); |
2247 i++; | 2245 i++; |
2248 } | 2246 } |
2249 | 2247 |
2250 g_free(space); | |
2251 g_free(rline); | 2248 g_free(rline); |
2252 g_free(name); | 2249 g_free(name); |
2253 top_panel(inputPanel); | 2250 top_panel(inputPanel); |
2254 update_panels(); | 2251 update_panels(); |
2255 curs_set(cursor_backup); | 2252 curs_set(cursor_backup); |