mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Code cleanup to get fewer reallocs() during execution.
- Changed TABLE->alias to String to get fewer reallocs when alias are used. - Preallocate some buffers Changed some String->c_ptr() -> String->ptr() when \0 is not needed. Fixed wrong usage of String->ptr() when we need a \0 terminated string. Use my_strtod() instead of my_atof() to avoid having to add \0 to string. c_ptr() -> c_ptr_safe() to avoid warnings from valgrind. zr sql/event_db_repository.cc: Update usage of TABLE->alias sql/event_scheduler.cc: c_ptr() -> c_ptr_safe() sql/events.cc: c_ptr() -> ptr() as \0 was not needed sql/field.cc: Update usage of TABLE->alias sql/field.h: Update usage of TABLE->alias sql/ha_partition.cc: Update usage of TABLE->alias sql/handler.cc: Update usage of TABLE->alias Fixed wrong usage of str.ptr() sql/item.cc: Fixed error where code wrongly assumed string was \0 terminated. sql/item_func.cc: c_ptr() -> c_ptr_safe() Update usage of TABLE->alias sql/item_sum.h: Use my_strtod() instead of my_atof() to avoid having to add \0 to string sql/lock.cc: Update usage of TABLE->alias sql/log.cc: c_ptr() -> ptr() as \0 was not needed sql/log_event.cc: c_ptr_quick() -> ptr() as \0 was not needed sql/opt_range.cc: ptr() -> c_ptr() as \0 is needed sql/opt_subselect.cc: Update usage of TABLE->alias sql/opt_table_elimination.cc: Update usage of TABLE->alias sql/set_var.cc: ptr() -> c_ptr() as \0 is needed c_ptr() -> c_ptr_safe() sql/sp.cc: c_ptr() -> ptr() as \0 was not needed sql/sp_rcontext.cc: Update usage of TABLE->alias sql/sql_base.cc: Preallocate buffers Update usage of TABLE->alias sql/sql_class.cc: Fix arguments to sprintf() to work even if string is not \0 terminated sql/sql_insert.cc: Update usage of TABLE->alias c_ptr() -> ptr() as \0 was not needed sql/sql_load.cc: Preallocate buffers Trivial optimizations sql/sql_parse.cc: Trivial optimization sql/sql_plugin.cc: c_ptr() -> ptr() as \0 was not needed sql/sql_select.cc: Update usage of TABLE->alias sql/sql_show.cc: Update usage of TABLE->alias sql/sql_string.h: Added move() function to move allocated memory from one object to another. sql/sql_table.cc: Update usage of TABLE->alias c_ptr() -> c_ptr_safe() sql/sql_test.cc: ptr() -> c_ptr_safe() sql/sql_trigger.cc: Update usage of TABLE->alias c_ptr() -> c_ptr_safe() sql/sql_update.cc: Update usage of TABLE->alias sql/sql_view.cc: ptr() -> c_ptr_safe() sql/sql_yacc.yy: ptr() -> c_ptr() sql/table.cc: Update usage of TABLE->alias sql/table.h: Changed TABLE->alias to String to get fewer reallocs when alias are used. storage/federatedx/ha_federatedx.cc: Use c_ptr_safe() to ensure strings are \0 terminated. storage/maria/ha_maria.cc: Update usage of TABLE->alias storage/myisam/ha_myisam.cc: Update usage of TABLE->alias storage/xtradb/row/row0sel.c: Ensure that null bits in record are properly reset. (Old code didn't work as row_search_for_mysql() can be called twice while reading fields from one row.
This commit is contained in:
@ -65,7 +65,7 @@ print_where(COND *cond,const char *info, enum_query_type query_type)
|
||||
str.append('\0');
|
||||
DBUG_LOCK_FILE;
|
||||
(void) fprintf(DBUG_FILE,"\nWHERE:(%s) ",info);
|
||||
(void) fputs(str.ptr(),DBUG_FILE);
|
||||
(void) fputs(str.c_ptr_safe(),DBUG_FILE);
|
||||
(void) fputc('\n',DBUG_FILE);
|
||||
DBUG_UNLOCK_FILE;
|
||||
}
|
||||
@ -157,7 +157,7 @@ void TEST_filesort(SORT_FIELD *sortorder,uint s_length)
|
||||
out.append('\0'); // Purify doesn't like c_ptr()
|
||||
DBUG_LOCK_FILE;
|
||||
VOID(fputs("\nInfo about FILESORT\n",DBUG_FILE));
|
||||
fprintf(DBUG_FILE,"Sortorder: %s\n",out.ptr());
|
||||
fprintf(DBUG_FILE,"Sortorder: %s\n",out.c_ptr_safe());
|
||||
DBUG_UNLOCK_FILE;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
@ -192,7 +192,7 @@ TEST_join(JOIN *join)
|
||||
TABLE *form=tab->table;
|
||||
char key_map_buff[128];
|
||||
fprintf(DBUG_FILE,"%-16.16s type: %-7s q_keys: %s refs: %d key: %d len: %d\n",
|
||||
form->alias,
|
||||
form->alias.c_ptr(),
|
||||
join_type_str[tab->type],
|
||||
tab->keys.print(key_map_buff),
|
||||
tab->ref.key_parts,
|
||||
@ -216,7 +216,7 @@ TEST_join(JOIN *join)
|
||||
if (tab->ref.key_parts)
|
||||
{
|
||||
fprintf(DBUG_FILE,
|
||||
" refs: %s\n", ref_key_parts[i].ptr());
|
||||
" refs: %s\n", ref_key_parts[i].c_ptr_safe());
|
||||
}
|
||||
}
|
||||
DBUG_UNLOCK_FILE;
|
||||
|
Reference in New Issue
Block a user