~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/queues.cc

  • Committer: jay
  • Date: 2008-12-23 00:18:10 UTC
  • Revision ID: jay@piggy.tangent.org-20081223001810-026ibij22q2842k1
Had a --regex-replace by accident. Should have been --replace_column call.  Only showed up in make test, not running single test, because InnoDB key numbers were different with multiple test running.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
#include "mysys_priv.h"
26
26
#include "mysys_err.h"
27
 
#include <queues.h>
 
27
#include <mysys/queues.h>
 
28
#include <stdlib.h>
28
29
 
29
30
 
30
31
/*
49
50
*/
50
51
 
51
52
int init_queue(QUEUE *queue, uint32_t max_elements, uint32_t offset_to_key,
52
 
               bool max_at_top, int (*compare) (void *, unsigned char *, unsigned char *),
 
53
               bool max_at_top, queue_compare compare,
53
54
               void *first_cmp_arg)
54
55
{
55
 
  if ((queue->root= (unsigned char **) my_malloc((max_elements+1)*sizeof(void*),
56
 
                                         MYF(MY_WME))) == 0)
 
56
  if ((queue->root=
 
57
      (unsigned char **) malloc((max_elements+1)*sizeof(void*))) == 0)
57
58
    return(1);
58
59
  queue->elements=0;
59
60
  queue->compare=compare;
91
92
*/
92
93
 
93
94
int init_queue_ex(QUEUE *queue, uint32_t max_elements, uint32_t offset_to_key,
94
 
               bool max_at_top, int (*compare) (void *, unsigned char *, unsigned char *),
 
95
               bool max_at_top, queue_compare compare,
95
96
               void *first_cmp_arg, uint32_t auto_extent)
96
97
{
97
98
  int ret;
99
100
  if ((ret= init_queue(queue, max_elements, offset_to_key, max_at_top, compare,
100
101
                       first_cmp_arg)))
101
102
    return(ret);
102
 
  
 
103
 
103
104
  queue->auto_extent= auto_extent;
104
105
  return(0);
105
106
}
127
128
*/
128
129
 
129
130
int reinit_queue(QUEUE *queue, uint32_t max_elements, uint32_t offset_to_key,
130
 
                 bool max_at_top, int (*compare) (void *, unsigned char *, unsigned char *),
 
131
                 bool max_at_top, queue_compare compare,
131
132
                 void *first_cmp_arg)
132
133
{
133
134
  queue->elements=0;
162
163
  unsigned char **new_root;
163
164
  if (queue->max_elements == max_elements)
164
165
    return(0);
165
 
  if ((new_root= (unsigned char **) my_realloc((void *)queue->root,
166
 
                                      (max_elements+1)*sizeof(void*),
167
 
                                      MYF(MY_WME))) == 0)
 
166
  if ((new_root=
 
167
         (unsigned char **) realloc(queue->root,
 
168
                                    (max_elements+1)*sizeof(void*))) == 0)
168
169
    return(1);
169
170
  set_if_smaller(queue->elements, max_elements);
170
171
  queue->max_elements= max_elements;
224
225
    0 - OK
225
226
    1 - Cannot allocate more memory
226
227
    2 - auto_extend is 0, the operation would
227
 
  
 
228
 
228
229
*/
229
230
 
230
231
int queue_insert_safe(register QUEUE *queue, unsigned char *element)
237
238
    else if (resize_queue(queue, queue->max_elements + queue->auto_extent))
238
239
      return 1;
239
240
  }
240
 
  
 
241
 
241
242
  queue_insert(queue, element);
242
243
  return 0;
243
244
}
287
288
                        queue->root[next_index+1]+offset_to_key) *
288
289
         queue->max_at_top) > 0)
289
290
      next_index++;
290
 
    if (first && 
 
291
    if (first &&
291
292
        (((queue->compare(queue->first_cmp_arg,
292
293
                          queue->root[next_index]+offset_to_key,
293
294
                          element+offset_to_key) * queue->max_at_top) >= 0)))
510
511
 
511
512
  expected_part= 1;
512
513
  expected_num= 1;
513
 
 
 
514
 
514
515
  if (max_ind)
515
516
    backward_start= 1 << 21;
516
517