summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.com>2000-09-13 01:08:34 +0300
committerunknown <monty@donna.mysql.com>2000-09-13 01:08:34 +0300
commit1040f1ac8ec95fcd2f42bc3b4d74d5ee01584e8f (patch)
tree42c131dcc09b3b264d33b14120eaae7687ab2425 /myisam
parentde04a97b613356f19bfbe67856cda64774865832 (diff)
downloadmariadb-git-1040f1ac8ec95fcd2f42bc3b4d74d5ee01584e8f.tar.gz
Fixes for FULLTEXT and TIME type
Docs/manual.texi: Update of Linux notes and mysql_install_db include/my_tree.h: new tree function myisam/ft_parser.c: Fix free() bug myisam/ft_search.c: Fix free() bug myisam/ft_update.c: Fix free() bug scripts/safe_mysqld.sh: Check if we run as root sql-bench/Results-linux/ATIS-mysql-Linux_2.2.13_SMP_alpha: ***MISSING WEAVE*** sql-bench/Results-linux/ATIS-mysql_fast-Linux_2.2.13_SMP_alpha: ***MISSING WEAVE*** sql-bench/Results-linux/RUN-mysql-Linux_2.2.13_SMP_alpha: ***MISSING WEAVE*** sql-bench/Results-linux/RUN-mysql_fast-Linux_2.2.13_SMP_alpha: ***MISSING WEAVE*** sql-bench/Results-linux/alter-table-mysql-Linux_2.2.13_SMP_alpha: ***MISSING WEAVE*** sql-bench/Results-linux/alter-table-mysql_fast-Linux_2.2.13_SMP_alpha: ***MISSING WEAVE*** sql-bench/Results-linux/big-tables-mysql-Linux_2.2.13_SMP_alpha: ***MISSING WEAVE*** sql-bench/Results-linux/big-tables-mysql_fast-Linux_2.2.13_SMP_alpha: ***MISSING WEAVE*** sql-bench/Results-linux/connect-mysql-Linux_2.2.13_SMP_alpha: ***MISSING WEAVE*** sql-bench/Results-linux/connect-mysql_fast-Linux_2.2.13_SMP_alpha: ***MISSING WEAVE*** sql-bench/Results-linux/create-mysql-Linux_2.2.13_SMP_alpha: ***MISSING WEAVE*** sql-bench/Results-linux/create-mysql_fast-Linux_2.2.13_SMP_alpha: ***MISSING WEAVE*** sql-bench/Results-linux/insert-mysql-Linux_2.2.13_SMP_alpha: ***MISSING WEAVE*** sql-bench/Results-linux/insert-mysql_fast-Linux_2.2.13_SMP_alpha: ***MISSING WEAVE*** sql-bench/Results-linux/select-mysql-Linux_2.2.13_SMP_alpha: ***MISSING WEAVE*** sql-bench/Results-linux/select-mysql_fast-Linux_2.2.13_SMP_alpha: ***MISSING WEAVE*** sql-bench/Results-linux/wisconsin-mysql-Linux_2.2.13_SMP_alpha: ***MISSING WEAVE*** sql-bench/Results-linux/wisconsin-mysql_fast-Linux_2.2.13_SMP_alpha: ***MISSING WEAVE*** sql-bench/server-cfg.sh: Added use of OPTIMIZE TABLE sql-bench/test-ATIS.sh: Added use of OPTIMIZE TABLE sql-bench/test-insert.sh: Added use of OPTIMIZE TABLE sql-bench/test-select.sh: Added use of OPTIMIZE TABLE sql-bench/test-wisconsin.sh: Added use of OPTIMIZE TABLE sql/field.cc: Fix TIME type sql/item_func.h: Fixed Free bug
Diffstat (limited to 'myisam')
-rw-r--r--myisam/ft_parser.c24
-rw-r--r--myisam/ft_search.c20
-rw-r--r--myisam/ft_update.c32
3 files changed, 46 insertions, 30 deletions
diff --git a/myisam/ft_parser.c b/myisam/ft_parser.c
index 588f5831dce..22826c68889 100644
--- a/myisam/ft_parser.c
+++ b/myisam/ft_parser.c
@@ -86,8 +86,8 @@ FT_WORD * ft_linearize(MI_INFO *info, uint keynr, byte *keybuf, TREE *wtree)
tree_walk(wtree,(tree_walk_action)&walk_and_copy,&docstat,left_root_right);
}
delete_tree(wtree);
- free(wtree);
- if(wlist==NULL)
+ my_free((char*) wtree,MYF(0));
+ if (wlist==NULL)
return NULL;
docstat.list->pos=NULL;
@@ -127,24 +127,24 @@ TREE * ft_parse(TREE *wtree, byte *doc, int doclen)
byte *end=doc+doclen;
FT_WORD w;
- if(!wtree)
+ if (!wtree)
{
- if(!(wtree=(TREE *)my_malloc(sizeof(TREE),MYF(0)))) return NULL;
+ if (!(wtree=(TREE *)my_malloc(sizeof(TREE),MYF(0)))) return NULL;
init_tree(wtree,0,sizeof(FT_WORD),(qsort_cmp)&FT_WORD_cmp,0,NULL);
}
w.weight=0;
- while(doc<end)
+ while (doc<end)
{
- for(;doc<end;doc++)
- if(word_char(*doc)) break;
- for(w.pos=doc; doc<end; doc++)
- if(!word_char(*doc)) break;
- if((w.len= (uint) (doc-w.pos)) < MIN_WORD_LEN) continue;
- if(!tree_insert(wtree, &w, 0))
+ for (;doc<end;doc++)
+ if (word_char(*doc)) break;
+ for (w.pos=doc; doc<end; doc++)
+ if (!word_char(*doc)) break;
+ if ((w.len= (uint) (doc-w.pos)) < MIN_WORD_LEN) continue;
+ if (!tree_insert(wtree, &w, 0))
{
delete_tree(wtree);
- free(wtree);
+ my_free((char*) wtree,MYF(0));
return NULL;
}
}
diff --git a/myisam/ft_search.c b/myisam/ft_search.c
index 91c63055fef..035e149089f 100644
--- a/myisam/ft_search.c
+++ b/myisam/ft_search.c
@@ -176,17 +176,18 @@ FT_DOCLIST * ft_init_search(void *info, uint keynr, byte *key,
saved_lastpos=aio.info->lastpos;
- if(!(wtree=ft_parse(NULL,key,key_len))) return NULL;
+ if (!(wtree=ft_parse(NULL,key,key_len))) return NULL;
init_tree(&aio.dtree,0,sizeof(FT_SUPERDOC),(qsort_cmp)&FT_SUPERDOC_cmp,0,
- NULL);
+ NULL);
- if(tree_walk(wtree, (tree_walk_action)&walk_and_match, &aio,
- left_root_right))
+ if (tree_walk(wtree, (tree_walk_action)&walk_and_match, &aio,
+ left_root_right))
goto err;
- dlist=(FT_DOCLIST *)my_malloc(sizeof(FT_DOCLIST)+sizeof(FT_DOC)*(aio.dtree.elements_in_tree-1),MYF(0));
- if(!dlist)
+ dlist=(FT_DOCLIST *) my_malloc(sizeof(FT_DOCLIST)+sizeof(FT_DOC)*
+ (aio.dtree.elements_in_tree-1),MYF(0));
+ if (!dlist)
goto err;
dlist->ndocs=aio.dtree.elements_in_tree;
@@ -194,9 +195,10 @@ FT_DOCLIST * ft_init_search(void *info, uint keynr, byte *key,
dlist->info=aio.info;
dptr=dlist->doc;
- tree_walk(&aio.dtree, (tree_walk_action)&walk_and_copy, &dptr, left_root_right);
+ tree_walk(&aio.dtree, (tree_walk_action)&walk_and_copy, &dptr,
+ left_root_right);
- if(presort)
+ if (presort)
{
qsort(dlist->doc, dlist->ndocs, sizeof(FT_DOC), (qsort_cmp)&FT_DOC_cmp);
}
@@ -205,7 +207,7 @@ err:
aio.info->lastpos=saved_lastpos;
delete_tree(&aio.dtree);
delete_tree(wtree);
- free(wtree);
+ my_free((char*) wtree,MYF(0));
return dlist;
}
diff --git a/myisam/ft_update.c b/myisam/ft_update.c
index cff5cb36baa..1c16a77ab5b 100644
--- a/myisam/ft_update.c
+++ b/myisam/ft_update.c
@@ -29,7 +29,8 @@
/* parses a document i.e. calls _mi_ft_parse for every keyseg */
-static FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr, byte *keybuf, const byte *record)
+static FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr, byte *keybuf,
+ const byte *record)
{
TREE *parsed=NULL;
MI_KEYSEG *keyseg;
@@ -62,7 +63,7 @@ static FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr, byte *keybuf, con
len=keyseg->length;
parsed=ft_parse(parsed, pos, len);
- if(parsed==NULL) return NULL;
+ if (parsed==NULL) return NULL;
}
return ft_linearize(info, keynr, keybuf, parsed);
}
@@ -150,23 +151,36 @@ int _mi_ft_cmp(MI_INFO *info, uint keynr, const byte *rec1, const byte *rec2)
}
/* adds a document to the collection */
-int _mi_ft_add(MI_INFO *info, uint keynr, byte *keybuf, const byte *record, my_off_t pos)
+int _mi_ft_add(MI_INFO *info, uint keynr, byte *keybuf, const byte *record,
+ my_off_t pos)
{
+ int error= -1;
FT_WORD *wlist;
- if(!(wlist=_mi_ft_parserecord(info, keynr, keybuf, record))) return -1;
- return _mi_ft_store(info,keynr,keybuf,wlist,pos);
+ if ((wlist=_mi_ft_parserecord(info, keynr, keybuf, record)))
+ {
+ error=_mi_ft_store(info,keynr,keybuf,wlist,pos);
+ my_free((char*) wlist,MYF(0));
+ }
+ return error;
}
/* removes a document from the collection */
-int _mi_ft_del(MI_INFO *info, uint keynr, byte *keybuf, const byte *record, my_off_t pos)
+int _mi_ft_del(MI_INFO *info, uint keynr, byte *keybuf, const byte *record,
+ my_off_t pos)
{
+ int error= -1;
FT_WORD *wlist;
- if(!(wlist=_mi_ft_parserecord(info, keynr, keybuf, record))) return -1;
- return _mi_ft_erase(info,keynr,keybuf,wlist,pos);
+ if ((wlist=_mi_ft_parserecord(info, keynr, keybuf, record)))
+ {
+ error=_mi_ft_erase(info,keynr,keybuf,wlist,pos);
+ my_free((char*) wlist,MYF(0));
+ }
+ return error;
}
-uint _ft_make_key(MI_INFO *info, uint keynr, byte *keybuf, FT_WORD *wptr, my_off_t filepos)
+uint _ft_make_key(MI_INFO *info, uint keynr, byte *keybuf, FT_WORD *wptr,
+ my_off_t filepos)
{
byte buf[HA_FT_MAXLEN+16];