Commit eaa0c449 authored by serg@serg.mylan's avatar serg@serg.mylan

code cleanup after some reasoning

parent 3248878c
...@@ -941,6 +941,7 @@ static void mysql_read_default_options(struct st_mysql_options *options, ...@@ -941,6 +941,7 @@ static void mysql_read_default_options(struct st_mysql_options *options,
options->rpl_parse= 1; options->rpl_parse= 1;
break; break;
case 27: case 27:
if (opt_arg)
options->max_allowed_packet= atoi(opt_arg); options->max_allowed_packet= atoi(opt_arg);
break; break;
default: default:
......
...@@ -322,10 +322,13 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query, ...@@ -322,10 +322,13 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
to alloc queue with alloc_root() to alloc queue with alloc_root()
*/ */
res=ftb->queue.max_elements=1+query_len/(min(ft_min_word_len,2)+1); res=ftb->queue.max_elements=1+query_len/(min(ft_min_word_len,2)+1);
ftb->queue.root=(byte **)alloc_root(&ftb->mem_root, (res+1)*sizeof(void*)); if (!(ftb->queue.root=
(byte **)alloc_root(&ftb->mem_root, (res+1)*sizeof(void*))))
goto err;
reinit_queue(& ftb->queue, res, 0, 0, reinit_queue(& ftb->queue, res, 0, 0,
(int (*)(void*,byte*,byte*))FTB_WORD_cmp, 0); (int (*)(void*,byte*,byte*))FTB_WORD_cmp, 0);
ftbe=(FTB_EXPR *)alloc_root(&ftb->mem_root, sizeof(FTB_EXPR)); if (!(ftbe=(FTB_EXPR *)alloc_root(&ftb->mem_root, sizeof(FTB_EXPR))))
goto err;
ftbe->weight=1; ftbe->weight=1;
ftbe->flags=FTB_FLAG_YES; ftbe->flags=FTB_FLAG_YES;
ftbe->nos=1; ftbe->nos=1;
...@@ -343,6 +346,10 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query, ...@@ -343,6 +346,10 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
if (ftb->queue.elements<2) ftb->with_scan &= ~FTB_FLAG_TRUNC; if (ftb->queue.elements<2) ftb->with_scan &= ~FTB_FLAG_TRUNC;
ftb->state=READY; ftb->state=READY;
return ftb; return ftb;
err:
free_root(& ftb->mem_root, MYF(0));
my_free((gptr)ftb,MYF(0));
return 0;
} }
......
...@@ -4632,14 +4632,14 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -4632,14 +4632,14 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
my_use_symdir=0; my_use_symdir=0;
break; break;
case (int) OPT_BIND_ADDRESS: case (int) OPT_BIND_ADDRESS:
if (argument && isdigit(argument[0])) if (isdigit(argument[0]))
{ {
my_bind_addr = (ulong) inet_addr(argument); my_bind_addr = (ulong) inet_addr(argument);
} }
else else
{ {
struct hostent *ent; struct hostent *ent;
if (argument || argument[0]) if (argument[0])
ent=gethostbyname(argument); ent=gethostbyname(argument);
else else
{ {
......
...@@ -2454,7 +2454,7 @@ QUICK_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, TABLE_REF *ref) ...@@ -2454,7 +2454,7 @@ QUICK_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, TABLE_REF *ref)
if (cp_buffer_from_ref(ref)) if (cp_buffer_from_ref(ref))
{ {
if (thd->fatal_error) if (thd->fatal_error)
return 0; // out of memory goto err; // out of memory
return quick; // empty range return quick; // empty range
} }
......
...@@ -426,7 +426,6 @@ static Slave_log_event* find_slave_event(IO_CACHE* log, ...@@ -426,7 +426,6 @@ static Slave_log_event* find_slave_event(IO_CACHE* log,
my_snprintf(errmsg, SLAVE_ERRMSG_SIZE, my_snprintf(errmsg, SLAVE_ERRMSG_SIZE,
"Could not find slave event in log '%s'", "Could not find slave event in log '%s'",
(char*)log_file_name); (char*)log_file_name);
delete ev;
return 0; return 0;
} }
......
...@@ -1100,13 +1100,12 @@ rename_file_ext(const char * from,const char * to,const char * ext) ...@@ -1100,13 +1100,12 @@ rename_file_ext(const char * from,const char * to,const char * ext)
char *get_field(MEM_ROOT *mem, TABLE *table, uint fieldnr) char *get_field(MEM_ROOT *mem, TABLE *table, uint fieldnr)
{ {
Field *field=table->field[fieldnr]; Field *field=table->field[fieldnr];
char buff[MAX_FIELD_WIDTH]; char buff[MAX_FIELD_WIDTH], *to;
String str(buff,sizeof(buff)); String str(buff,sizeof(buff));
field->val_str(&str,&str); field->val_str(&str,&str);
uint length=str.length(); uint length=str.length();
if (!length) if (!length || !(to= (char*) alloc_root(mem,length+1)))
return NullS; return NullS;
char *to= (char*) alloc_root(mem,length+1);
memcpy(to,str.ptr(),(uint) length); memcpy(to,str.ptr(),(uint) length);
to[length]=0; to[length]=0;
return to; return to;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment