summaryrefslogtreecommitdiff
path: root/mysys/mf_iocache2.c
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2000-11-17 02:36:46 +0200
committerunknown <monty@narttu.mysql.fi>2000-11-17 02:36:46 +0200
commitfcf743ef3314e8b8169fb19371dff9a868da457a (patch)
tree09e51a2c4d96c3afa0d966f7469e46432fc6dc58 /mysys/mf_iocache2.c
parent17ad3822e739340a3d3c90eec5d2399aa250907c (diff)
downloadmariadb-git-fcf743ef3314e8b8169fb19371dff9a868da457a.tar.gz
Fixes for bugs in the usage of IO_CACHE
Docs/manual.texi: Fixed the TRUNCATE syntax + Changelog include/my_sys.h: Added my_b_vprintf mysys/mf_iocache2.c: Added my_b_vprintf mysys/my_vsnprintf.c: Fixed fatal (new) bug mysys/thr_lock.c: Cleanup readline/bind.c: cleanup scripts/Makefile.am: Added mysqldumpslow sql-bench/crash-me.sh: Fixed TRUNCATE sql/log.cc: bug fix sql/log_event.cc: Removed compiler warnings sql/log_event.h: Fixed non portable header in binary dump sql/mf_iocache.cc: cleanup sql/mysqld.cc: Fixed loop problem on NT sql/slave.cc: cleanup sql/sql_class.cc: Fixed typos sql/sql_parse.cc: cleanup sql/sql_select.cc: bugfix sql/sql_table.cc: cleanup sql/sql_yacc.yy: Changed ALTER TABLE ... ORDER BY to get fewer warnings sql/unireg.cc: cleanup sql/unireg.h: Added missing define
Diffstat (limited to 'mysys/mf_iocache2.c')
-rw-r--r--mysys/mf_iocache2.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/mysys/mf_iocache2.c b/mysys/mf_iocache2.c
index 80cea47a80f..b77bddb942a 100644
--- a/mysys/mf_iocache2.c
+++ b/mysys/mf_iocache2.c
@@ -128,30 +128,38 @@ uint my_b_gets(IO_CACHE *info, char *to, uint max_length)
uint my_b_printf(IO_CACHE *info, const char* fmt, ...)
{
+ int result;
va_list args;
+ va_start(args,fmt);
+ result=my_b_vprintf(info, fmt, args);
+ va_end(args);
+ return result;
+}
+
+
+uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
+{
reg1 char *to= info->rc_pos;
char *end=info->rc_end;
uint out_length=0;
- va_start(args,fmt);
-
for (; *fmt ; fmt++)
{
- if (fmt[0] != '%')
+ if (*fmt++ != '%')
{
/* Copy everything until '%' or end of string */
- const char *start=fmt;
+ const char *start=fmt-1;
uint length;
- for (fmt++ ; *fmt && *fmt != '%' ; fmt++ ) ;
+ for (; *fmt && *fmt != '%' ; fmt++ ) ;
length= (uint) (fmt - start);
out_length+=length;
if (my_b_write(info, start, length))
goto err;
if (!*fmt) /* End of format */
{
- va_end(args);
return out_length;
}
+ fmt++;
/* Found one '%' */
}
/* Skipp if max size is used (to be compatible with printf) */
@@ -203,10 +211,8 @@ uint my_b_printf(IO_CACHE *info, const char* fmt, ...)
out_length++;
}
}
- va_end(args);
return out_length;
err:
return (uint) -1;
- va_end(args);
}