summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <serg@sergbook.mysql.com>2002-06-25 16:32:16 +0200
committerunknown <serg@sergbook.mysql.com>2002-06-25 16:32:16 +0200
commit49f161cf17cb8fefe6bf0ad341e09faae24ac5ba (patch)
tree5aafc6ed30e3f9c1935748942adb550c92a38aac
parent2a32642d8fc8e335016a5c9bc99b82065428645a (diff)
downloadmariadb-git-49f161cf17cb8fefe6bf0ad341e09faae24ac5ba.tar.gz
do not crash on myrg_rprev/myrg_rnext if no current table
(as when previous myrg_rkey failed, e.g. found nothing) myisammrg/myrg_delete.c: style fix myisammrg/myrg_locking.c: style fix myisammrg/myrg_rnext.c: do not crash on rprev/rnext if no current table (as when previous rkey failed, e.g. found nothing) myisammrg/myrg_rprev.c: do not crash on rprev/rnext if no current table (as when previous rkey failed, e.g. found nothing) myisammrg/myrg_rrnd.c: style fix myisammrg/myrg_rsame.c: style fix myisammrg/myrg_update.c: style fix myisammrg/myrg_write.c: style fix
-rw-r--r--myisammrg/myrg_delete.c5
-rw-r--r--myisammrg/myrg_locking.c4
-rw-r--r--myisammrg/myrg_rnext.c3
-rw-r--r--myisammrg/myrg_rprev.c4
-rw-r--r--myisammrg/myrg_rrnd.c2
-rw-r--r--myisammrg/myrg_rsame.c10
-rw-r--r--myisammrg/myrg_update.c3
-rw-r--r--myisammrg/myrg_write.c2
8 files changed, 16 insertions, 17 deletions
diff --git a/myisammrg/myrg_delete.c b/myisammrg/myrg_delete.c
index 94fa9835d3d..7aee0c20793 100644
--- a/myisammrg/myrg_delete.c
+++ b/myisammrg/myrg_delete.c
@@ -23,8 +23,7 @@ MYRG_INFO *info,
const byte *record)
{
if (!info->current_table)
- {
- return(my_errno=HA_ERR_NO_ACTIVE_RECORD);
- }
+ return my_errno=HA_ERR_NO_ACTIVE_RECORD ;
+
return mi_delete(info->current_table->table,record);
}
diff --git a/myisammrg/myrg_locking.c b/myisammrg/myrg_locking.c
index 41c972f72c0..e5a8d3f3d9d 100644
--- a/myisammrg/myrg_locking.c
+++ b/myisammrg/myrg_locking.c
@@ -20,9 +20,7 @@
#include "myrg_def.h"
-int myrg_lock_database(
-MYRG_INFO *info,
-int lock_type)
+int myrg_lock_database(MYRG_INFO *info, int lock_type)
{
int error,new_error;
MYRG_TABLE *file;
diff --git a/myisammrg/myrg_rnext.c b/myisammrg/myrg_rnext.c
index abb9ef95e44..20c73877b77 100644
--- a/myisammrg/myrg_rnext.c
+++ b/myisammrg/myrg_rnext.c
@@ -25,6 +25,9 @@ int myrg_rnext(MYRG_INFO *info, byte *buf, int inx)
int err;
MI_INFO *mi;
+ if (!info->current_table)
+ return HA_ERR_KEY_NOT_FOUND;
+
/* at first, do rnext for the table found before */
if ((err=mi_rnext(info->current_table->table,NULL,inx)))
{
diff --git a/myisammrg/myrg_rprev.c b/myisammrg/myrg_rprev.c
index cb56acd1a73..e6d0283ccb3 100644
--- a/myisammrg/myrg_rprev.c
+++ b/myisammrg/myrg_rprev.c
@@ -25,8 +25,8 @@ int myrg_rprev(MYRG_INFO *info, byte *buf, int inx)
int err;
MI_INFO *mi;
- if (!info || !info->current_table)
- return HA_ERR_UNSUPPORTED;
+ if (!info->current_table)
+ return HA_ERR_KEY_NOT_FOUND;
/* at first, do rprev for the table found before */
if ((err=mi_rprev(info->current_table->table,NULL,inx)))
diff --git a/myisammrg/myrg_rrnd.c b/myisammrg/myrg_rrnd.c
index d50d077e6ba..3e7002c8679 100644
--- a/myisammrg/myrg_rrnd.c
+++ b/myisammrg/myrg_rrnd.c
@@ -24,7 +24,7 @@
static MYRG_TABLE *find_table(MYRG_TABLE *start,MYRG_TABLE *end,ulonglong pos);
/*
- If filepos == HA_OFFSET_ERROR, read next
+ If filepos == HA_OFFSET_ERROR, read next
Returns same as mi_rrnd:
0 = Ok.
HA_ERR_RECORD_DELETED = Record is deleted.
diff --git a/myisammrg/myrg_rsame.c b/myisammrg/myrg_rsame.c
index ddc77f85913..2aa2fd78489 100644
--- a/myisammrg/myrg_rsame.c
+++ b/myisammrg/myrg_rsame.c
@@ -19,12 +19,10 @@
int myrg_rsame(MYRG_INFO *info,byte *record,int inx)
{
if (inx) /* not yet used, should be 0 */
- {
- return(my_errno=HA_ERR_WRONG_INDEX);
- }
+ return my_errno=HA_ERR_WRONG_INDEX;
+
if (!info->current_table)
- {
- return(my_errno=HA_ERR_NO_ACTIVE_RECORD);
- }
+ return my_errno=HA_ERR_NO_ACTIVE_RECORD;
+
return mi_rsame(info->current_table->table,record,inx);
}
diff --git a/myisammrg/myrg_update.c b/myisammrg/myrg_update.c
index cb1b0b51ef9..0d4fc0bf215 100644
--- a/myisammrg/myrg_update.c
+++ b/myisammrg/myrg_update.c
@@ -21,6 +21,7 @@
int myrg_update(register MYRG_INFO *info,const byte *oldrec, byte *newrec)
{
if (!info->current_table)
- return(my_errno=HA_ERR_NO_ACTIVE_RECORD);
+ return my_errno=HA_ERR_NO_ACTIVE_RECORD;
+
return mi_update(info->current_table->table,oldrec,newrec);
}
diff --git a/myisammrg/myrg_write.c b/myisammrg/myrg_write.c
index 4e597005503..f911355aed5 100644
--- a/myisammrg/myrg_write.c
+++ b/myisammrg/myrg_write.c
@@ -26,5 +26,5 @@ int myrg_write(register MYRG_INFO *info, byte *rec)
else if (info->merge_insert_method == MERGE_INSERT_TO_LAST)
return mi_write(info->end_table[-1].table,rec);
else /* unsupported insertion method */
- return (my_errno=HA_ERR_WRONG_COMMAND);
+ return my_errno=HA_ERR_WRONG_COMMAND;
}