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,
options->rpl_parse= 1;
break;
case 27:
if (opt_arg)
options->max_allowed_packet= atoi(opt_arg);
break;
default:
......
......@@ -322,10 +322,13 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
to alloc queue with alloc_root()
*/
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,
(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->flags=FTB_FLAG_YES;
ftbe->nos=1;
......@@ -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;
ftb->state=READY;
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)),
my_use_symdir=0;
break;
case (int) OPT_BIND_ADDRESS:
if (argument && isdigit(argument[0]))
if (isdigit(argument[0]))
{
my_bind_addr = (ulong) inet_addr(argument);
}
else
{
struct hostent *ent;
if (argument || argument[0])
if (argument[0])
ent=gethostbyname(argument);
else
{
......
......@@ -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 (thd->fatal_error)
return 0; // out of memory
goto err; // out of memory
return quick; // empty range
}
......
......@@ -426,7 +426,6 @@ static Slave_log_event* find_slave_event(IO_CACHE* log,
my_snprintf(errmsg, SLAVE_ERRMSG_SIZE,
"Could not find slave event in log '%s'",
(char*)log_file_name);
delete ev;
return 0;
}
......
......@@ -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)
{
Field *field=table->field[fieldnr];
char buff[MAX_FIELD_WIDTH];
char buff[MAX_FIELD_WIDTH], *to;
String str(buff,sizeof(buff));
field->val_str(&str,&str);
uint length=str.length();
if (!length)
if (!length || !(to= (char*) alloc_root(mem,length+1)))
return NullS;
char *to= (char*) alloc_root(mem,length+1);
memcpy(to,str.ptr(),(uint) length);
to[length]=0;
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