~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_handler.c

  • Committer: Brian Aker
  • Date: 2008-07-13 18:27:33 UTC
  • Revision ID: brian@tangent.org-20080713182733-3u1et5nrmofi8a8n
my_bool cleanup.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include "my_handler_errors.h"
26
26
 
27
27
int ha_compare_text(CHARSET_INFO *charset_info, uchar *a, uint a_length,
28
 
                    uchar *b, uint b_length, my_bool part_key,
29
 
                    my_bool skip_end_space)
 
28
                    uchar *b, uint b_length, bool part_key,
 
29
                    bool skip_end_space)
30
30
{
31
31
  if (!part_key)
32
32
    return charset_info->coll->strnncollsp(charset_info, a, a_length,
33
 
                                           b, b_length, (my_bool)!skip_end_space);
 
33
                                           b, b_length, (bool)!skip_end_space);
34
34
  return charset_info->coll->strnncoll(charset_info, a, a_length,
35
35
                                       b, b_length, part_key);
36
36
}
37
37
 
38
38
 
39
39
static int compare_bin(uchar *a, uint a_length, uchar *b, uint b_length,
40
 
                       my_bool part_key, my_bool skip_end_space)
 
40
                       bool part_key, bool skip_end_space)
41
41
{
42
42
  uint length= min(a_length,b_length);
43
43
  uchar *end= a+ length;
181
181
 
182
182
        if (piks &&
183
183
            (flag=ha_compare_text(keyseg->charset,a,a_length,b,b_length,
184
 
                                  (my_bool) ((nextflag & SEARCH_PREFIX) &&
 
184
                                  (bool) ((nextflag & SEARCH_PREFIX) &&
185
185
                                             next_key_length <= 0),
186
 
                                  (my_bool)!(nextflag & SEARCH_PREFIX))))
 
186
                                  (bool)!(nextflag & SEARCH_PREFIX))))
187
187
          return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
188
188
        a+=a_length;
189
189
        b+=b_length;
194
194
        uint length=(uint) (end-a), a_length=length, b_length=length;
195
195
        if (piks &&
196
196
            (flag= ha_compare_text(keyseg->charset, a, a_length, b, b_length,
197
 
                                   (my_bool) ((nextflag & SEARCH_PREFIX) &&
 
197
                                   (bool) ((nextflag & SEARCH_PREFIX) &&
198
198
                                              next_key_length <= 0),
199
 
                                   (my_bool)!(nextflag & SEARCH_PREFIX))))
 
199
                                   (bool)!(nextflag & SEARCH_PREFIX))))
200
200
          return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
201
201
        a=end;
202
202
        b+=length;
213
213
 
214
214
        if (piks &&
215
215
            (flag=compare_bin(a,a_length,b,b_length,
216
 
                              (my_bool) ((nextflag & SEARCH_PREFIX) &&
 
216
                              (bool) ((nextflag & SEARCH_PREFIX) &&
217
217
                                         next_key_length <= 0),1)))
218
218
          return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
219
219
        a+=a_length;
225
225
        uint length=keyseg->length;
226
226
        if (piks &&
227
227
            (flag=compare_bin(a,length,b,length,
228
 
                              (my_bool) ((nextflag & SEARCH_PREFIX) &&
 
228
                              (bool) ((nextflag & SEARCH_PREFIX) &&
229
229
                                         next_key_length <= 0),0)))
230
230
          return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
231
231
        a+=length;
242
242
 
243
243
        if (piks &&
244
244
            (flag= ha_compare_text(keyseg->charset,a,a_length,b,b_length,
245
 
                                   (my_bool) ((nextflag & SEARCH_PREFIX) &&
 
245
                                   (bool) ((nextflag & SEARCH_PREFIX) &&
246
246
                                              next_key_length <= 0),
247
 
                                   (my_bool) ((nextflag & (SEARCH_FIND |
 
247
                                   (bool) ((nextflag & (SEARCH_FIND |
248
248
                                                           SEARCH_UPDATE)) ==
249
249
                                              SEARCH_FIND &&
250
250
                                              ! (keyseg->flag &
265
265
 
266
266
        if (piks &&
267
267
            (flag=compare_bin(a,a_length,b,b_length,
268
 
                              (my_bool) ((nextflag & SEARCH_PREFIX) &&
 
268
                              (bool) ((nextflag & SEARCH_PREFIX) &&
269
269
                                         next_key_length <= 0), 0)))
270
270
          return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
271
271
        a+=a_length;