summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
1f00591)
Jeremy wrote this, mostly; I just fixed up a comment and pedantically numbered the enum values
BOOL
string_vformat(uschar *buffer, int buflen, const char *format, va_list ap)
{
BOOL
string_vformat(uschar *buffer, int buflen, const char *format, va_list ap)
{
-enum { L_NORMAL, L_SHORT, L_LONG, L_LONGLONG, L_LONGDOUBLE };
+/* We assume numbered ascending order, C does not guarantee that */
+enum { L_NORMAL=1, L_SHORT=2, L_LONG=3, L_LONGLONG=4, L_LONGDOUBLE=5, L_SIZE=6 };
BOOL yield = TRUE;
int width, precision;
BOOL yield = TRUE;
int width, precision;
- /* Skip over 'h', 'L', 'l', and 'll', remembering the item length */
+ /* Skip over 'h', 'L', 'l', 'll' and 'z', remembering the item length */
if (*fp == 'h')
{ fp++; length = L_SHORT; }
if (*fp == 'h')
{ fp++; length = L_SHORT; }
+ else if (*fp == 'z')
+ { fp++; length = L_SIZE; }
/* Handle each specific format type. */
/* Handle each specific format type. */
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;
case L_LONGLONG: sprintf(CS p, newformat, va_arg(ap, LONGLONG_T)); break;
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;
case L_LONGLONG: sprintf(CS p, newformat, va_arg(ap, LONGLONG_T)); break;
+ case L_SIZE: sprintf(CS p, newformat, va_arg(ap, size_t)); break;