1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-26 12:27:52 +00:00

Minor refactoring for template code.

This commit is contained in:
Brenden Matthews 2009-06-02 14:51:46 -06:00
parent 44ead331cd
commit 6994caa18b

View File

@ -344,7 +344,8 @@ static int sensor_device;
static long color0, color1, color2, color3, color4, color5, color6, color7, static long color0, color1, color2, color3, color4, color5, color6, color7,
color8, color9; color8, color9;
static char *template[10]; #define MAX_TEMPLATES 10
static char *template[MAX_TEMPLATES];
/* maximum size of config TEXT buffer, i.e. below TEXT line. */ /* maximum size of config TEXT buffer, i.e. below TEXT line. */
static unsigned int max_user_text = MAX_USER_TEXT_DEFAULT; static unsigned int max_user_text = MAX_USER_TEXT_DEFAULT;
@ -2961,7 +2962,7 @@ static char *handle_template(const char *tmpl, const char *args)
char *eval_text; char *eval_text;
if ((sscanf(tmpl, "template%u", &template_idx) != 1) || if ((sscanf(tmpl, "template%u", &template_idx) != 1) ||
(template_idx > 9)) (template_idx >= MAX_TEMPLATES))
return NULL; return NULL;
if(args) { if(args) {
@ -7111,7 +7112,10 @@ static void clean_up(void)
#endif /* X11 */ #endif /* X11 */
for (i = 0; i < 10; i ++) { #ifdef HAVE_OPENMP
#pragma omp parallel for
#endif /* HAVE_OPENMP */
for (i = 0; i < MAX_TEMPLATES; i++) {
if (template[i]) { if (template[i]) {
free(template[i]); free(template[i]);
template[i] = NULL; template[i] = NULL;
@ -7300,16 +7304,12 @@ static void set_default_configurations(void)
info.x11.monitor.current = 0; info.x11.monitor.current = 0;
#endif /* X11 */ #endif /* X11 */
template[0] = strdup(""); #ifdef HAVE_OPENMP
template[1] = strdup(""); #pragma omp parallel for
template[2] = strdup(""); #endif /* HAVE_OPENMP */
template[3] = strdup(""); for (int i = 0; i < MAX_TEMPLATES; i++) {
template[4] = strdup(""); template[i] = strdup("");
template[5] = strdup(""); }
template[6] = strdup("");
template[7] = strdup("");
template[8] = strdup("");
template[9] = strdup("");
free(current_mail_spool); free(current_mail_spool);
{ {