Tom's prvs patch to avoid the hardwired use of "%lld" and "long long".
Replaced the call to snprintf() with a call to string_vformat().
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.162 2005/06/17 10:47:05 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.163 2005/06/17 13:52:14 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
PH/15 The code I had for printing potentially long long variables in PH/11
above was not the best (it lost precision). The length of off_t variables
is now inspected at build time, and an appropriate printing format (%ld
- or %lld) is chosen and #defined by OFF_T_FMT. We also define ASSUME_
- LONG_LONG_SUPPORT if the length is greater than 4. This is needed for the
- internal formatting function string_vformat().
+ or %lld) is chosen and #defined by OFF_T_FMT. We also define LONGLONG_T
+ to be "long long int" or "long int". This is needed for the internal
+ formatting function string_vformat().
PH/16 Applied Matthew Newton's patch to exicyclog: "If log_file_path is set in
the configuration file to be ":syslog", then the script "guesses" where
require names are now matched exactly. I enabled the subaddress
extension, but it is not well tested yet (read: it works for me)."
+PH/20 Added macros for time_t as for off_t (see PH/15 above) and used them to
+ rework some of the code of TK/09 above to avoid the hardwired use of
+ "%lld" and "long long". Replaced the call to snprintf() with a call to
+ string_vformat().
+
Exim version 4.51
-----------------
-/* $Cambridge: exim/src/src/buildconfig.c,v 1.8 2005/06/16 14:10:13 ph10 Exp $ */
+/* $Cambridge: exim/src/src/buildconfig.c,v 1.9 2005/06/17 13:52:15 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
/* This auxiliary program builds the file config.h by the following
process:
-First, it determines the size of off_t variables, and generates macro code to
-define OFF_T_FMT as a suitable format, if it is not already defined in the
-system-specific header file.
+First, it determines the size of off_t and time_t variables, and generates
+macro code to define OFF_T_FMT and TIME_T_FMT as suitable formats, if they are
+not already defined in the system-specific header file.
Then it reads Makefile, looking for certain OS-specific definitions which it
uses to define some specific macros. Finally, it reads the defaults file
main(int argc, char **argv)
{
off_t test_off_t = 0;
+time_t test_time_t = 0;
FILE *base;
FILE *new;
int last_initial = 'A';
if (sizeof(test_off_t) > 4)
{
fprintf(new, "#define OFF_T_FMT \"%%lld\"\n");
- fprintf(new, "#define ASSUME_LONG_LONG_SUPPORT\n");
+ fprintf(new, "#define LONGLONG_T long long int\n");
}
else
{
fprintf(new, "#define OFF_T_FMT \"%%ld\"\n");
+ fprintf(new, "#define LONGLONG_T long int\n");
+ }
+fprintf(new, "#endif\n\n");
+
+/* Now do the same thing for time_t variables. If the length is greater than
+4, we want to assume long long support (even if off_t was less than 4). If the
+length is 4 or less, we can leave LONGLONG_T to whatever was defined above for
+off_t. */
+
+fprintf(new, "#ifndef TIME_T_FMT\n");
+if (sizeof(test_time_t) > 4)
+ {
+ fprintf(new, "#define TIME_T_FMT \"%%lld\"\n");
+ fprintf(new, "#undef LONGLONG_T\n");
+ fprintf(new, "#define LONGLONG_T long long int\n");
+ }
+else
+ {
+ fprintf(new, "#define TIME_T_FMT \"%%ld\"\n");
}
fprintf(new, "#endif\n\n");
-/* $Cambridge: exim/src/src/expand.c,v 1.28 2005/06/17 08:23:28 ph10 Exp $ */
+/* $Cambridge: exim/src/src/expand.c,v 1.29 2005/06/17 13:52:15 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
prvs_daystamp(int day_offset)
{
uschar *days = store_get(10);
-snprintf(CS days, 9, "%lld", (((long long)time(NULL))+(day_offset*86400))/86400);
+(void)string_format(days, 10, TIME_T_FMT,
+ (((LONGLONG_T)time(NULL))+(day_offset*86400))/86400);
return (Ustrlen(days) >= 3) ? &days[Ustrlen(days)-3] : NULL;
}
-/* $Cambridge: exim/src/src/string.c,v 1.5 2005/06/16 14:10:13 ph10 Exp $ */
+/* $Cambridge: exim/src/src/string.c,v 1.6 2005/06/17 13:52:15 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
case L_SHORT:
case L_NORMAL: sprintf(CS p, newformat, va_arg(ap, int)); break;
case L_LONG: sprintf(CS p, newformat, va_arg(ap, long int)); break;
- #ifdef ASSUME_LONG_LONG_SUPPORT
- case L_LONGLONG: sprintf(CS p, newformat, va_arg(ap, long long int)); break;
- #else
- case L_LONGLONG: sprintf(CS p, newformat, va_arg(ap, long long int)); break;
- #endif
+ case L_LONGLONG: sprintf(CS p, newformat, va_arg(ap, LONGLONG_T)); break;
}
while (*p) p++;
break;