Skip to content

Commit fe9e139

Browse files
postreview fix (SCRUM)
fixed layout
1 parent e3ba256 commit fe9e139

23 files changed

+137
-210
lines changed

sql/filesort.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ static void make_sortkey(register SORTPARAM *param,
496496
length=sort_field->length;
497497
}
498498
#ifdef USE_STRCOLL
499-
if(use_strnxfrm(cs))
499+
if (use_strnxfrm(cs))
500500
{
501501
if (item->binary())
502502
{

sql/gstream.cc

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,38 @@
33
int GTextReadStream::get_next_toc_type() const
44
{
55
const char *cur = m_cur;
6-
while((*cur)&&(strchr(" \t\r\n",*cur)))
6+
while ((*cur)&&(strchr(" \t\r\n",*cur)))
77
{
88
cur++;
99
}
10-
if(!(*cur))
10+
if (!(*cur))
1111
{
1212
return eostream;
1313
}
1414

15-
if(((*cur>='a') && (*cur<='z')) || ((*cur>='A') && (*cur<='Z')) || (*cur=='_'))
15+
if (((*cur>='a') && (*cur<='z')) || ((*cur>='A') && (*cur<='Z')) ||
16+
(*cur=='_'))
1617
{
1718
return word;
1819
}
1920

20-
if(((*cur>='0') && (*cur<='9')) || (*cur=='-') || (*cur=='+') || (*cur=='.'))
21+
if (((*cur>='0') && (*cur<='9')) || (*cur=='-') || (*cur=='+') ||
22+
(*cur=='.'))
2123
{
2224
return numeric;
2325
}
2426

25-
if(*cur == '(')
27+
if (*cur == '(')
2628
{
2729
return l_bra;
2830
}
2931

30-
if(*cur == ')')
32+
if (*cur == ')')
3133
{
3234
return r_bra;
3335
}
3436

35-
if(*cur == ',')
37+
if (*cur == ',')
3638
{
3739
return comma;
3840
}
@@ -43,28 +45,28 @@ int GTextReadStream::get_next_toc_type() const
4345
const char *GTextReadStream::get_next_word(int *word_len)
4446
{
4547
const char *cur = m_cur;
46-
while((*cur)&&(strchr(" \t\r\n",*cur)))
48+
while ((*cur)&&(strchr(" \t\r\n",*cur)))
4749
{
4850
cur++;
4951
}
5052
m_last_text_position = cur;
5153

52-
if(!(*cur))
54+
if (!(*cur))
5355
{
5456
return 0;
5557
}
5658

5759
const char *wd_start = cur;
5860

59-
if(((*cur<'a') || (*cur>'z')) && ((*cur<'A') || (*cur>'Z')) && (*cur!='_'))
61+
if (((*cur<'a') || (*cur>'z')) && ((*cur<'A') || (*cur>'Z')) && (*cur!='_'))
6062
{
6163
return NULL;
6264
}
6365

6466
++cur;
6567

66-
while(((*cur>='a') && (*cur<='z')) || ((*cur>='A') && (*cur<='Z')) || (*cur=='_') ||
67-
((*cur>='0') && (*cur<='9')))
68+
while (((*cur>='a') && (*cur<='z')) || ((*cur>='A') && (*cur<='Z')) ||
69+
(*cur=='_') || ((*cur>='0') && (*cur<='9')))
6870
{
6971
++cur;
7072
}
@@ -79,19 +81,19 @@ const char *GTextReadStream::get_next_word(int *word_len)
7981
int GTextReadStream::get_next_number(double *d)
8082
{
8183
const char *cur = m_cur;
82-
while((*cur)&&(strchr(" \t\r\n",*cur)))
84+
while ((*cur)&&(strchr(" \t\r\n",*cur)))
8385
{
8486
cur++;
8587
}
8688

8789
m_last_text_position = cur;
88-
if(!(*cur))
90+
if (!(*cur))
8991
{
9092
set_error_msg("Numeric constant expected");
9193
return 1;
9294
}
9395

94-
if(((*cur<'0') || (*cur>'9')) && (*cur!='-') && (*cur!='+') && (*cur!='.'))
96+
if (((*cur<'0') || (*cur>'9')) && (*cur!='-') && (*cur!='+') && (*cur!='.'))
9597
{
9698
set_error_msg("Numeric constant expected");
9799
return 1;
@@ -101,7 +103,7 @@ int GTextReadStream::get_next_number(double *d)
101103

102104
*d = strtod(cur, &endptr);
103105

104-
if(endptr)
106+
if (endptr)
105107
{
106108
m_cur = endptr;
107109
}
@@ -112,11 +114,11 @@ int GTextReadStream::get_next_number(double *d)
112114
char GTextReadStream::get_next_symbol()
113115
{
114116
const char *cur = m_cur;
115-
while((*cur)&&(strchr(" \t\r\n",*cur)))
117+
while ((*cur)&&(strchr(" \t\r\n",*cur)))
116118
{
117119
cur++;
118120
}
119-
if(!(*cur))
121+
if (!(*cur))
120122
{
121123
return 0;
122124
}

sql/item.cc

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -502,18 +502,17 @@ bool Item_ref_on_list_position::fix_fields(THD *thd,
502502
struct st_table_list *tables,
503503
Item ** reference)
504504
{
505-
ref= 0;
506505
List_iterator<Item> li(list);
507506
Item *item;
508-
uint i= 0;
509-
for (; (item= li++) && i < pos; i++);
510-
if (i == pos)
507+
for (uint i= 0; (item= li++) && i < pos; i++);
508+
if (item)
511509
{
512510
ref= li.ref();
513511
return Item_ref_null_helper::fix_fields(thd, tables, reference);
514512
}
515513
else
516514
{
515+
ref= 0;
517516
my_error(ER_CARDINALITY_COL, MYF(0), pos);
518517
return 1;
519518
}
@@ -1280,29 +1279,20 @@ longlong Item_cache_str::val_int()
12801279

12811280
bool Item_cache_row::allocate(uint num)
12821281
{
1283-
n= num;
1282+
item_count= num;
12841283
THD *thd= current_thd;
1285-
if (!(values= (Item_cache **) thd->calloc(sizeof(Item_cache *)*n)))
1286-
{
1287-
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
1288-
thd->fatal_error= 1;
1289-
return 1;
1290-
}
1291-
return 0;
1284+
return (!(values=
1285+
(Item_cache **) thd->calloc(sizeof(Item_cache *)*item_count)));
12921286
}
12931287

12941288
bool Item_cache_row::setup(Item * item)
12951289
{
12961290
if (!values && allocate(item->cols()))
12971291
return 1;
1298-
for(uint i= 0; i < n; i++)
1292+
for (uint i= 0; i < item_count; i++)
12991293
{
13001294
if (!(values[i]= Item_cache::get_cache(item->el(i)->result_type())))
1301-
{
1302-
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
1303-
current_thd->fatal_error= 1;
13041295
return 1;
1305-
}
13061296
values[i]->setup(item->el(i));
13071297
}
13081298
return 0;
@@ -1312,7 +1302,7 @@ void Item_cache_row::store(Item * item)
13121302
{
13131303
null_value= 0;
13141304
item->bring_value();
1315-
for(uint i= 0; i < n; i++)
1305+
for (uint i= 0; i < item_count; i++)
13161306
{
13171307
values[i]->store(item->el(i));
13181308
null_value|= values[i]->null_value;
@@ -1330,7 +1320,7 @@ void Item_cache_row::illegal_method_call(const char *method)
13301320

13311321
bool Item_cache_row::check_cols(uint c)
13321322
{
1333-
if (c != n)
1323+
if (c != item_count)
13341324
{
13351325
my_error(ER_CARDINALITY_COL, MYF(0), c);
13361326
return 1;
@@ -1340,7 +1330,7 @@ bool Item_cache_row::check_cols(uint c)
13401330

13411331
bool Item_cache_row::null_inside()
13421332
{
1343-
for (uint i= 0; i < n; i++)
1333+
for (uint i= 0; i < item_count; i++)
13441334
{
13451335
if (values[i]->cols() > 1)
13461336
{
@@ -1359,7 +1349,7 @@ bool Item_cache_row::null_inside()
13591349

13601350
void Item_cache_row::bring_value()
13611351
{
1362-
for (uint i= 0; i < n; i++)
1352+
for (uint i= 0; i < item_count; i++)
13631353
values[i]->bring_value();
13641354
return;
13651355
}

sql/item.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -731,9 +731,9 @@ class Item_cache_str: public Item_cache
731731
class Item_cache_row: public Item_cache
732732
{
733733
Item_cache **values;
734-
uint n;
734+
uint item_count;
735735
public:
736-
Item_cache_row(): values(0), n(2) { fixed= 1; null_value= 1; }
736+
Item_cache_row(): values(0), item_count(2) { fixed= 1; null_value= 1; }
737737

738738
/*
739739
'allocate' used only in row transformer, to preallocate space for row
@@ -768,7 +768,7 @@ class Item_cache_row: public Item_cache
768768
};
769769
enum Item_result result_type() const { return ROW_RESULT; }
770770

771-
uint cols() { return n; }
771+
uint cols() { return item_count; }
772772
Item* el(uint i) { return values[i]; }
773773
Item** addr(uint i) { return (Item **) (values + i); }
774774
bool check_cols(uint c);

sql/item_cmpfunc.cc

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,7 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type)
153153
comparators[i].set_cmp_func(owner, (*a)->addr(i), (*b)->addr(i));
154154
}
155155
else
156-
{
157-
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
158-
current_thd->fatal_error= 1;
159156
return 1;
160-
}
161157
}
162158
return 0;
163159
}
@@ -276,11 +272,7 @@ int Arg_comparator::compare_e_row()
276272

277273
bool Item_in_optimizer::preallocate_row()
278274
{
279-
if ((cache= Item_cache::get_cache(ROW_RESULT)))
280-
return 0;
281-
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
282-
current_thd->fatal_error= 1;
283-
return 1;
275+
return (!(cache= Item_cache::get_cache(ROW_RESULT)));
284276
}
285277

286278
bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables,
@@ -296,11 +288,7 @@ bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables,
296288
used_tables_cache= args[0]->used_tables();
297289
const_item_cache= args[0]->const_item();
298290
if (!cache && !(cache= Item_cache::get_cache(args[0]->result_type())))
299-
{
300-
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
301-
thd->fatal_error= 1;
302291
return 1;
303-
}
304292
cache->setup(args[0]);
305293
if (args[1]->fix_fields(thd, tables, args))
306294
return 1;
@@ -1246,18 +1234,10 @@ void cmp_item_row::store_value(Item *item)
12461234
item->null_value|= item->el(i)->null_value;
12471235
}
12481236
else
1249-
{
1250-
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
1251-
thd->fatal_error= 1;
12521237
return;
1253-
}
12541238
}
12551239
else
1256-
{
1257-
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
1258-
thd->fatal_error= 1;
12591240
return;
1260-
}
12611241
}
12621242

12631243
void cmp_item_row::store_value_by_template(cmp_item *t, Item *item)
@@ -1281,18 +1261,10 @@ void cmp_item_row::store_value_by_template(cmp_item *t, Item *item)
12811261
item->null_value|= item->el(i)->null_value;
12821262
}
12831263
else
1284-
{
1285-
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
1286-
current_thd->fatal_error= 1;
12871264
return;
1288-
}
12891265
}
12901266
else
1291-
{
1292-
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
1293-
current_thd->fatal_error= 1;
12941267
return;
1295-
}
12961268
}
12971269

12981270
int cmp_item_row::cmp(Item *arg)

sql/item_cmpfunc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,8 +544,8 @@ class cmp_item_row :public cmp_item
544544
cmp_item_row(): comparators(0), n(0) {}
545545
~cmp_item_row()
546546
{
547-
if(comparators)
548-
for(uint i= 0; i < n; i++)
547+
if (comparators)
548+
for (uint i= 0; i < n; i++)
549549
if (comparators[i])
550550
delete comparators[i];
551551
}

sql/item_func.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,7 @@ class Item_func_match :public Item_real_func
995995
{
996996
ft_handler->please->close_search(ft_handler);
997997
ft_handler=0;
998-
if(join_key)
998+
if (join_key)
999999
table->file->ft_handler=0;
10001000
table->fulltext_searched=0;
10011001
}

sql/item_row.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Item_row: public Item
3333

3434
~Item_row()
3535
{
36-
if(array_holder && items)
36+
if (array_holder && items)
3737
sql_element_free(items);
3838
}
3939

sql/item_strfunc.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,7 +1961,7 @@ String *Item_func_conv_charset::val_str(String *str)
19611961
d0=d=(unsigned char*)str->ptr();
19621962
de=d+dmaxlen;
19631963

1964-
while( s < se && d < de){
1964+
while (s < se && d < de){
19651965

19661966
cnvres=from->mb_wc(from,&wc,s,se);
19671967
if (cnvres>0)
@@ -2035,7 +2035,7 @@ String *Item_func_conv_charset3::val_str(String *str)
20352035
d0=d=(unsigned char*)str->ptr();
20362036
de=d+dmaxlen;
20372037

2038-
while( s < se && d < de){
2038+
while (s < se && d < de){
20392039

20402040
cnvres=from_charset->mb_wc(from_charset,&wc,s,se);
20412041
if (cnvres>0)
@@ -2655,7 +2655,7 @@ String *Item_func_spatial_collection::val_str(String *str)
26552655
null_value=1;
26562656

26572657
str->length(0);
2658-
if(str->reserve(9,512))
2658+
if (str->reserve(9,512))
26592659
return 0;
26602660

26612661
str->q_append((char)Geometry::wkbNDR);

0 commit comments

Comments
 (0)