diff options
author | unknown <monty@mysql.com> | 2004-03-05 19:49:50 +0200 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-03-05 19:49:50 +0200 |
commit | 28f0e328795e1e72d6b77aec1a7996eddfa60d96 (patch) | |
tree | 4d38939c1f7db4ae8bb4e98725f17b623a00e6c0 /sql | |
parent | eb7516c479c329bb8292b9a17193d34794477bca (diff) | |
download | mariadb-git-28f0e328795e1e72d6b77aec1a7996eddfa60d96.tar.gz |
Portability fixes
mysql-test/r/show_check.result:
Updated results
mysql-test/t/show_check.test:
Portability fix (for 64 bit platforms)
mysys/hash.c:
Portablity fix
sql/gen_lex_hash.cc:
Don't include mysql_priv.h; Causes build errors on a lot of platforms
sql/lex_symbol.h:
Moved symbols here from mysql_priv.h to avoid including mysql_priv.h in gen_lex_hash.cc
sql/mysql_priv.h:
Move symbols and struct to lex_symbol.h
sql/sql_db.cc:
Don't use sql_alloc/sql_free methods in sql_string.h
sql/sql_help.cc:
Don't use sql_alloc/sql_free methods in sql_string.h
sql/sql_string.h:
Don't use sql_alloc/sql_free methods in sql_string.h
This makes the code faster and more portable
sql/sql_yacc.yy:
Don't use sql_alloc/sql_free methods in sql_string.h
Diffstat (limited to 'sql')
-rw-r--r-- | sql/gen_lex_hash.cc | 1 | ||||
-rw-r--r-- | sql/lex_symbol.h | 9 | ||||
-rw-r--r-- | sql/mysql_priv.h | 9 | ||||
-rw-r--r-- | sql/sql_db.cc | 3 | ||||
-rw-r--r-- | sql/sql_help.cc | 6 | ||||
-rw-r--r-- | sql/sql_string.h | 4 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 14 |
7 files changed, 22 insertions, 24 deletions
diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc index 6df7d867a4d..5dc7c50e04c 100644 --- a/sql/gen_lex_hash.cc +++ b/sql/gen_lex_hash.cc @@ -81,7 +81,6 @@ TODO: #endif #include <my_getopt.h> #include "mysql_version.h" -#include "mysql_priv.h" #include "lex.h" struct my_option my_long_options[] = diff --git a/sql/lex_symbol.h b/sql/lex_symbol.h index d1d30a73669..3074a489b6a 100644 --- a/sql/lex_symbol.h +++ b/sql/lex_symbol.h @@ -37,4 +37,13 @@ typedef struct st_lex_symbol uint length; } LEX_SYMBOL; +typedef struct st_sym_group { + const char *name; + const char *needed_define; +} SYM_GROUP; + +extern SYM_GROUP sym_group_common; +extern SYM_GROUP sym_group_geom; +extern SYM_GROUP sym_group_rtree; + #endif /* _lex_symbol_h */ diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 2d22d9c5891..eb879a1fd59 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -1126,12 +1126,3 @@ inline void setup_table_map(TABLE *table, TABLE_LIST *table_list, uint tablenr) table->map= (table_map) 1 << tablenr; table->force_index= table_list->force_index; } - -typedef struct st_sym_group { - const char *name; - const char *needed_define; -} SYM_GROUP; - -extern SYM_GROUP sym_group_common; -extern SYM_GROUP sym_group_geom; -extern SYM_GROUP sym_group_rtree; diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 7bf1268597b..80669089fc4 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -488,7 +488,8 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db, my_dirend(dirp); DBUG_RETURN(-1); } - raid_dirs.push_back(dir=new String(newpath, &my_charset_latin1)); + raid_dirs.push_back(dir=new (&thd->mem_root) + String(newpath, &my_charset_latin1)); dir->copy(); continue; } diff --git a/sql/sql_help.cc b/sql/sql_help.cc index d5516fe3337..e12dde68266 100644 --- a/sql/sql_help.cc +++ b/sql/sql_help.cc @@ -140,7 +140,7 @@ void memorize_variant_topic(THD *thd, TABLE *topics, int count, { if (count == 1) names->push_back(name); - String *new_name= new String; + String *new_name= new (&thd->mem_root) String; get_field(mem_root,find_fields[help_topic_name].field,new_name); names->push_back(new_name); } @@ -391,7 +391,7 @@ int search_categories(THD *thd, TABLE *categories, { if (select && !select->cond->val_int()) continue; - String *lname= new String; + String *lname= new (&thd->mem_root) String; get_field(&thd->mem_root,pfname,lname); if (++count == 1 && res_id) *res_id= (int16) pcat_id->val_int(); @@ -425,7 +425,7 @@ void get_all_items_for_category(THD *thd, TABLE *items, Field *pfname, { if (!select->cond->val_int()) continue; - String *name= new String(); + String *name= new (&thd->mem_root) String(); get_field(&thd->mem_root,pfname,name); res->push_back(name); } diff --git a/sql/sql_string.h b/sql/sql_string.h index 7f1c56dbfe7..32333b3b381 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -69,12 +69,10 @@ public: Alloced_length=str.Alloced_length; alloced=0; str_charset=str.str_charset; } - static void *operator new(size_t size) - { return (void*) sql_alloc((uint) size); } static void *operator new(size_t size, MEM_ROOT *mem_root) { return (void*) alloc_root(mem_root, (uint) size); } static void operator delete(void *ptr_arg,size_t size) /*lint -e715 */ - { sql_element_free(ptr_arg); } + {} ~String() { free(); } inline void set_charset(CHARSET_INFO *charset) { str_charset= charset; } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 7df1973132a..382a6e65549 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -3043,7 +3043,7 @@ opt_distinct: |DISTINCT { $$ = 1; }; opt_gconcat_separator: - /* empty */ { $$ = new String(",",1,default_charset_info); } + /* empty */ { $$ = new (&YYTHD->mem_root) String(",",1,default_charset_info); } |SEPARATOR_SYM text_string { $$ = $2; }; @@ -3293,15 +3293,15 @@ key_list_or_empty: key_usage_list2: key_usage_list2 ',' ident { Select-> - interval_list.push_back(new String((const char*) $3.str, $3.length, + interval_list.push_back(new (&YYTHD->mem_root) String((const char*) $3.str, $3.length, system_charset_info)); } | ident { Select-> - interval_list.push_back(new String((const char*) $1.str, $1.length, + interval_list.push_back(new (&YYTHD->mem_root) String((const char*) $1.str, $1.length, system_charset_info)); } | PRIMARY_SYM { Select-> - interval_list.push_back(new String("PRIMARY", 7, + interval_list.push_back(new (&YYTHD->mem_root) String("PRIMARY", 7, system_charset_info)); }; using_list: @@ -4255,7 +4255,7 @@ opt_describe_column: /* empty */ {} | text_string { Lex->wild= $1; } | ident - { Lex->wild= new String((const char*) $1.str,$1.length,system_charset_info); }; + { Lex->wild= new (&YYTHD->mem_root) String((const char*) $1.str,$1.length,system_charset_info); }; /* flush things */ @@ -4467,7 +4467,7 @@ text_literal: text_string: TEXT_STRING_literal - { $$= new String($1.str,$1.length,YYTHD->variables.collation_connection); } + { $$= new (&YYTHD->mem_root) String($1.str,$1.length,YYTHD->variables.collation_connection); } | HEX_NUM { Item *tmp = new Item_varbinary($1.str,$1.length); @@ -5424,7 +5424,7 @@ column_list: column_list_id: ident { - String *new_str = new String((const char*) $1.str,$1.length,system_charset_info); + String *new_str = new (&YYTHD->mem_root) String((const char*) $1.str,$1.length,system_charset_info); List_iterator <LEX_COLUMN> iter(Lex->columns); class LEX_COLUMN *point; LEX *lex=Lex; |