~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item_cmpfunc.cc

  • Committer: Andrey Hristov
  • Date: 2008-08-06 00:04:45 UTC
  • mto: (264.1.5 codestyle)
  • mto: This revision was merged to the branch mainline in revision 266.
  • Revision ID: ahristov@mysql.com-20080806000445-84urmltikgwk9v5d
Constify the usage of CHARSET_INFO almost to the last place in the code.
99% of the parameters are const CHARSET_INFO * const cs.
Wherever possible stack variables are also double consted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3090
3090
  return (int) ((*compare)(collation, base+start*size, result) == 0);
3091
3091
}
3092
3092
 
3093
 
in_string::in_string(uint elements,qsort2_cmp cmp_func, CHARSET_INFO *cs)
 
3093
in_string::in_string(uint elements,qsort2_cmp cmp_func, const CHARSET_INFO * const cs)
3094
3094
  :in_vector(elements, sizeof(String), cmp_func, cs),
3095
3095
   tmp(buff, sizeof(buff), &my_charset_bin)
3096
3096
{}
3120
3120
  }
3121
3121
  if (!str->charset())
3122
3122
  {
3123
 
    CHARSET_INFO *cs;
 
3123
    const CHARSET_INFO *cs;
3124
3124
    if (!(cs= item->collation.collation))
3125
3125
      cs= &my_charset_bin;              // Should never happen for STR items
3126
3126
    str->set_charset(cs);
3254
3254
 
3255
3255
 
3256
3256
cmp_item* cmp_item::get_comparator(Item_result type,
3257
 
                                   CHARSET_INFO *cs)
 
3257
                                   const CHARSET_INFO * const cs)
3258
3258
{
3259
3259
  switch (type) {
3260
3260
  case STRING_RESULT:
3523
3523
}
3524
3524
 
3525
3525
 
3526
 
static int srtcmp_in(CHARSET_INFO *cs, const String *x,const String *y)
 
3526
static int srtcmp_in(const CHARSET_INFO * const cs, const String *x,const String *y)
3527
3527
{
3528
3528
  return cs->coll->strnncollsp(cs,
3529
3529
                               (uchar *) x->ptr(),x->length(),
4447
4447
 
4448
4448
      if (use_mb(cmp.cmp_collation.collation))
4449
4449
      {
4450
 
        CHARSET_INFO *cs= escape_str->charset();
 
4450
        const CHARSET_INFO * const cs= escape_str->charset();
4451
4451
        my_wc_t wc;
4452
4452
        int rc= cs->cset->mb_wc(cs, &wc,
4453
4453
                                (const uchar*) escape_str->ptr(),
4462
4462
          code instead of Unicode code as "escape" argument.
4463
4463
          Convert to "cs" if charset of escape differs.
4464
4464
        */
4465
 
        CHARSET_INFO *cs= cmp.cmp_collation.collation;
 
4465
        const CHARSET_INFO * const cs= cmp.cmp_collation.collation;
4466
4466
        uint32_t unused;
4467
4467
        if (escape_str->needs_conversion(escape_str->length(),
4468
4468
                                         escape_str->charset(), cs, &unused))
4548
4548
  int            f = 0;
4549
4549
  int            g = plm1;
4550
4550
  int *const splm1 = suff + plm1;
4551
 
  CHARSET_INFO  *cs= cmp.cmp_collation.collation;
 
4551
  const CHARSET_INFO * const cs= cmp.cmp_collation.collation;
4552
4552
 
4553
4553
  *splm1 = pattern_len;
4554
4554
 
4648
4648
  int *end = bmBc + alphabet_size;
4649
4649
  int j;
4650
4650
  const int plm1 = pattern_len - 1;
4651
 
  CHARSET_INFO  *cs= cmp.cmp_collation.collation;
 
4651
  const CHARSET_INFO *const cs= cmp.cmp_collation.collation;
4652
4652
 
4653
4653
  for (i = bmBc; i < end; i++)
4654
4654
    *i = pattern_len;
4680
4680
  int shift = pattern_len;
4681
4681
  int j     = 0;
4682
4682
  int u     = 0;
4683
 
  CHARSET_INFO  *cs= cmp.cmp_collation.collation;
 
4683
  const CHARSET_INFO * const cs= cmp.cmp_collation.collation;
4684
4684
 
4685
4685
  const int plm1=  pattern_len - 1;
4686
4686
  const int tlmpl= text_len - pattern_len;