Commit df97eb14 authored by Marko Mäkelä's avatar Marko Mäkelä

Remove HAVE_SNPRINTF

This fixes up commit 77c184df
which explicitly specifies that we use ISO/IEC 9899:1999 (C99),
which includes the snprintf() function.
parent d1bc469d
/* /*
Copyright (c) 2000, 2015, Oracle and/or its affiliates. Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2011, 2017, MariaDB Copyright (c) 2011, 2022, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -323,11 +323,7 @@ static int write_to_table(char *filename, MYSQL *mysql) ...@@ -323,11 +323,7 @@ static int write_to_table(char *filename, MYSQL *mysql)
{ {
if (verbose) if (verbose)
fprintf(stdout, "Deleting the old data from table %s\n", tablename); fprintf(stdout, "Deleting the old data from table %s\n", tablename);
#ifdef HAVE_SNPRINTF
snprintf(sql_statement, FN_REFLEN*16+256, "DELETE FROM %s", tablename); snprintf(sql_statement, FN_REFLEN*16+256, "DELETE FROM %s", tablename);
#else
sprintf(sql_statement, "DELETE FROM %s", tablename);
#endif
if (mysql_query(mysql, sql_statement)) if (mysql_query(mysql, sql_statement))
{ {
db_error_with_table(mysql, tablename); db_error_with_table(mysql, tablename);
......
...@@ -224,7 +224,6 @@ ...@@ -224,7 +224,6 @@
#cmakedefine HAVE_SIGWAIT 1 #cmakedefine HAVE_SIGWAIT 1
#cmakedefine HAVE_SIGWAITINFO 1 #cmakedefine HAVE_SIGWAITINFO 1
#cmakedefine HAVE_SLEEP 1 #cmakedefine HAVE_SLEEP 1
#cmakedefine HAVE_SNPRINTF 1
#cmakedefine HAVE_STPCPY 1 #cmakedefine HAVE_STPCPY 1
#cmakedefine HAVE_STRERROR 1 #cmakedefine HAVE_STRERROR 1
#cmakedefine HAVE_STRCOLL 1 #cmakedefine HAVE_STRCOLL 1
......
...@@ -407,7 +407,6 @@ CHECK_FUNCTION_EXISTS (sigwait HAVE_SIGWAIT) ...@@ -407,7 +407,6 @@ CHECK_FUNCTION_EXISTS (sigwait HAVE_SIGWAIT)
CHECK_FUNCTION_EXISTS (sigwaitinfo HAVE_SIGWAITINFO) CHECK_FUNCTION_EXISTS (sigwaitinfo HAVE_SIGWAITINFO)
CHECK_FUNCTION_EXISTS (sigset HAVE_SIGSET) CHECK_FUNCTION_EXISTS (sigset HAVE_SIGSET)
CHECK_FUNCTION_EXISTS (sleep HAVE_SLEEP) CHECK_FUNCTION_EXISTS (sleep HAVE_SLEEP)
CHECK_FUNCTION_EXISTS (snprintf HAVE_SNPRINTF)
CHECK_FUNCTION_EXISTS (stpcpy HAVE_STPCPY) CHECK_FUNCTION_EXISTS (stpcpy HAVE_STPCPY)
CHECK_FUNCTION_EXISTS (strcoll HAVE_STRCOLL) CHECK_FUNCTION_EXISTS (strcoll HAVE_STRCOLL)
CHECK_FUNCTION_EXISTS (strerror HAVE_STRERROR) CHECK_FUNCTION_EXISTS (strerror HAVE_STRERROR)
......
...@@ -415,13 +415,9 @@ void field_real::add() ...@@ -415,13 +415,9 @@ void field_real::add()
} }
else else
{ {
#ifdef HAVE_SNPRINTF
buff[sizeof(buff)-1]=0; // Safety buff[sizeof(buff)-1]=0; // Safety
snprintf(buff, sizeof(buff)-1, "%-.*f", (int) decs, num); snprintf(buff, sizeof(buff)-1, "%-.*f", (int) decs, num);
length = (uint) strlen(buff); length = (uint) strlen(buff);
#else
length= snprintf(buff, sizeof(buff), "%-.*f", (int) decs, num);
#endif
// We never need to check further than this // We never need to check further than this
end = buff + length - 1 - decs + max_notzero_dec_len; end = buff + length - 1 - decs + max_notzero_dec_len;
......
...@@ -119,11 +119,7 @@ int main(int argc,char *argv[]) ...@@ -119,11 +119,7 @@ int main(int argc,char *argv[])
if (subkeys.i >= 0) if (subkeys.i >= 0)
weight= subkeys.f; weight= subkeys.f;
#ifdef HAVE_SNPRINTF
snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey_buff+1); snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey_buff+1);
#else
sprintf(buf,"%.*s",(int) keylen,info->lastkey_buff+1);
#endif
my_casedn_str(default_charset_info,buf); my_casedn_str(default_charset_info,buf);
total++; total++;
lengths[keylen]++; lengths[keylen]++;
......
...@@ -117,11 +117,7 @@ int main(int argc,char *argv[]) ...@@ -117,11 +117,7 @@ int main(int argc,char *argv[])
if (subkeys.i >= 0) if (subkeys.i >= 0)
weight= subkeys.f; weight= subkeys.f;
#ifdef HAVE_SNPRINTF
snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey+1); snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey+1);
#else
sprintf(buf,"%.*s",(int) keylen,info->lastkey+1);
#endif
my_casedn_str(default_charset_info,buf); my_casedn_str(default_charset_info,buf);
total++; total++;
lengths[keylen]++; lengths[keylen]++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment