diff options
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/charset.c | 1 | ||||
-rw-r--r-- | mysys/errors.c | 2 | ||||
-rw-r--r-- | mysys/lf_alloc-pin.c | 9 | ||||
-rw-r--r-- | mysys/ma_dyncol.c | 2 | ||||
-rw-r--r-- | mysys/mf_iocache2.c | 2 | ||||
-rw-r--r-- | mysys/mf_keycache.c | 2 | ||||
-rw-r--r-- | mysys/my_compare.c | 18 | ||||
-rw-r--r-- | mysys/my_default.c | 2 | ||||
-rw-r--r-- | mysys/my_delete.c | 2 | ||||
-rw-r--r-- | mysys/my_error.c | 18 | ||||
-rw-r--r-- | mysys/my_lock.c | 4 |
11 files changed, 30 insertions, 32 deletions
diff --git a/mysys/charset.c b/mysys/charset.c index ad3eb78ae0e..3c134dc388e 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -545,6 +545,7 @@ static void init_available_charsets(void) { if (*cs) { + DBUG_ASSERT(cs[0]->mbmaxlen <= MY_CS_MBMAXLEN); if (cs[0]->ctype) if (init_state_maps(*cs)) *cs= NULL; diff --git a/mysys/errors.c b/mysys/errors.c index 11e7d04e79e..e3fbfd4d8e6 100644 --- a/mysys/errors.c +++ b/mysys/errors.c @@ -119,7 +119,7 @@ void wait_for_free_space(const char *filename, int errors) (void) sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC); } -const char **get_global_errmsgs() +const char **get_global_errmsgs(int nr __attribute__((unused))) { return globerrs; } diff --git a/mysys/lf_alloc-pin.c b/mysys/lf_alloc-pin.c index f8a15829fb1..b349ef88ed1 100644 --- a/mysys/lf_alloc-pin.c +++ b/mysys/lf_alloc-pin.c @@ -103,6 +103,12 @@ #include <my_sys.h> #include <lf.h> +/* + when using alloca() leave at least that many bytes of the stack - + for functions we might be calling from within this stack frame +*/ +#define ALLOCA_SAFETY_MARGIN 8192 + #define LF_PINBOX_MAX_PINS 65536 static void lf_pinbox_real_free(LF_PINS *pins); @@ -345,7 +351,8 @@ static void lf_pinbox_real_free(LF_PINS *pins) { int alloca_size= sizeof(void *)*LF_PINBOX_PINS*npins; /* create a sorted list of pinned addresses, to speed up searches */ - if (available_stack_size(&pinbox, *pins->stack_ends_here) > alloca_size) + if (available_stack_size(&pinbox, *pins->stack_ends_here) > + alloca_size + ALLOCA_SAFETY_MARGIN) { struct st_harvester hv; addr= (void **) alloca(alloca_size); diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c index ffe818e12b9..92418e38c2e 100644 --- a/mysys/ma_dyncol.c +++ b/mysys/ma_dyncol.c @@ -4248,7 +4248,7 @@ mariadb_dyncol_unpack(DYNAMIC_COLUMN *str, { *names= my_malloc(sizeof(LEX_STRING) * header.column_count + DYNCOL_NUM_CHAR * header.column_count, MYF(0)); - nm= (char *)(names + sizeof(LEX_STRING) * header.column_count); + nm= (char *)((*names) + header.column_count); } else { diff --git a/mysys/mf_iocache2.c b/mysys/mf_iocache2.c index 93caa7bc74a..2499094037d 100644 --- a/mysys/mf_iocache2.c +++ b/mysys/mf_iocache2.c @@ -44,7 +44,7 @@ RETURN VALUE 0 All OK - 1 An error occured + 1 An error occurred */ int my_b_copy_to_file(IO_CACHE *cache, FILE *file) diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index 188a8d0429e..3077415b243 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -274,7 +274,7 @@ struct st_hash_link }; /* simple states of a block */ -#define BLOCK_ERROR 1 /* an error occured when performing file i/o */ +#define BLOCK_ERROR 1 /* an error occurred when performing file i/o */ #define BLOCK_READ 2 /* file block is in the block buffer */ #define BLOCK_IN_SWITCH 4 /* block is preparing to read new page */ #define BLOCK_REASSIGNED 8 /* blk does not accept requests for old page */ diff --git a/mysys/my_compare.c b/mysys/my_compare.c index 6de7ff774c0..3c21d74a8a4 100644 --- a/mysys/my_compare.c +++ b/mysys/my_compare.c @@ -21,12 +21,11 @@ #include <my_sys.h> int ha_compare_text(CHARSET_INFO *charset_info, const uchar *a, uint a_length, - const uchar *b, uint b_length, my_bool part_key, - my_bool skip_end_space) + const uchar *b, uint b_length, my_bool part_key) { if (!part_key) return charset_info->coll->strnncollsp(charset_info, a, a_length, - b, b_length, (my_bool)!skip_end_space); + b, b_length); return charset_info->coll->strnncoll(charset_info, a, a_length, b, b_length, part_key); } @@ -186,8 +185,7 @@ int ha_key_cmp(HA_KEYSEG *keyseg, const uchar *a, if (piks && (flag=ha_compare_text(keyseg->charset,a,a_length,b,b_length, (my_bool) ((nextflag & SEARCH_PREFIX) && - next_key_length <= 0), - (my_bool)!(nextflag & SEARCH_PREFIX)))) + next_key_length <= 0)))) return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a+=a_length; b+=b_length; @@ -199,8 +197,7 @@ int ha_key_cmp(HA_KEYSEG *keyseg, const uchar *a, if (piks && (flag= ha_compare_text(keyseg->charset, a, a_length, b, b_length, (my_bool) ((nextflag & SEARCH_PREFIX) && - next_key_length <= 0), - (my_bool)!(nextflag & SEARCH_PREFIX)))) + next_key_length <= 0)))) return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a=end; b+=length; @@ -247,12 +244,7 @@ int ha_key_cmp(HA_KEYSEG *keyseg, const uchar *a, if (piks && (flag= ha_compare_text(keyseg->charset,a,a_length,b,b_length, (my_bool) ((nextflag & SEARCH_PREFIX) && - next_key_length <= 0), - (my_bool) ((nextflag & (SEARCH_FIND | - SEARCH_UPDATE)) == - SEARCH_FIND && - ! (keyseg->flag & - HA_END_SPACE_ARE_EQUAL))))) + next_key_length <= 0)))) return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a+= a_length; b+= b_length; diff --git a/mysys/my_default.c b/mysys/my_default.c index 34ba9eef218..7f41551f779 100644 --- a/mysys/my_default.c +++ b/mysys/my_default.c @@ -363,7 +363,7 @@ err: RETURN 0 - ok - 1 - error occured + 1 - error occurred */ static int handle_default_option(void *in_ctx, const char *group_name, diff --git a/mysys/my_delete.c b/mysys/my_delete.c index e99c7ff5fcb..3dfe290dabe 100644 --- a/mysys/my_delete.c +++ b/mysys/my_delete.c @@ -110,7 +110,7 @@ static int my_win_unlink(const char *name) if (handle != INVALID_HANDLE_VALUE) { /* - We opened file without sharing flags (exclusive), noone else has this file + We opened file without sharing flags (exclusive), no one else has this file opened, thus it is save to close handle to remove it. No renaming is necessary. */ diff --git a/mysys/my_error.c b/mysys/my_error.c index 5d16091e0be..c0698b19a20 100644 --- a/mysys/my_error.c +++ b/mysys/my_error.c @@ -49,7 +49,7 @@ static struct my_err_head { struct my_err_head *meh_next; /* chain link */ - const char** (*get_errmsgs)(); /* returns error message format */ + const char** (*get_errmsgs)(int nr); /* returns error message format */ uint meh_first; /* error number matching array slot 0 */ uint meh_last; /* error number matching last slot */ } my_errmsgs_globerrs= @@ -86,7 +86,7 @@ const char *my_get_err_msg(uint nr) we return NULL. */ if (!(format= (meh_p && (nr >= meh_p->meh_first)) ? - meh_p->get_errmsgs()[nr - meh_p->meh_first] : NULL) || + meh_p->get_errmsgs(nr)[nr - meh_p->meh_first] : NULL) || !*format) return NULL; @@ -217,7 +217,8 @@ void my_message(uint error, const char *str, register myf MyFlags) @retval != 0 Error */ -int my_error_register(const char** (*get_errmsgs) (), uint first, uint last) +int my_error_register(const char** (*get_errmsgs)(int error), uint first, + uint last) { struct my_err_head *meh_p; struct my_err_head **search_meh_pp; @@ -273,11 +274,10 @@ int my_error_register(const char** (*get_errmsgs) (), uint first, uint last) @retval non-NULL OK, returns address of error messages pointers array. */ -const char **my_error_unregister(uint first, uint last) +my_bool my_error_unregister(uint first, uint last) { struct my_err_head *meh_p; struct my_err_head **search_meh_pp; - const char **errmsgs; /* Search for the registration in the list. */ for (search_meh_pp= &my_errmsgs_list; @@ -289,17 +289,15 @@ const char **my_error_unregister(uint first, uint last) break; } if (! *search_meh_pp) - return NULL; - + return TRUE; + /* Remove header from the chain. */ meh_p= *search_meh_pp; *search_meh_pp= meh_p->meh_next; - /* Save the return value and free the header. */ - errmsgs= meh_p->get_errmsgs(); my_free(meh_p); - return errmsgs; + return FALSE; } diff --git a/mysys/my_lock.c b/mysys/my_lock.c index 0abbc6c3084..082d8e9f5a0 100644 --- a/mysys/my_lock.c +++ b/mysys/my_lock.c @@ -131,7 +131,7 @@ error: RETURN VALUE 0 Success - -1 An error has occured and 'my_errno' is set + -1 An error has occurred and 'my_errno' is set to indicate the actual error code. */ @@ -203,7 +203,7 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length, == MY_FILEPOS_ERROR) { /* - If an error has occured in my_seek then we will already + If an error has occurred in my_seek then we will already have an error code in my_errno; Just return error code. */ DBUG_RETURN(-1); |