Skip to content
Permalink
Browse files
InnoDB: Remove ut_vsnprintf() and the use of my_vsnprintf(); use vsnp…
…rintf()
  • Loading branch information
dr-m committed Nov 13, 2017
1 parent c19ef50 commit b2dd523
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 54 deletions.
@@ -2212,7 +2212,7 @@ buf_resize_status(

va_start(ap, fmt);

ut_vsnprintf(
vsnprintf(
export_vars.innodb_buffer_pool_resize_status,
sizeof(export_vars.innodb_buffer_pool_resize_status),
fmt, ap);
@@ -119,7 +119,7 @@ buf_dump_status(

va_start(ap, fmt);

ut_vsnprintf(
vsnprintf(
export_vars.innodb_buffer_pool_dump_status,
sizeof(export_vars.innodb_buffer_pool_dump_status),
fmt, ap);
@@ -158,7 +158,7 @@ buf_load_status(

va_start(ap, fmt);

ut_vsnprintf(
vsnprintf(
export_vars.innodb_buffer_pool_load_status,
sizeof(export_vars.innodb_buffer_pool_load_status),
fmt, ap);
@@ -22494,7 +22494,7 @@ ib_errf(
if (vasprintf(&str, format, args) == -1) {
/* In case of failure use a fixed length string */
str = static_cast<char*>(malloc(BUFSIZ));
my_vsnprintf(str, BUFSIZ, format, args);
vsnprintf(str, BUFSIZ, format, args);
}
#else
/* Use a fixed length string. */
@@ -22503,7 +22503,7 @@ ib_errf(
va_end(args);
return; /* Watch for Out-Of-Memory */
}
my_vsnprintf(str, BUFSIZ, format, args);
vsnprintf(str, BUFSIZ, format, args);
#endif /* _WIN32 */

ib_senderrf(thd, level, code, str);
@@ -395,33 +395,6 @@ ut_copy_file(
FILE* dest, /*!< in: output file */
FILE* src); /*!< in: input file to be appended to output */

#ifdef _WIN32
/**********************************************************************//**
A substitute for vsnprintf(3), formatted output conversion into
a limited buffer. Note: this function DOES NOT return the number of
characters that would have been printed if the buffer was unlimited because
VC's _vsnprintf() returns -1 in this case and we would need to call
_vscprintf() in addition to estimate that but we would need another copy
of "ap" for that and VC does not provide va_copy(). */
void
ut_vsnprintf(
/*=========*/
char* str, /*!< out: string */
size_t size, /*!< in: str size */
const char* fmt, /*!< in: format */
va_list ap); /*!< in: format values */
#else
/**********************************************************************//**
A wrapper for vsnprintf(3), formatted output conversion into
a limited buffer. Note: this function DOES NOT return the number of
characters that would have been printed if the buffer was unlimited because
VC's _vsnprintf() returns -1 in this case and we would need to call
_vscprintf() in addition to estimate that but we would need another copy
of "ap" for that and VC does not provide va_copy(). */
# define ut_vsnprintf(buf, size, fmt, ap) \
((void) vsnprintf(buf, size, fmt, ap))
#endif /* _WIN32 */

/*************************************************************//**
Convert an error number to a human readable text message. The
returned string is static and should not be freed or modified.
@@ -522,28 +522,6 @@ ut_copy_file(
} while (len > 0);
}

#ifdef _WIN32
# include <stdarg.h>
/**********************************************************************//**
A substitute for vsnprintf(3), formatted output conversion into
a limited buffer. Note: this function DOES NOT return the number of
characters that would have been printed if the buffer was unlimited because
VC's _vsnprintf() returns -1 in this case and we would need to call
_vscprintf() in addition to estimate that but we would need another copy
of "ap" for that and VC does not provide va_copy(). */
void
ut_vsnprintf(
/*=========*/
char* str, /*!< out: string */
size_t size, /*!< in: str size */
const char* fmt, /*!< in: format */
va_list ap) /*!< in: format values */
{
_vsnprintf(str, size, fmt, ap);
str[size - 1] = '\0';
}
#endif /* _WIN32 */

/** Convert an error number to a human readable text message.
The returned string is static and should not be freed or modified.
@param[in] num InnoDB internal error number

0 comments on commit b2dd523

Please sign in to comment.