From: Willy Tarreua Date: Wed, 15 Apr 2009 08:32:57 +0000 (+0200) Subject: I have noticed that with cronie-1.2, my binaries have seen their \ X-Git-Tag: cronie1.3~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0df9e6802ce0ba42e5cb0043a01288df1315d4aa;p=cronie I have noticed that with cronie-1.2, my binaries have seen their \ size grow by 10x (from 28kB to 290kB). After searching a bit, I found that the responsible was the INIT() macro in globals.h \ which initializes huge strings MailCmd and cron_default_mail_charset both of which are 128 kB. Due to this initialization, the memory \ areas are stored for real in the binary, resulting in larger sizes Signed-off-by: Marcela Mašláňová --- diff --git a/src/cron.c b/src/cron.c index be1c32c..28aebce 100644 --- a/src/cron.c +++ b/src/cron.c @@ -145,6 +145,8 @@ main(int argc, char *argv[]) { #endif ProgramName = argv[0]; + MailCmd[0] = '\0'; + cron_default_mail_charset[0] = '\0'; setlocale(LC_ALL, ""); diff --git a/src/crontab.c b/src/crontab.c index 66aa57f..38fe785 100644 --- a/src/crontab.c +++ b/src/crontab.c @@ -93,6 +93,8 @@ main(int argc, char *argv[]) { Pid = getpid(); ProgramName = argv[0]; + MailCmd[0] = '\0'; + cron_default_mail_charset[0] = '\0'; setlocale(LC_ALL, ""); diff --git a/src/globals.h b/src/globals.h index 2a8e14b..95aff21 100644 --- a/src/globals.h +++ b/src/globals.h @@ -59,14 +59,14 @@ XTRN const char *DowNames[] #endif ; -XTRN char *ProgramName INIT("amnesia"); +XTRN char *ProgramName; XTRN int LineNumber INIT(0); XTRN time_t StartTime INIT(0); XTRN int NoFork INIT(0); XTRN int PermitAnyCrontab INIT(0); XTRN int ValidateMailRcpts INIT(0); -XTRN char MailCmd[MAX_COMMAND] INIT(""); -XTRN char cron_default_mail_charset[MAX_ENVSTR] INIT(""); +XTRN char MailCmd[MAX_COMMAND]; +XTRN char cron_default_mail_charset[MAX_ENVSTR]; #if DEBUGGING XTRN int DebugFlags INIT(0);