summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorbell@sanja.is.com.ua <>2004-11-13 19:35:51 +0200
committerbell@sanja.is.com.ua <>2004-11-13 19:35:51 +0200
commit7210195f1e8b482db0a102b921a859604a1f9522 (patch)
treea534689811d0f65eba423eed77b056f3bb30bd51 /strings
parent1555469b646733f86692033bb20f500b7be29458 (diff)
downloadmariadb-git-7210195f1e8b482db0a102b921a859604a1f9522.tar.gz
now my_printf_error is not better then my_error, but my_error call is shorter
used only one implementation of format parser of (printf) fixed multistatement
Diffstat (limited to 'strings')
-rw-r--r--strings/my_vsnprintf.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c
index 268f7d18f2a..4d7c17e977c 100644
--- a/strings/my_vsnprintf.c
+++ b/strings/my_vsnprintf.c
@@ -52,15 +52,30 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
if (*fmt == '-')
fmt++;
length= width= pre_zero= have_long= 0;
- for (;my_isdigit(&my_charset_latin1,*fmt); fmt++)
+ if (*fmt == '*')
{
- length=length*10+ (uint) (*fmt-'0');
- if (!length)
- pre_zero= 1; /* first digit was 0 */
+ fmt++;
+ length= va_arg(ap, int);
}
+ else
+ for (; my_isdigit(&my_charset_latin1, *fmt); fmt++)
+ {
+ length= length * 10 + (uint)(*fmt - '0');
+ if (!length)
+ pre_zero= 1; /* first digit was 0 */
+ }
if (*fmt == '.')
- for (fmt++;my_isdigit(&my_charset_latin1,*fmt); fmt++)
- width=width*10+ (uint) (*fmt-'0');
+ {
+ fmt++;
+ if (*fmt == '*')
+ {
+ fmt++;
+ width= va_arg(ap, int);
+ }
+ else
+ for (; my_isdigit(&my_charset_latin1, *fmt); fmt++)
+ width= width * 10 + (uint)(*fmt - '0');
+ }
else
width= ~0;
if (*fmt == 'l')