Skip to content

Commit c19ef50

Browse files
committed
InnoDB: Remove ut_snprintf() and the use of my_snprintf(); use snprintf()
1 parent 17bd6ed commit c19ef50

25 files changed

+221
-282
lines changed

extra/mariabackup/backup_copy.cc

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,8 @@ datadir_iter_next_database(datadir_iter_t *it)
252252
it->dbpath = static_cast<char*>(
253253
malloc(it->dbpath_len));
254254
}
255-
ut_snprintf(it->dbpath, it->dbpath_len,
256-
"%s/%s", it->datadir_path,
257-
it->dbinfo.name);
255+
snprintf(it->dbpath, it->dbpath_len, "%s/%s",
256+
it->datadir_path, it->dbinfo.name);
258257
os_normalize_path(it->dbpath);
259258

260259
if (it->dbinfo.type == OS_FILE_TYPE_FILE) {
@@ -1034,8 +1033,8 @@ move_file(ds_ctxt_t *datasink,
10341033
char dst_dir_abs[FN_REFLEN];
10351034
size_t dirname_length;
10361035

1037-
ut_snprintf(dst_file_path_abs, sizeof(dst_file_path_abs),
1038-
"%s/%s", dst_dir, dst_file_path);
1036+
snprintf(dst_file_path_abs, sizeof(dst_file_path_abs),
1037+
"%s/%s", dst_dir, dst_file_path);
10391038

10401039
dirname_part(dst_dir_abs, dst_file_path_abs, &dirname_length);
10411040

@@ -1252,8 +1251,8 @@ backup_files(const char *from, bool prep_mode)
12521251
} else if (!prep_mode) {
12531252
/* backup fake file into empty directory */
12541253
char path[FN_REFLEN];
1255-
ut_snprintf(path, sizeof(path),
1256-
"%s/db.opt", node.filepath);
1254+
snprintf(path, sizeof(path),
1255+
"%s/db.opt", node.filepath);
12571256
if (!(ret = backup_file_printf(
12581257
trim_dotslash(path), "%s", ""))) {
12591258
msg("Failed to create file %s\n", path);

extra/mariabackup/backup_mysql.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ select_incremental_lsn_from_history(lsn_t *incremental_lsn)
589589
mysql_real_escape_string(mysql_connection, buf,
590590
opt_incremental_history_name,
591591
(unsigned long)strlen(opt_incremental_history_name));
592-
ut_snprintf(query, sizeof(query),
592+
snprintf(query, sizeof(query),
593593
"SELECT innodb_to_lsn "
594594
"FROM PERCONA_SCHEMA.xtrabackup_history "
595595
"WHERE name = '%s' "
@@ -602,7 +602,7 @@ select_incremental_lsn_from_history(lsn_t *incremental_lsn)
602602
mysql_real_escape_string(mysql_connection, buf,
603603
opt_incremental_history_uuid,
604604
(unsigned long)strlen(opt_incremental_history_uuid));
605-
ut_snprintf(query, sizeof(query),
605+
snprintf(query, sizeof(query),
606606
"SELECT innodb_to_lsn "
607607
"FROM PERCONA_SCHEMA.xtrabackup_history "
608608
"WHERE uuid = '%s' "
@@ -766,7 +766,7 @@ kill_long_queries(MYSQL *connection, time_t timeout)
766766
is_select_query(info))) {
767767
msg_ts("Killing query %s (duration %d sec): %s\n",
768768
id, (int)duration, info);
769-
ut_snprintf(kill_stmt, sizeof(kill_stmt),
769+
snprintf(kill_stmt, sizeof(kill_stmt),
770770
"KILL %s", id);
771771
xb_mysql_query(connection, kill_stmt, false, false);
772772
}
@@ -1288,8 +1288,8 @@ write_current_binlog_file(MYSQL *connection)
12881288
goto cleanup;
12891289
}
12901290

1291-
ut_snprintf(filepath, sizeof(filepath), "%s%c%s",
1292-
log_bin_dir, FN_LIBCHAR, log_bin_file);
1291+
snprintf(filepath, sizeof(filepath), "%s%c%s",
1292+
log_bin_dir, FN_LIBCHAR, log_bin_file);
12931293
result = copy_file(ds_data, filepath, log_bin_file, 0);
12941294
}
12951295

@@ -1574,8 +1574,8 @@ char *make_argv(char *buf, size_t len, int argc, char **argv)
15741574
if (strncmp(*argv, "--password", strlen("--password")) == 0) {
15751575
arg = "--password=...";
15761576
}
1577-
left-= ut_snprintf(buf + len - left, left,
1578-
"%s%c", arg, argc > 1 ? ' ' : 0);
1577+
left-= snprintf(buf + len - left, left,
1578+
"%s%c", arg, argc > 1 ? ' ' : 0);
15791579
++argv; --argc;
15801580
}
15811581

extra/mariabackup/changed_page_bitmap.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ log_online_open_bitmap_file_read_only(
441441

442442
xb_ad(name[0] != '\0');
443443

444-
ut_snprintf(bitmap_file->name, FN_REFLEN, "%s%s", srv_data_home, name);
444+
snprintf(bitmap_file->name, FN_REFLEN, "%s%s", srv_data_home, name);
445445
bitmap_file->file = os_file_create_simple_no_error_handling(
446446
0, bitmap_file->name,
447447
OS_FILE_OPEN, OS_FILE_READ_ONLY, true, &success);

extra/mariabackup/xtrabackup.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2685,10 +2685,10 @@ xb_load_single_table_tablespace(
26852685
name = static_cast<char*>(ut_malloc_nokey(pathlen));
26862686

26872687
if (dirname != NULL) {
2688-
ut_snprintf(name, pathlen, "%s/%s", dirname, filname);
2688+
snprintf(name, pathlen, "%s/%s", dirname, filname);
26892689
name[pathlen - 5] = 0;
26902690
} else {
2691-
ut_snprintf(name, pathlen, "%s", filname);
2691+
snprintf(name, pathlen, "%s", filname);
26922692
name[pathlen - 5] = 0;
26932693
}
26942694

@@ -2806,8 +2806,8 @@ static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback)
28062806

28072807
dbpath = static_cast<char*>(ut_malloc_nokey(dbpath_len));
28082808
}
2809-
ut_snprintf(dbpath, dbpath_len,
2810-
"%s/%s", fil_path_to_mysql_datadir, dbinfo.name);
2809+
snprintf(dbpath, dbpath_len,
2810+
"%s/%s", fil_path_to_mysql_datadir, dbinfo.name);
28112811
os_normalize_path(dbpath);
28122812

28132813
if (check_if_skip_database_by_path(dbpath)) {

storage/innobase/buf/buf0dump.cc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ buf_dump_generate_path(
206206
{
207207
char buf[FN_REFLEN];
208208

209-
ut_snprintf(buf, sizeof(buf), "%s%c%s", get_buf_dump_dir(),
210-
OS_PATH_SEPARATOR, srv_buf_dump_filename);
209+
snprintf(buf, sizeof(buf), "%s%c%s", get_buf_dump_dir(),
210+
OS_PATH_SEPARATOR, srv_buf_dump_filename);
211211

212212
os_file_type_t type;
213213
bool exists = false;
@@ -233,14 +233,14 @@ buf_dump_generate_path(
233233
if (srv_data_home_full[strlen(srv_data_home_full) - 1]
234234
== OS_PATH_SEPARATOR) {
235235

236-
ut_snprintf(path, path_size, "%s%s",
237-
srv_data_home_full,
238-
srv_buf_dump_filename);
236+
snprintf(path, path_size, "%s%s",
237+
srv_data_home_full,
238+
srv_buf_dump_filename);
239239
} else {
240-
ut_snprintf(path, path_size, "%s%c%s",
241-
srv_data_home_full,
242-
OS_PATH_SEPARATOR,
243-
srv_buf_dump_filename);
240+
snprintf(path, path_size, "%s%c%s",
241+
srv_data_home_full,
242+
OS_PATH_SEPARATOR,
243+
srv_buf_dump_filename);
244244
}
245245
}
246246
}
@@ -269,8 +269,8 @@ buf_dump(
269269

270270
buf_dump_generate_path(full_filename, sizeof(full_filename));
271271

272-
ut_snprintf(tmp_filename, sizeof(tmp_filename),
273-
"%s.incomplete", full_filename);
272+
snprintf(tmp_filename, sizeof(tmp_filename),
273+
"%s.incomplete", full_filename);
274274

275275
buf_dump_status(STATUS_INFO, "Dumping buffer pool(s) to %s",
276276
full_filename);

storage/innobase/dict/dict0dict.cc

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6512,7 +6512,7 @@ dict_table_schema_check(
65126512
}
65136513

65146514
if (should_print) {
6515-
ut_snprintf(errstr, errstr_sz,
6515+
snprintf(errstr, errstr_sz,
65166516
"Table %s not found.",
65176517
ut_format_name(req_schema->table_name,
65186518
buf, sizeof(buf)));
@@ -6526,7 +6526,7 @@ dict_table_schema_check(
65266526
fil_space_get(table->space) == NULL) {
65276527
/* missing tablespace */
65286528

6529-
ut_snprintf(errstr, errstr_sz,
6529+
snprintf(errstr, errstr_sz,
65306530
"Tablespace for table %s is missing.",
65316531
ut_format_name(req_schema->table_name,
65326532
buf, sizeof(buf)));
@@ -6537,13 +6537,13 @@ dict_table_schema_check(
65376537
ulint n_sys_cols = dict_table_get_n_sys_cols(table);
65386538
if ((ulint) table->n_def - n_sys_cols != req_schema->n_cols) {
65396539
/* the table has a different number of columns than required */
6540-
ut_snprintf(errstr, errstr_sz,
6541-
"%s has " ULINTPF " columns but should have "
6542-
ULINTPF ".",
6543-
ut_format_name(req_schema->table_name,
6544-
buf, sizeof(buf)),
6545-
table->n_def - n_sys_cols,
6546-
req_schema->n_cols);
6540+
snprintf(errstr, errstr_sz,
6541+
"%s has " ULINTPF " columns but should have "
6542+
ULINTPF ".",
6543+
ut_format_name(req_schema->table_name, buf,
6544+
sizeof buf),
6545+
table->n_def - n_sys_cols,
6546+
req_schema->n_cols);
65476547

65486548
return(DB_ERROR);
65496549
}
@@ -6559,7 +6559,7 @@ dict_table_schema_check(
65596559

65606560
if (j == table->n_def) {
65616561

6562-
ut_snprintf(errstr, errstr_sz,
6562+
snprintf(errstr, errstr_sz,
65636563
"required column %s"
65646564
" not found in table %s.",
65656565
req_schema->columns[i].name,
@@ -6578,7 +6578,7 @@ dict_table_schema_check(
65786578

65796579
CREATE_TYPES_NAMES();
65806580

6581-
ut_snprintf(errstr, errstr_sz,
6581+
snprintf(errstr, errstr_sz,
65826582
"Column %s in table %s is %s"
65836583
" but should be %s (length mismatch).",
65846584
req_schema->columns[i].name,
@@ -6602,7 +6602,7 @@ dict_table_schema_check(
66026602
{
66036603
CREATE_TYPES_NAMES();
66046604

6605-
ut_snprintf(errstr, errstr_sz,
6605+
snprintf(errstr, errstr_sz,
66066606
"Column %s in table %s is %s"
66076607
" but should be %s (type mismatch).",
66086608
req_schema->columns[i].name,
@@ -6621,7 +6621,7 @@ dict_table_schema_check(
66216621

66226622
CREATE_TYPES_NAMES();
66236623

6624-
ut_snprintf(errstr, errstr_sz,
6624+
snprintf(errstr, errstr_sz,
66256625
"Column %s in table %s is %s"
66266626
" but should be %s (flags mismatch).",
66276627
req_schema->columns[i].name,
@@ -6634,7 +6634,7 @@ dict_table_schema_check(
66346634
}
66356635

66366636
if (req_schema->n_foreign != table->foreign_set.size()) {
6637-
ut_snprintf(
6637+
snprintf(
66386638
errstr, errstr_sz,
66396639
"Table %s has " ULINTPF " foreign key(s) pointing"
66406640
" to other tables, but it must have " ULINTPF ".",
@@ -6646,7 +6646,7 @@ dict_table_schema_check(
66466646
}
66476647

66486648
if (req_schema->n_referenced != table->referenced_set.size()) {
6649-
ut_snprintf(
6649+
snprintf(
66506650
errstr, errstr_sz,
66516651
"There are " ULINTPF " foreign key(s) pointing to %s, "
66526652
"but there must be " ULINTPF ".",
@@ -6720,7 +6720,7 @@ dict_fs2utf8(
67206720
&errors);
67216721

67226722
if (errors != 0) {
6723-
ut_snprintf(table_utf8, table_utf8_size, "%s%s",
6723+
snprintf(table_utf8, table_utf8_size, "%s%s",
67246724
srv_mysql50_table_name_prefix, table);
67256725
}
67266726
}

storage/innobase/dict/dict0mem.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,7 @@ dict_mem_create_temporary_tablename(
10671067
size = dblen + (sizeof(TEMP_FILE_PREFIX) + 3 + 20 + 1 + 10);
10681068
name = static_cast<char*>(mem_heap_alloc(heap, size));
10691069
memcpy(name, dbtab, dblen);
1070-
ut_snprintf(name + dblen, size - dblen,
1070+
snprintf(name + dblen, size - dblen,
10711071
TEMP_FILE_PREFIX_INNODB UINT64PF "-" UINT32PF,
10721072
id, dict_temp_file_num);
10731073

0 commit comments

Comments
 (0)