Browse Source

Remove HAVE_SNPRINTF

This fixes up commit 77c184df7c
which explicitly specifies that we use ISO/IEC 9899:1999 (C99),
which includes the snprintf() function.
pull/2287/head
Marko Mäkelä 3 years ago
parent
commit
df97eb1432
  1. 6
      client/mysqlimport.c
  2. 1
      config.h.cmake
  3. 1
      configure.cmake
  4. 4
      sql/sql_analyse.cc
  5. 4
      storage/maria/maria_ftdump.c
  6. 4
      storage/myisam/myisam_ftdump.c

6
client/mysqlimport.c

@ -1,6 +1,6 @@
/*
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
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)
{
if (verbose)
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);
#else
sprintf(sql_statement, "DELETE FROM %s", tablename);
#endif
if (mysql_query(mysql, sql_statement))
{
db_error_with_table(mysql, tablename);

1
config.h.cmake

@ -224,7 +224,6 @@
#cmakedefine HAVE_SIGWAIT 1
#cmakedefine HAVE_SIGWAITINFO 1
#cmakedefine HAVE_SLEEP 1
#cmakedefine HAVE_SNPRINTF 1
#cmakedefine HAVE_STPCPY 1
#cmakedefine HAVE_STRERROR 1
#cmakedefine HAVE_STRCOLL 1

1
configure.cmake

@ -407,7 +407,6 @@ CHECK_FUNCTION_EXISTS (sigwait HAVE_SIGWAIT)
CHECK_FUNCTION_EXISTS (sigwaitinfo HAVE_SIGWAITINFO)
CHECK_FUNCTION_EXISTS (sigset HAVE_SIGSET)
CHECK_FUNCTION_EXISTS (sleep HAVE_SLEEP)
CHECK_FUNCTION_EXISTS (snprintf HAVE_SNPRINTF)
CHECK_FUNCTION_EXISTS (stpcpy HAVE_STPCPY)
CHECK_FUNCTION_EXISTS (strcoll HAVE_STRCOLL)
CHECK_FUNCTION_EXISTS (strerror HAVE_STRERROR)

4
sql/sql_analyse.cc

@ -415,13 +415,9 @@ void field_real::add()
}
else
{
#ifdef HAVE_SNPRINTF
buff[sizeof(buff)-1]=0; // Safety
snprintf(buff, sizeof(buff)-1, "%-.*f", (int) decs, num);
length = (uint) strlen(buff);
#else
length= snprintf(buff, sizeof(buff), "%-.*f", (int) decs, num);
#endif
// We never need to check further than this
end = buff + length - 1 - decs + max_notzero_dec_len;

4
storage/maria/maria_ftdump.c

@ -119,11 +119,7 @@ int main(int argc,char *argv[])
if (subkeys.i >= 0)
weight= subkeys.f;
#ifdef HAVE_SNPRINTF
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);
total++;
lengths[keylen]++;

4
storage/myisam/myisam_ftdump.c

@ -117,11 +117,7 @@ int main(int argc,char *argv[])
if (subkeys.i >= 0)
weight= subkeys.f;
#ifdef HAVE_SNPRINTF
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);
total++;
lengths[keylen]++;

Loading…
Cancel
Save