Skip to content

Commit

Permalink
Remove HAVE_SNPRINTF
Browse files Browse the repository at this point in the history
This fixes up commit 77c184d
which explicitly specifies that we use ISO/IEC 9899:1999 (C99),
which includes the snprintf() function.
  • Loading branch information
dr-m committed Oct 5, 2022
1 parent d1bc469 commit df97eb1
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 19 deletions.
6 changes: 1 addition & 5 deletions client/mysqlimport.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 0 additions & 4 deletions sql/sql_analyse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions storage/maria/maria_ftdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]++;
Expand Down
4 changes: 0 additions & 4 deletions storage/myisam/myisam_ftdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]++;
Expand Down

0 comments on commit df97eb1

Please sign in to comment.