MDEV-34348: Fix casts relating to tree_walk_action
Partial commit of the greater MDEV-34348 scope. MDEV-34348: MariaDB is violating clang-16 -Wcast-function-type-strict Reviewed By: ============ Marko Mäkelä <marko.makela@mariadb.com>
This commit is contained in:
parent
5432fa802b
commit
3c785499da
@ -528,7 +528,9 @@ typedef int pbool; /* Mixed prototypes can't take char */
|
|||||||
typedef int pshort; /* Mixed prototypes can't take short int */
|
typedef int pshort; /* Mixed prototypes can't take short int */
|
||||||
typedef double pfloat; /* Mixed prototypes can't take float */
|
typedef double pfloat; /* Mixed prototypes can't take float */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <my_cmp.h>
|
#include <my_cmp.h>
|
||||||
|
|
||||||
#define qsort_t RETQSORTTYPE /* Broken GCC can't handle typedef !!!! */
|
#define qsort_t RETQSORTTYPE /* Broken GCC can't handle typedef !!!! */
|
||||||
#ifdef HAVE_SYS_SOCKET_H
|
#ifdef HAVE_SYS_SOCKET_H
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
@ -1073,10 +1073,10 @@ String *field_decimal::std(String *s, ha_rows rows)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int collect_string(String *element,
|
int collect_string(void *element_, element_count, void *info_)
|
||||||
element_count count __attribute__((unused)),
|
|
||||||
TREE_INFO *info)
|
|
||||||
{
|
{
|
||||||
|
String *element= static_cast<String*>(element_);
|
||||||
|
TREE_INFO *info= static_cast<TREE_INFO*>(info_);
|
||||||
if (info->found)
|
if (info->found)
|
||||||
info->str->append(',');
|
info->str->append(',');
|
||||||
else
|
else
|
||||||
@ -1089,9 +1089,10 @@ int collect_string(String *element,
|
|||||||
} // collect_string
|
} // collect_string
|
||||||
|
|
||||||
|
|
||||||
int collect_real(double *element, element_count count __attribute__((unused)),
|
int collect_real(void *element_, element_count, void *info_)
|
||||||
TREE_INFO *info)
|
|
||||||
{
|
{
|
||||||
|
double *element= static_cast<double*>(element_);
|
||||||
|
TREE_INFO *info= static_cast<TREE_INFO*>(info_);
|
||||||
char buff[MAX_FIELD_WIDTH];
|
char buff[MAX_FIELD_WIDTH];
|
||||||
String s(buff, sizeof(buff),current_thd->charset());
|
String s(buff, sizeof(buff),current_thd->charset());
|
||||||
|
|
||||||
@ -1107,9 +1108,10 @@ int collect_real(double *element, element_count count __attribute__((unused)),
|
|||||||
} // collect_real
|
} // collect_real
|
||||||
|
|
||||||
|
|
||||||
int collect_decimal(uchar *element, element_count count,
|
int collect_decimal(void *element_, element_count count, void *info_)
|
||||||
TREE_INFO *info)
|
|
||||||
{
|
{
|
||||||
|
uchar *element= static_cast<uchar*>(element_);
|
||||||
|
TREE_INFO *info= static_cast<TREE_INFO*>(info_);
|
||||||
char buff[DECIMAL_MAX_STR_LENGTH];
|
char buff[DECIMAL_MAX_STR_LENGTH];
|
||||||
String s(buff, sizeof(buff),&my_charset_bin);
|
String s(buff, sizeof(buff),&my_charset_bin);
|
||||||
|
|
||||||
@ -1126,10 +1128,10 @@ int collect_decimal(uchar *element, element_count count,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int collect_longlong(longlong *element,
|
int collect_longlong(void *element_, element_count, void *info_)
|
||||||
element_count count __attribute__((unused)),
|
|
||||||
TREE_INFO *info)
|
|
||||||
{
|
{
|
||||||
|
longlong *element= static_cast<longlong*>(element_);
|
||||||
|
TREE_INFO *info= static_cast<TREE_INFO*>(info_);
|
||||||
char buff[MAX_FIELD_WIDTH];
|
char buff[MAX_FIELD_WIDTH];
|
||||||
String s(buff, sizeof(buff),&my_charset_bin);
|
String s(buff, sizeof(buff),&my_charset_bin);
|
||||||
|
|
||||||
@ -1145,10 +1147,10 @@ int collect_longlong(longlong *element,
|
|||||||
} // collect_longlong
|
} // collect_longlong
|
||||||
|
|
||||||
|
|
||||||
int collect_ulonglong(ulonglong *element,
|
int collect_ulonglong(void *element_, element_count, void *info_)
|
||||||
element_count count __attribute__((unused)),
|
|
||||||
TREE_INFO *info)
|
|
||||||
{
|
{
|
||||||
|
ulonglong *element= static_cast<ulonglong*>(element_);
|
||||||
|
TREE_INFO *info= static_cast<TREE_INFO*>(info_);
|
||||||
char buff[MAX_FIELD_WIDTH];
|
char buff[MAX_FIELD_WIDTH];
|
||||||
String s(buff, sizeof(buff),&my_charset_bin);
|
String s(buff, sizeof(buff),&my_charset_bin);
|
||||||
|
|
||||||
|
@ -95,9 +95,7 @@ public:
|
|||||||
friend class analyse;
|
friend class analyse;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int collect_string(void *element, element_count count, void *info);
|
||||||
int collect_string(String *element, element_count count,
|
|
||||||
TREE_INFO *info);
|
|
||||||
|
|
||||||
int sortcmp2(void *, const void *a, const void *b);
|
int sortcmp2(void *, const void *a, const void *b);
|
||||||
|
|
||||||
@ -139,15 +137,14 @@ public:
|
|||||||
friend int collect_string(String *element, element_count count,
|
friend int collect_string(String *element, element_count count,
|
||||||
TREE_INFO *info);
|
TREE_INFO *info);
|
||||||
tree_walk_action collect_enum() override
|
tree_walk_action collect_enum() override
|
||||||
{ return (tree_walk_action) collect_string; }
|
{ return collect_string; }
|
||||||
String *std(String *s __attribute__((unused)),
|
String *std(String *s __attribute__((unused)),
|
||||||
ha_rows rows __attribute__((unused))) override
|
ha_rows rows __attribute__((unused))) override
|
||||||
{ return (String*) 0; }
|
{ return (String*) 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int collect_decimal(uchar *element, element_count count,
|
int collect_decimal(void *element, element_count count, void *info);
|
||||||
TREE_INFO *info);
|
|
||||||
|
|
||||||
class field_decimal :public field_info
|
class field_decimal :public field_info
|
||||||
{
|
{
|
||||||
@ -171,12 +168,12 @@ public:
|
|||||||
friend int collect_decimal(uchar *element, element_count count,
|
friend int collect_decimal(uchar *element, element_count count,
|
||||||
TREE_INFO *info);
|
TREE_INFO *info);
|
||||||
tree_walk_action collect_enum() override
|
tree_walk_action collect_enum() override
|
||||||
{ return (tree_walk_action) collect_decimal; }
|
{ return collect_decimal; }
|
||||||
String *std(String *s, ha_rows rows) override;
|
String *std(String *s, ha_rows rows) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int collect_real(double *element, element_count count, TREE_INFO *info);
|
int collect_real(void *element, element_count count, void *info);
|
||||||
|
|
||||||
class field_real: public field_info
|
class field_real: public field_info
|
||||||
{
|
{
|
||||||
@ -229,11 +226,10 @@ public:
|
|||||||
friend int collect_real(double *element, element_count count,
|
friend int collect_real(double *element, element_count count,
|
||||||
TREE_INFO *info);
|
TREE_INFO *info);
|
||||||
tree_walk_action collect_enum() override
|
tree_walk_action collect_enum() override
|
||||||
{ return (tree_walk_action) collect_real;}
|
{ return collect_real;}
|
||||||
};
|
};
|
||||||
|
|
||||||
int collect_longlong(longlong *element, element_count count,
|
int collect_longlong(void *element, element_count count, void *info);
|
||||||
TREE_INFO *info);
|
|
||||||
|
|
||||||
class field_longlong: public field_info
|
class field_longlong: public field_info
|
||||||
{
|
{
|
||||||
@ -276,11 +272,10 @@ public:
|
|||||||
friend int collect_longlong(longlong *element, element_count count,
|
friend int collect_longlong(longlong *element, element_count count,
|
||||||
TREE_INFO *info);
|
TREE_INFO *info);
|
||||||
tree_walk_action collect_enum() override
|
tree_walk_action collect_enum() override
|
||||||
{ return (tree_walk_action) collect_longlong;}
|
{ return collect_longlong;}
|
||||||
};
|
};
|
||||||
|
|
||||||
int collect_ulonglong(ulonglong *element, element_count count,
|
int collect_ulonglong(void *element, element_count count, void *info);
|
||||||
TREE_INFO *info);
|
|
||||||
|
|
||||||
class field_ulonglong: public field_info
|
class field_ulonglong: public field_info
|
||||||
{
|
{
|
||||||
@ -324,7 +319,7 @@ public:
|
|||||||
friend int collect_ulonglong(ulonglong *element, element_count count,
|
friend int collect_ulonglong(ulonglong *element, element_count count,
|
||||||
TREE_INFO *info);
|
TREE_INFO *info);
|
||||||
tree_walk_action collect_enum() override
|
tree_walk_action collect_enum() override
|
||||||
{ return (tree_walk_action) collect_ulonglong; }
|
{ return collect_ulonglong; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,8 +40,10 @@
|
|||||||
#include "uniques.h" // Unique
|
#include "uniques.h" // Unique
|
||||||
#include "sql_sort.h"
|
#include "sql_sort.h"
|
||||||
|
|
||||||
int unique_write_to_file(uchar* key, element_count count, Unique *unique)
|
int unique_write_to_file(void* key_, element_count, void *unique_)
|
||||||
{
|
{
|
||||||
|
uchar *key= static_cast<uchar *>(key_);
|
||||||
|
Unique *unique= static_cast<Unique *>(unique_);
|
||||||
/*
|
/*
|
||||||
Use unique->size (size of element stored in the tree) and not
|
Use unique->size (size of element stored in the tree) and not
|
||||||
unique->tree.size_of_element. The latter is different from unique->size
|
unique->tree.size_of_element. The latter is different from unique->size
|
||||||
@ -51,21 +53,30 @@ int unique_write_to_file(uchar* key, element_count count, Unique *unique)
|
|||||||
return my_b_write(&unique->file, key, unique->size) ? 1 : 0;
|
return my_b_write(&unique->file, key, unique->size) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int unique_write_to_file_with_count(uchar* key, element_count count, Unique *unique)
|
int unique_write_to_file_with_count(void* key_, element_count count, void *unique_)
|
||||||
{
|
{
|
||||||
|
uchar *key= static_cast<uchar *>(key_);
|
||||||
|
Unique *unique= static_cast<Unique *>(unique_);
|
||||||
return my_b_write(&unique->file, key, unique->size) ||
|
return my_b_write(&unique->file, key, unique->size) ||
|
||||||
my_b_write(&unique->file, (uchar*)&count, sizeof(element_count)) ? 1 : 0;
|
my_b_write(&unique->file, reinterpret_cast<uchar *>(&count),
|
||||||
|
sizeof(element_count))
|
||||||
|
? 1
|
||||||
|
: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int unique_write_to_ptrs(uchar* key, element_count count, Unique *unique)
|
int unique_write_to_ptrs(void* key_, element_count, void *unique_)
|
||||||
{
|
{
|
||||||
|
uchar *key= static_cast<uchar *>(key_);
|
||||||
|
Unique *unique= static_cast<Unique *>(unique_);
|
||||||
memcpy(unique->sort.record_pointers, key, unique->size);
|
memcpy(unique->sort.record_pointers, key, unique->size);
|
||||||
unique->sort.record_pointers+=unique->size;
|
unique->sort.record_pointers+=unique->size;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int unique_intersect_write_to_ptrs(uchar* key, element_count count, Unique *unique)
|
int unique_intersect_write_to_ptrs(void* key_, element_count count, void *unique_)
|
||||||
{
|
{
|
||||||
|
uchar *key= static_cast<uchar *>(key_);
|
||||||
|
Unique *unique= static_cast<Unique *>(unique_);
|
||||||
if (count >= unique->min_dupl_count)
|
if (count >= unique->min_dupl_count)
|
||||||
{
|
{
|
||||||
memcpy(unique->sort.record_pointers, key, unique->size);
|
memcpy(unique->sort.record_pointers, key, unique->size);
|
||||||
@ -383,8 +394,8 @@ bool Unique::flush()
|
|||||||
file_ptr.set_file_position(my_b_tell(&file));
|
file_ptr.set_file_position(my_b_tell(&file));
|
||||||
|
|
||||||
tree_walk_action action= min_dupl_count ?
|
tree_walk_action action= min_dupl_count ?
|
||||||
(tree_walk_action) unique_write_to_file_with_count :
|
unique_write_to_file_with_count :
|
||||||
(tree_walk_action) unique_write_to_file;
|
unique_write_to_file;
|
||||||
if (tree_walk(&tree, action,
|
if (tree_walk(&tree, action,
|
||||||
(void*) this, left_root_right) ||
|
(void*) this, left_root_right) ||
|
||||||
insert_dynamic(&file_ptrs, (uchar*) &file_ptr))
|
insert_dynamic(&file_ptrs, (uchar*) &file_ptr))
|
||||||
@ -800,8 +811,8 @@ bool Unique::get(TABLE *table)
|
|||||||
{
|
{
|
||||||
uchar *save_record_pointers= sort.record_pointers;
|
uchar *save_record_pointers= sort.record_pointers;
|
||||||
tree_walk_action action= min_dupl_count ?
|
tree_walk_action action= min_dupl_count ?
|
||||||
(tree_walk_action) unique_intersect_write_to_ptrs :
|
unique_intersect_write_to_ptrs :
|
||||||
(tree_walk_action) unique_write_to_ptrs;
|
unique_write_to_ptrs;
|
||||||
filtered_out_elems= 0;
|
filtered_out_elems= 0;
|
||||||
(void) tree_walk(&tree, action,
|
(void) tree_walk(&tree, action,
|
||||||
this, left_root_right);
|
this, left_root_right);
|
||||||
|
@ -98,13 +98,13 @@ public:
|
|||||||
uint get_size() const { return size; }
|
uint get_size() const { return size; }
|
||||||
size_t get_max_in_memory_size() const { return max_in_memory_size; }
|
size_t get_max_in_memory_size() const { return max_in_memory_size; }
|
||||||
|
|
||||||
friend int unique_write_to_file(uchar* key, element_count count, Unique *unique);
|
friend int unique_write_to_file(void* key, element_count count, void *unique);
|
||||||
friend int unique_write_to_ptrs(uchar* key, element_count count, Unique *unique);
|
friend int unique_write_to_ptrs(void* key, element_count count, void *unique);
|
||||||
|
|
||||||
friend int unique_write_to_file_with_count(uchar* key, element_count count,
|
friend int unique_write_to_file_with_count(void *key, element_count count,
|
||||||
Unique *unique);
|
void *unique);
|
||||||
friend int unique_intersect_write_to_ptrs(uchar* key, element_count count,
|
friend int unique_intersect_write_to_ptrs(void *key, element_count count,
|
||||||
Unique *unique);
|
void *unique);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* UNIQUE_INCLUDED */
|
#endif /* UNIQUE_INCLUDED */
|
||||||
|
@ -148,8 +148,7 @@ static HUFF_TREE* make_huff_trees(HUFF_COUNTS *huff_counts,uint trees);
|
|||||||
static int make_huff_tree(HUFF_TREE *tree,HUFF_COUNTS *huff_counts);
|
static int make_huff_tree(HUFF_TREE *tree,HUFF_COUNTS *huff_counts);
|
||||||
static int compare_huff_elements(void *not_used, const void *a,
|
static int compare_huff_elements(void *not_used, const void *a,
|
||||||
const void *b);
|
const void *b);
|
||||||
static int save_counts_in_queue(uchar *key,element_count count,
|
static int save_counts_in_queue(void *key, element_count count, void *tree);
|
||||||
HUFF_TREE *tree);
|
|
||||||
static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts,uint flag);
|
static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts,uint flag);
|
||||||
static uint join_same_trees(HUFF_COUNTS *huff_counts,uint trees);
|
static uint join_same_trees(HUFF_COUNTS *huff_counts,uint trees);
|
||||||
static int make_huff_decode_table(HUFF_TREE *huff_tree,uint trees);
|
static int make_huff_decode_table(HUFF_TREE *huff_tree,uint trees);
|
||||||
@ -1806,9 +1805,10 @@ static int compare_tree(void *cmp_arg __attribute__((unused)), const void *s_,
|
|||||||
0
|
0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int save_counts_in_queue(uchar *key, element_count count,
|
static int save_counts_in_queue(void *key_, element_count count, void *tree_)
|
||||||
HUFF_TREE *tree)
|
|
||||||
{
|
{
|
||||||
|
uchar *key= key_;
|
||||||
|
HUFF_TREE *tree= tree_;
|
||||||
HUFF_ELEMENT *new_huff_el;
|
HUFF_ELEMENT *new_huff_el;
|
||||||
|
|
||||||
new_huff_el=tree->element_buffer+(tree->elements++);
|
new_huff_el=tree->element_buffer+(tree->elements++);
|
||||||
|
@ -64,8 +64,10 @@ static int FT_SUPERDOC_cmp(void *cmp_arg __attribute__((unused)),
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
|
static int walk_and_match(void *word_, element_count count, void *aio_)
|
||||||
{
|
{
|
||||||
|
FT_WORD *word= word_;
|
||||||
|
ALL_IN_ONE *aio= aio_;
|
||||||
FT_WEIGTH subkeys;
|
FT_WEIGTH subkeys;
|
||||||
int r;
|
int r;
|
||||||
uint doc_cnt;
|
uint doc_cnt;
|
||||||
@ -188,9 +190,11 @@ do_skip:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int walk_and_copy(FT_SUPERDOC *from,
|
static int walk_and_copy(void *from_, uint32 count __attribute__((unused)),
|
||||||
uint32 count __attribute__((unused)), FT_DOC **to)
|
void *to_)
|
||||||
{
|
{
|
||||||
|
FT_SUPERDOC *from= from_;
|
||||||
|
FT_DOC **to= to_;
|
||||||
DBUG_ENTER("walk_and_copy");
|
DBUG_ENTER("walk_and_copy");
|
||||||
from->doc.weight+=from->tmp_weight*from->word_ptr->weight;
|
from->doc.weight+=from->tmp_weight*from->word_ptr->weight;
|
||||||
(*to)->dpos=from->doc.dpos;
|
(*to)->dpos=from->doc.dpos;
|
||||||
@ -199,9 +203,13 @@ static int walk_and_copy(FT_SUPERDOC *from,
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int walk_and_push(FT_SUPERDOC *from,
|
static int walk_and_push(void *from_,
|
||||||
uint32 count __attribute__((unused)), QUEUE *best)
|
element_count count __attribute__((unused)),
|
||||||
|
void *best_)
|
||||||
{
|
{
|
||||||
|
FT_SUPERDOC *from= from_;
|
||||||
|
QUEUE *best= best_;
|
||||||
|
|
||||||
DBUG_ENTER("walk_and_copy");
|
DBUG_ENTER("walk_and_copy");
|
||||||
from->doc.weight+=from->tmp_weight*from->word_ptr->weight;
|
from->doc.weight+=from->tmp_weight*from->word_ptr->weight;
|
||||||
set_if_smaller(best->elements, ft_query_expansion_limit-1);
|
set_if_smaller(best->elements, ft_query_expansion_limit-1);
|
||||||
@ -257,7 +265,7 @@ FT_INFO *maria_ft_init_nlq_search(MARIA_HA *info, uint keynr, uchar *query,
|
|||||||
&wtree.mem_root))
|
&wtree.mem_root))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if (tree_walk(&wtree, (tree_walk_action)&walk_and_match, &aio,
|
if (tree_walk(&wtree, &walk_and_match, &aio,
|
||||||
left_root_right))
|
left_root_right))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
@ -265,7 +273,7 @@ FT_INFO *maria_ft_init_nlq_search(MARIA_HA *info, uint keynr, uchar *query,
|
|||||||
{
|
{
|
||||||
QUEUE best;
|
QUEUE best;
|
||||||
init_queue(&best, ft_query_expansion_limit, 0, 0, &FT_DOC_cmp, 0, 0, 0);
|
init_queue(&best, ft_query_expansion_limit, 0, 0, &FT_DOC_cmp, 0, 0, 0);
|
||||||
tree_walk(&aio.dtree, (tree_walk_action) &walk_and_push,
|
tree_walk(&aio.dtree, &walk_and_push,
|
||||||
&best, left_root_right);
|
&best, left_root_right);
|
||||||
while (best.elements)
|
while (best.elements)
|
||||||
{
|
{
|
||||||
@ -284,7 +292,7 @@ FT_INFO *maria_ft_init_nlq_search(MARIA_HA *info, uint keynr, uchar *query,
|
|||||||
}
|
}
|
||||||
delete_queue(&best);
|
delete_queue(&best);
|
||||||
reset_tree(&aio.dtree);
|
reset_tree(&aio.dtree);
|
||||||
if (tree_walk(&wtree, (tree_walk_action)&walk_and_match, &aio,
|
if (tree_walk(&wtree, &walk_and_match, &aio,
|
||||||
left_root_right))
|
left_root_right))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
@ -307,7 +315,7 @@ FT_INFO *maria_ft_init_nlq_search(MARIA_HA *info, uint keynr, uchar *query,
|
|||||||
dlist->info=aio.info;
|
dlist->info=aio.info;
|
||||||
dptr=dlist->doc;
|
dptr=dlist->doc;
|
||||||
|
|
||||||
tree_walk(&aio.dtree, (tree_walk_action) &walk_and_copy,
|
tree_walk(&aio.dtree, &walk_and_copy,
|
||||||
&dptr, left_root_right);
|
&dptr, left_root_right);
|
||||||
|
|
||||||
if (flags & FT_SORTED)
|
if (flags & FT_SORTED)
|
||||||
|
@ -40,8 +40,11 @@ static int FT_WORD_cmp(void *cs_, const void *w1_, const void *w2_)
|
|||||||
return ha_compare_word(cs, w1->pos, w1->len, w2->pos, w2->len);
|
return ha_compare_word(cs, w1->pos, w1->len, w2->pos, w2->len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int walk_and_copy(FT_WORD *word,uint32 count,FT_DOCSTAT *docstat)
|
|
||||||
|
static int walk_and_copy(void *word_, element_count count, void *docstat_)
|
||||||
{
|
{
|
||||||
|
FT_WORD *word= word_;
|
||||||
|
FT_DOCSTAT *docstat= docstat_;
|
||||||
word->weight=LWS_IN_USE;
|
word->weight=LWS_IN_USE;
|
||||||
docstat->sum+=word->weight;
|
docstat->sum+=word->weight;
|
||||||
memcpy((docstat->list)++, word, sizeof(FT_WORD));
|
memcpy((docstat->list)++, word, sizeof(FT_WORD));
|
||||||
@ -62,7 +65,7 @@ FT_WORD * maria_ft_linearize(TREE *wtree, MEM_ROOT *mem_root)
|
|||||||
docstat.list=wlist;
|
docstat.list=wlist;
|
||||||
docstat.uniq=wtree->elements_in_tree;
|
docstat.uniq=wtree->elements_in_tree;
|
||||||
docstat.sum=0;
|
docstat.sum=0;
|
||||||
tree_walk(wtree,(tree_walk_action)&walk_and_copy,&docstat,left_root_right);
|
tree_walk(wtree,&walk_and_copy,&docstat,left_root_right);
|
||||||
}
|
}
|
||||||
delete_tree(wtree, 0);
|
delete_tree(wtree, 0);
|
||||||
if (!wlist)
|
if (!wlist)
|
||||||
|
@ -62,8 +62,10 @@ static int FT_SUPERDOC_cmp(void *cmp_arg __attribute__((unused)),
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
|
static int walk_and_match(void *word_, element_count count, void *aio_)
|
||||||
{
|
{
|
||||||
|
FT_WORD *word= word_;
|
||||||
|
ALL_IN_ONE *aio= aio_;
|
||||||
FT_WEIGTH subkeys;
|
FT_WEIGTH subkeys;
|
||||||
int r;
|
int r;
|
||||||
uint keylen, doc_cnt;
|
uint keylen, doc_cnt;
|
||||||
@ -185,9 +187,11 @@ do_skip:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int walk_and_copy(FT_SUPERDOC *from,
|
static int walk_and_copy(void *from_, uint32 count __attribute__((unused)),
|
||||||
uint32 count __attribute__((unused)), FT_DOC **to)
|
void *to_)
|
||||||
{
|
{
|
||||||
|
FT_SUPERDOC *from= from_;
|
||||||
|
FT_DOC **to= to_;
|
||||||
DBUG_ENTER("walk_and_copy");
|
DBUG_ENTER("walk_and_copy");
|
||||||
from->doc.weight+=from->tmp_weight*from->word_ptr->weight;
|
from->doc.weight+=from->tmp_weight*from->word_ptr->weight;
|
||||||
(*to)->dpos=from->doc.dpos;
|
(*to)->dpos=from->doc.dpos;
|
||||||
@ -196,9 +200,12 @@ static int walk_and_copy(FT_SUPERDOC *from,
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int walk_and_push(FT_SUPERDOC *from,
|
static int walk_and_push(void *from_,
|
||||||
uint32 count __attribute__((unused)), QUEUE *best)
|
element_count count __attribute__((unused)),
|
||||||
|
void *best_)
|
||||||
{
|
{
|
||||||
|
FT_SUPERDOC *from= from_;
|
||||||
|
QUEUE *best= best_;
|
||||||
DBUG_ENTER("walk_and_copy");
|
DBUG_ENTER("walk_and_copy");
|
||||||
from->doc.weight+=from->tmp_weight*from->word_ptr->weight;
|
from->doc.weight+=from->tmp_weight*from->word_ptr->weight;
|
||||||
set_if_smaller(best->elements, ft_query_expansion_limit-1);
|
set_if_smaller(best->elements, ft_query_expansion_limit-1);
|
||||||
@ -253,7 +260,7 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, uchar *query,
|
|||||||
&wtree.mem_root))
|
&wtree.mem_root))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if (tree_walk(&wtree, (tree_walk_action)&walk_and_match, &aio,
|
if (tree_walk(&wtree, &walk_and_match, &aio,
|
||||||
left_root_right))
|
left_root_right))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
@ -261,7 +268,7 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, uchar *query,
|
|||||||
{
|
{
|
||||||
QUEUE best;
|
QUEUE best;
|
||||||
init_queue(&best, ft_query_expansion_limit, 0, 0, &FT_DOC_cmp, 0, 0, 0);
|
init_queue(&best, ft_query_expansion_limit, 0, 0, &FT_DOC_cmp, 0, 0, 0);
|
||||||
tree_walk(&aio.dtree, (tree_walk_action) &walk_and_push,
|
tree_walk(&aio.dtree, &walk_and_push,
|
||||||
&best, left_root_right);
|
&best, left_root_right);
|
||||||
while (best.elements)
|
while (best.elements)
|
||||||
{
|
{
|
||||||
@ -280,7 +287,7 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, uchar *query,
|
|||||||
}
|
}
|
||||||
delete_queue(&best);
|
delete_queue(&best);
|
||||||
reset_tree(&aio.dtree);
|
reset_tree(&aio.dtree);
|
||||||
if (tree_walk(&wtree, (tree_walk_action)&walk_and_match, &aio,
|
if (tree_walk(&wtree, &walk_and_match, &aio,
|
||||||
left_root_right))
|
left_root_right))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
@ -303,7 +310,7 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, uchar *query,
|
|||||||
dlist->info=aio.info;
|
dlist->info=aio.info;
|
||||||
dptr=dlist->doc;
|
dptr=dlist->doc;
|
||||||
|
|
||||||
tree_walk(&aio.dtree, (tree_walk_action) &walk_and_copy,
|
tree_walk(&aio.dtree, &walk_and_copy,
|
||||||
&dptr, left_root_right);
|
&dptr, left_root_right);
|
||||||
|
|
||||||
if (flags & FT_SORTED)
|
if (flags & FT_SORTED)
|
||||||
|
@ -37,8 +37,10 @@ static int FT_WORD_cmp(void *cs_, const void *w1_, const void *w2_)
|
|||||||
return ha_compare_word(cs, w1->pos, w1->len, w2->pos, w2->len);
|
return ha_compare_word(cs, w1->pos, w1->len, w2->pos, w2->len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int walk_and_copy(FT_WORD *word,uint32 count,FT_DOCSTAT *docstat)
|
static int walk_and_copy(void *word_, element_count count, void *docstat_)
|
||||||
{
|
{
|
||||||
|
FT_WORD *word= word_;
|
||||||
|
FT_DOCSTAT *docstat= docstat_;
|
||||||
word->weight=LWS_IN_USE;
|
word->weight=LWS_IN_USE;
|
||||||
docstat->sum+=word->weight;
|
docstat->sum+=word->weight;
|
||||||
memcpy((docstat->list)++, word, sizeof(FT_WORD));
|
memcpy((docstat->list)++, word, sizeof(FT_WORD));
|
||||||
@ -59,7 +61,7 @@ FT_WORD * ft_linearize(TREE *wtree, MEM_ROOT *mem_root)
|
|||||||
docstat.list=wlist;
|
docstat.list=wlist;
|
||||||
docstat.uniq=wtree->elements_in_tree;
|
docstat.uniq=wtree->elements_in_tree;
|
||||||
docstat.sum=0;
|
docstat.sum=0;
|
||||||
tree_walk(wtree,(tree_walk_action)&walk_and_copy,&docstat,left_root_right);
|
tree_walk(wtree,&walk_and_copy,&docstat,left_root_right);
|
||||||
}
|
}
|
||||||
delete_tree(wtree, 0);
|
delete_tree(wtree, 0);
|
||||||
if (!wlist)
|
if (!wlist)
|
||||||
|
@ -39,9 +39,10 @@ static int FT_STOPWORD_cmp(void *cmp_arg __attribute__((unused)),
|
|||||||
(uchar *) w2->pos, w2->len);
|
(uchar *) w2->pos, w2->len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int FT_STOPWORD_free(FT_STOPWORD *w, TREE_FREE action,
|
static int FT_STOPWORD_free(void *w_, TREE_FREE action,
|
||||||
void *arg __attribute__((unused)))
|
void *arg __attribute__((unused)))
|
||||||
{
|
{
|
||||||
|
FT_STOPWORD *w= w_;
|
||||||
if (action == free_free)
|
if (action == free_free)
|
||||||
my_free((void*)w->pos);
|
my_free((void*)w->pos);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -452,8 +452,10 @@ my_bool mi_check_status(void *param)
|
|||||||
structure.
|
structure.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void mi_fix_status(MI_INFO *org_table, MI_INFO *new_table)
|
void mi_fix_status(void *ord_table_, void *new_table_)
|
||||||
{
|
{
|
||||||
|
MI_INFO *org_table= ord_table_;
|
||||||
|
MI_INFO *new_table= new_table_;
|
||||||
DBUG_ENTER("mi_fix_status");
|
DBUG_ENTER("mi_fix_status");
|
||||||
if (!new_table)
|
if (!new_table)
|
||||||
{
|
{
|
||||||
|
@ -731,7 +731,7 @@ void mi_update_status(void *param);
|
|||||||
void mi_restore_status(void *param);
|
void mi_restore_status(void *param);
|
||||||
void mi_copy_status(void *to, void *from);
|
void mi_copy_status(void *to, void *from);
|
||||||
my_bool mi_check_status(void *param);
|
my_bool mi_check_status(void *param);
|
||||||
void mi_fix_status(MI_INFO *org_table, MI_INFO *new_table);
|
void mi_fix_status(void *org_table, void *new_table);
|
||||||
extern MI_INFO *test_if_reopen(char *filename);
|
extern MI_INFO *test_if_reopen(char *filename);
|
||||||
my_bool check_table_is_closed(const char *name, const char *where);
|
my_bool check_table_is_closed(const char *name, const char *where);
|
||||||
int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share);
|
int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share);
|
||||||
|
@ -58,11 +58,10 @@ static void get_options(int *argc,char ***argv);
|
|||||||
static int examine_log(char * file_name,char **table_names);
|
static int examine_log(char * file_name,char **table_names);
|
||||||
static int read_string(IO_CACHE *file,uchar* *to,uint length);
|
static int read_string(IO_CACHE *file,uchar* *to,uint length);
|
||||||
static int file_info_compare(void *cmp_arg, const void *a, const void *b);
|
static int file_info_compare(void *cmp_arg, const void *a, const void *b);
|
||||||
static int test_if_open(struct file_info *key,element_count count,
|
static int test_if_open(void *key, element_count count, void *param);
|
||||||
struct test_if_open_param *param);
|
|
||||||
static void fix_blob_pointers(MI_INFO *isam,uchar *record);
|
static void fix_blob_pointers(MI_INFO *isam,uchar *record);
|
||||||
static int test_when_accessed(struct file_info *key,element_count count,
|
static int test_when_accessed(void *key, element_count count,
|
||||||
struct st_access_param *access_param);
|
void *access_param);
|
||||||
static int file_info_free(void*, TREE_FREE, void *);
|
static int file_info_free(void*, TREE_FREE, void *);
|
||||||
static int close_some_file(TREE *tree);
|
static int close_some_file(TREE *tree);
|
||||||
static int reopen_closed_file(TREE *tree,struct file_info *file_info);
|
static int reopen_closed_file(TREE *tree,struct file_info *file_info);
|
||||||
@ -411,7 +410,7 @@ static int examine_log(char * file_name, char **table_names)
|
|||||||
}
|
}
|
||||||
open_param.name=file_info.name;
|
open_param.name=file_info.name;
|
||||||
open_param.max_id=0;
|
open_param.max_id=0;
|
||||||
(void) tree_walk(&tree,(tree_walk_action) test_if_open,(void*) &open_param,
|
(void) tree_walk(&tree, test_if_open,(void*) &open_param,
|
||||||
left_root_right);
|
left_root_right);
|
||||||
file_info.id=open_param.max_id+1;
|
file_info.id=open_param.max_id+1;
|
||||||
/*
|
/*
|
||||||
@ -709,10 +708,12 @@ static int file_info_compare(void *cmp_arg __attribute__((unused)),
|
|||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
|
|
||||||
static int test_if_open (struct file_info *key,
|
static int test_if_open (void *key_,
|
||||||
element_count count __attribute__((unused)),
|
element_count count __attribute__((unused)),
|
||||||
struct test_if_open_param *param)
|
void *param_)
|
||||||
{
|
{
|
||||||
|
struct file_info *key= key_;
|
||||||
|
struct test_if_open_param *param= param_;
|
||||||
if (!strcmp(key->name,param->name) && key->id > param->max_id)
|
if (!strcmp(key->name,param->name) && key->id > param->max_id)
|
||||||
param->max_id=key->id;
|
param->max_id=key->id;
|
||||||
return 0;
|
return 0;
|
||||||
@ -737,10 +738,12 @@ static void fix_blob_pointers(MI_INFO *info, uchar *record)
|
|||||||
/* close the file with hasn't been accessed for the longest time */
|
/* close the file with hasn't been accessed for the longest time */
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
|
|
||||||
static int test_when_accessed (struct file_info *key,
|
static int test_when_accessed (void *key_,
|
||||||
element_count count __attribute__((unused)),
|
element_count count __attribute__((unused)),
|
||||||
struct st_access_param *access_param)
|
void *access_param_)
|
||||||
{
|
{
|
||||||
|
struct file_info *key= key_;
|
||||||
|
struct st_access_param *access_param= access_param_;
|
||||||
if (key->accessed < access_param->min_accessed && ! key->closed)
|
if (key->accessed < access_param->min_accessed && ! key->closed)
|
||||||
{
|
{
|
||||||
access_param->min_accessed=key->accessed;
|
access_param->min_accessed=key->accessed;
|
||||||
@ -776,7 +779,7 @@ static int close_some_file(TREE *tree)
|
|||||||
access_param.min_accessed=LONG_MAX;
|
access_param.min_accessed=LONG_MAX;
|
||||||
access_param.found=0;
|
access_param.found=0;
|
||||||
|
|
||||||
(void) tree_walk(tree,(tree_walk_action) test_when_accessed,
|
(void) tree_walk(tree, test_when_accessed,
|
||||||
(void*) &access_param,left_root_right);
|
(void*) &access_param,left_root_right);
|
||||||
if (!access_param.found)
|
if (!access_param.found)
|
||||||
return 1; /* No open file that is possibly to close */
|
return 1; /* No open file that is possibly to close */
|
||||||
|
@ -143,8 +143,8 @@ static int test_space_compress(HUFF_COUNTS *huff_counts,my_off_t records,
|
|||||||
static HUFF_TREE* make_huff_trees(HUFF_COUNTS *huff_counts,uint trees);
|
static HUFF_TREE* make_huff_trees(HUFF_COUNTS *huff_counts,uint trees);
|
||||||
static int make_huff_tree(HUFF_TREE *tree,HUFF_COUNTS *huff_counts);
|
static int make_huff_tree(HUFF_TREE *tree,HUFF_COUNTS *huff_counts);
|
||||||
static int compare_huff_elements(void *not_used, const void *a, const void *b);
|
static int compare_huff_elements(void *not_used, const void *a, const void *b);
|
||||||
static int save_counts_in_queue(uchar *key,element_count count,
|
static int save_counts_in_queue(void *key, element_count count,
|
||||||
HUFF_TREE *tree);
|
void *tree);
|
||||||
static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts,uint flag);
|
static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts,uint flag);
|
||||||
static uint join_same_trees(HUFF_COUNTS *huff_counts,uint trees);
|
static uint join_same_trees(HUFF_COUNTS *huff_counts,uint trees);
|
||||||
static int make_huff_decode_table(HUFF_TREE *huff_tree,uint trees);
|
static int make_huff_decode_table(HUFF_TREE *huff_tree,uint trees);
|
||||||
@ -1728,9 +1728,10 @@ static int compare_tree(void *cmp_arg __attribute__((unused)), const void *s_,
|
|||||||
0
|
0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int save_counts_in_queue(uchar *key, element_count count,
|
static int save_counts_in_queue(void *key_, element_count count, void *tree_)
|
||||||
HUFF_TREE *tree)
|
|
||||||
{
|
{
|
||||||
|
uchar *key= key_;
|
||||||
|
HUFF_TREE *tree= tree_;
|
||||||
HUFF_ELEMENT *new_huff_el;
|
HUFF_ELEMENT *new_huff_el;
|
||||||
|
|
||||||
new_huff_el=tree->element_buffer+(tree->elements++);
|
new_huff_el=tree->element_buffer+(tree->elements++);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user