summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authormonty@mysql.com <>2004-07-07 11:29:39 +0300
committermonty@mysql.com <>2004-07-07 11:29:39 +0300
commit1e311999950833cd81ca0788cd3656585c46d9ae (patch)
treeca8974710746bb69b04a49bc64f938d0b1a8420a /mysys
parent24a8dc2337a717ff340bac228383ef04437a4666 (diff)
parent8462b8aeb83355fa6c5cb4f45ea0ed63ba9e0712 (diff)
downloadmariadb-git-1e311999950833cd81ca0788cd3656585c46d9ae.tar.gz
Merge with 4.1.3-beta
Diffstat (limited to 'mysys')
-rw-r--r--mysys/ChangeLog4
-rw-r--r--mysys/charset-def.c65
-rw-r--r--mysys/charset.c196
-rw-r--r--mysys/default.c2
-rw-r--r--mysys/hash.c3
-rw-r--r--mysys/mf_iocache.c5
-rw-r--r--mysys/mf_iocache2.c3
-rw-r--r--mysys/mf_keycache.c1
-rw-r--r--mysys/mf_pack.c12
-rw-r--r--mysys/mf_soundex.c4
-rw-r--r--mysys/mf_tempfile.c4
-rw-r--r--mysys/mf_wfile.c2
-rw-r--r--mysys/my_bitmap.c1
-rw-r--r--mysys/my_error.c74
-rw-r--r--mysys/my_gethostbyname.c1
-rw-r--r--mysys/my_getopt.c1
-rw-r--r--mysys/my_getwd.c2
-rw-r--r--mysys/my_handler.c4
-rw-r--r--mysys/my_pthread.c35
-rw-r--r--mysys/my_seek.c1
-rw-r--r--mysys/my_static.h2
-rw-r--r--mysys/my_tempnam.c2
-rw-r--r--mysys/rijndael.c1
-rw-r--r--mysys/thr_alarm.c1
24 files changed, 221 insertions, 205 deletions
diff --git a/mysys/ChangeLog b/mysys/ChangeLog
index e24fc00b493..7a426106667 100644
--- a/mysys/ChangeLog
+++ b/mysys/ChangeLog
@@ -91,7 +91,7 @@ Tue Mar 26 15:09:45 1991 Mikael WIDENIUS (monty at panther)
Sat Mar 23 10:49:49 1991 Michael Widenius (monty at LYNX)
- * Added init of alarm variables to skipp some warnings from gcc.
+ * Added init of alarm variables to skip some warnings from gcc.
Tue Mar 5 16:50:34 1991 Michael Widenius (monty at LYNX)
@@ -124,7 +124,7 @@ Mon Aug 27 22:20:38 1990 Michael Widenius (monty at lynx)
Sun Apr 1 23:29:47 1990 Monty (monty at monty)
* Changed mf_keydisk.c to have separate functions for read and write.
- Read can now return pointer to intern key-buffer to skipp
+ Read can now return pointer to intern key-buffer to skip
unessessary memcpy-s.
Fri Mar 23 23:03:39 1990 Monty (monty at monty)
diff --git a/mysys/charset-def.c b/mysys/charset-def.c
index a89cf866933..73e36688594 100644
--- a/mysys/charset-def.c
+++ b/mysys/charset-def.c
@@ -22,6 +22,42 @@
init_compiled_charsets() that only adds those that he wants
*/
+#ifdef HAVE_CHARSET_ucs2
+extern CHARSET_INFO my_charset_ucs2_general_uca;
+extern CHARSET_INFO my_charset_ucs2_icelandic_uca_ci;
+extern CHARSET_INFO my_charset_ucs2_latvian_uca_ci;
+extern CHARSET_INFO my_charset_ucs2_romanian_uca_ci;
+extern CHARSET_INFO my_charset_ucs2_slovenian_uca_ci;
+extern CHARSET_INFO my_charset_ucs2_polish_uca_ci;
+extern CHARSET_INFO my_charset_ucs2_estonian_uca_ci;
+extern CHARSET_INFO my_charset_ucs2_spanish_uca_ci;
+extern CHARSET_INFO my_charset_ucs2_swedish_uca_ci;
+extern CHARSET_INFO my_charset_ucs2_turkish_uca_ci;
+extern CHARSET_INFO my_charset_ucs2_czech_uca_ci;
+extern CHARSET_INFO my_charset_ucs2_danish_uca_ci;
+extern CHARSET_INFO my_charset_ucs2_lithuanian_uca_ci;
+extern CHARSET_INFO my_charset_ucs2_slovak_uca_ci;
+extern CHARSET_INFO my_charset_ucs2_spanish2_uca_ci;
+#endif
+
+#ifdef HAVE_CHARSET_utf8
+extern CHARSET_INFO my_charset_utf8_general_uca_ci;
+extern CHARSET_INFO my_charset_utf8_icelandic_uca_ci;
+extern CHARSET_INFO my_charset_utf8_latvian_uca_ci;
+extern CHARSET_INFO my_charset_utf8_romanian_uca_ci;
+extern CHARSET_INFO my_charset_utf8_slovenian_uca_ci;
+extern CHARSET_INFO my_charset_utf8_polish_uca_ci;
+extern CHARSET_INFO my_charset_utf8_estonian_uca_ci;
+extern CHARSET_INFO my_charset_utf8_spanish_uca_ci;
+extern CHARSET_INFO my_charset_utf8_swedish_uca_ci;
+extern CHARSET_INFO my_charset_utf8_turkish_uca_ci;
+extern CHARSET_INFO my_charset_utf8_czech_uca_ci;
+extern CHARSET_INFO my_charset_utf8_danish_uca_ci;
+extern CHARSET_INFO my_charset_utf8_lithuanian_uca_ci;
+extern CHARSET_INFO my_charset_utf8_slovak_uca_ci;
+extern CHARSET_INFO my_charset_utf8_spanish2_uca_ci;
+#endif
+
my_bool init_compiled_charsets(myf flags __attribute__((unused)))
{
CHARSET_INFO *cs;
@@ -74,6 +110,20 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused)))
add_compiled_collation(&my_charset_ucs2_general_ci);
add_compiled_collation(&my_charset_ucs2_bin);
add_compiled_collation(&my_charset_ucs2_general_uca);
+ add_compiled_collation(&my_charset_ucs2_icelandic_uca_ci);
+ add_compiled_collation(&my_charset_ucs2_latvian_uca_ci);
+ add_compiled_collation(&my_charset_ucs2_romanian_uca_ci);
+ add_compiled_collation(&my_charset_ucs2_slovenian_uca_ci);
+ add_compiled_collation(&my_charset_ucs2_polish_uca_ci);
+ add_compiled_collation(&my_charset_ucs2_estonian_uca_ci);
+ add_compiled_collation(&my_charset_ucs2_spanish_uca_ci);
+ add_compiled_collation(&my_charset_ucs2_swedish_uca_ci);
+ add_compiled_collation(&my_charset_ucs2_turkish_uca_ci);
+ add_compiled_collation(&my_charset_ucs2_czech_uca_ci);
+ add_compiled_collation(&my_charset_ucs2_danish_uca_ci);
+ add_compiled_collation(&my_charset_ucs2_lithuanian_uca_ci);
+ add_compiled_collation(&my_charset_ucs2_slovak_uca_ci);
+ add_compiled_collation(&my_charset_ucs2_spanish2_uca_ci);
#endif
#ifdef HAVE_CHARSET_ujis
@@ -84,6 +134,21 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused)))
#ifdef HAVE_CHARSET_utf8
add_compiled_collation(&my_charset_utf8_general_ci);
add_compiled_collation(&my_charset_utf8_bin);
+ add_compiled_collation(&my_charset_utf8_general_uca_ci);
+ add_compiled_collation(&my_charset_utf8_icelandic_uca_ci);
+ add_compiled_collation(&my_charset_utf8_latvian_uca_ci);
+ add_compiled_collation(&my_charset_utf8_romanian_uca_ci);
+ add_compiled_collation(&my_charset_utf8_slovenian_uca_ci);
+ add_compiled_collation(&my_charset_utf8_polish_uca_ci);
+ add_compiled_collation(&my_charset_utf8_estonian_uca_ci);
+ add_compiled_collation(&my_charset_utf8_spanish_uca_ci);
+ add_compiled_collation(&my_charset_utf8_swedish_uca_ci);
+ add_compiled_collation(&my_charset_utf8_turkish_uca_ci);
+ add_compiled_collation(&my_charset_utf8_czech_uca_ci);
+ add_compiled_collation(&my_charset_utf8_danish_uca_ci);
+ add_compiled_collation(&my_charset_utf8_lithuanian_uca_ci);
+ add_compiled_collation(&my_charset_utf8_slovak_uca_ci);
+ add_compiled_collation(&my_charset_utf8_spanish2_uca_ci);
#endif
/* Copy compiled charsets */
diff --git a/mysys/charset.c b/mysys/charset.c
index d801fcdbd76..1388fc40c6d 100644
--- a/mysys/charset.c
+++ b/mysys/charset.c
@@ -21,16 +21,6 @@
#include <my_dir.h>
#include <my_xml.h>
-typedef struct
-{
- int nchars;
- MY_UNI_IDX uidx;
-} uni_idx;
-
-#define PLANE_SIZE 0x100
-#define PLANE_NUM 0x100
-#define PLANE_NUMBER(x) (((x)>>8) % PLANE_NUM)
-
/*
The code below implements this functionality:
@@ -48,32 +38,21 @@ my_bool my_charset_same(CHARSET_INFO *cs1, CHARSET_INFO *cs2)
}
-static void set_max_sort_char(CHARSET_INFO *cs)
-{
- uchar max_char;
- uint i;
-
- if (!cs->sort_order)
- return;
-
- max_char=cs->sort_order[(uchar) cs->max_sort_char];
- for (i= 0; i < 256; i++)
- {
- if ((uchar) cs->sort_order[i] > max_char)
- {
- max_char=(uchar) cs->sort_order[i];
- cs->max_sort_char= i;
- }
- }
-}
-
-
-static void init_state_maps(CHARSET_INFO *cs)
+static my_bool init_state_maps(CHARSET_INFO *cs)
{
uint i;
- uchar *state_map= cs->state_map;
- uchar *ident_map= cs->ident_map;
+ uchar *state_map;
+ uchar *ident_map;
+ if (!(cs->state_map= (uchar*) my_once_alloc(256, MYF(MY_WME))))
+ return 1;
+
+ if (!(cs->ident_map= (uchar*) my_once_alloc(256, MYF(MY_WME))))
+ return 1;
+
+ state_map= cs->state_map;
+ ident_map= cs->ident_map;
+
/* Fill state_map with states to get a faster parser */
for (i=0; i < 256 ; i++)
{
@@ -120,6 +99,7 @@ static void init_state_maps(CHARSET_INFO *cs)
state_map[(uchar)'x']= state_map[(uchar)'X']= (uchar) MY_LEX_IDENT_OR_HEX;
state_map[(uchar)'b']= state_map[(uchar)'b']= (uchar) MY_LEX_IDENT_OR_BIN;
state_map[(uchar)'n']= state_map[(uchar)'N']= (uchar) MY_LEX_IDENT_OR_NCHAR;
+ return 0;
}
@@ -131,98 +111,11 @@ static void simple_cs_init_functions(CHARSET_INFO *cs)
cs->coll= &my_collation_8bit_simple_ci_handler;
cs->cset= &my_charset_8bit_handler;
- cs->mbminlen= 1;
- cs->mbmaxlen= 1;
}
-static int pcmp(const void * f, const void * s)
-{
- const uni_idx *F= (const uni_idx*) f;
- const uni_idx *S= (const uni_idx*) s;
- int res;
-
- if (!(res=((S->nchars)-(F->nchars))))
- res=((F->uidx.from)-(S->uidx.to));
- return res;
-}
-
-static my_bool create_fromuni(CHARSET_INFO *cs)
-{
- uni_idx idx[PLANE_NUM];
- int i,n;
-
- /* Clear plane statistics */
- bzero(idx,sizeof(idx));
-
- /* Count number of characters in each plane */
- for (i=0; i< 0x100; i++)
- {
- uint16 wc=cs->tab_to_uni[i];
- int pl= PLANE_NUMBER(wc);
-
- if (wc || !i)
- {
- if (!idx[pl].nchars)
- {
- idx[pl].uidx.from=wc;
- idx[pl].uidx.to=wc;
- }else
- {
- idx[pl].uidx.from=wc<idx[pl].uidx.from?wc:idx[pl].uidx.from;
- idx[pl].uidx.to=wc>idx[pl].uidx.to?wc:idx[pl].uidx.to;
- }
- idx[pl].nchars++;
- }
- }
-
- /* Sort planes in descending order */
- qsort(&idx,PLANE_NUM,sizeof(uni_idx),&pcmp);
-
- for (i=0; i < PLANE_NUM; i++)
- {
- int ch,numchars;
-
- /* Skip empty plane */
- if (!idx[i].nchars)
- break;
-
- numchars=idx[i].uidx.to-idx[i].uidx.from+1;
- if (!(idx[i].uidx.tab=(uchar*) my_once_alloc(numchars *
- sizeof(*idx[i].uidx.tab),
- MYF(MY_WME))))
- return TRUE;
-
- bzero(idx[i].uidx.tab,numchars*sizeof(*idx[i].uidx.tab));
-
- for (ch=1; ch < PLANE_SIZE; ch++)
- {
- uint16 wc=cs->tab_to_uni[ch];
- if (wc >= idx[i].uidx.from && wc <= idx[i].uidx.to && wc)
- {
- int ofs= wc - idx[i].uidx.from;
- idx[i].uidx.tab[ofs]= ch;
- }
- }
- }
-
- /* Allocate and fill reverse table for each plane */
- n=i;
- if (!(cs->tab_from_uni= (MY_UNI_IDX*) my_once_alloc(sizeof(MY_UNI_IDX)*(n+1),
- MYF(MY_WME))))
- return TRUE;
-
- for (i=0; i< n; i++)
- cs->tab_from_uni[i]= idx[i].uidx;
-
- /* Set end-of-list marker */
- bzero(&cs->tab_from_uni[i],sizeof(MY_UNI_IDX));
- return FALSE;
-}
-
-
-static int simple_cs_copy_data(CHARSET_INFO *to, CHARSET_INFO *from)
+static int cs_copy_data(CHARSET_INFO *to, CHARSET_INFO *from)
{
to->number= from->number ? from->number : to->number;
@@ -244,7 +137,8 @@ static int simple_cs_copy_data(CHARSET_INFO *to, CHARSET_INFO *from)
MY_CS_CTYPE_TABLE_SIZE,
MYF(MY_WME))))
goto err;
- init_state_maps(to);
+ if (init_state_maps(to))
+ goto err;
}
if (from->to_lower)
if (!(to->to_lower= (uchar*) my_once_memdup((char*) from->to_lower,
@@ -263,7 +157,7 @@ static int simple_cs_copy_data(CHARSET_INFO *to, CHARSET_INFO *from)
MY_CS_SORT_ORDER_TABLE_SIZE,
MYF(MY_WME))))
goto err;
- set_max_sort_char(to);
+
}
if (from->tab_to_uni)
{
@@ -271,11 +165,10 @@ static int simple_cs_copy_data(CHARSET_INFO *to, CHARSET_INFO *from)
if (!(to->tab_to_uni= (uint16*) my_once_memdup((char*)from->tab_to_uni,
sz, MYF(MY_WME))))
goto err;
- if (create_fromuni(to))
- goto err;
}
- to->mbminlen= 1;
- to->mbmaxlen= 1;
+ if (from->tailoring)
+ if (!(to->tailoring= my_once_strdup(from->tailoring,MYF(MY_WME))))
+ goto err;
return 0;
@@ -284,6 +177,7 @@ err:
}
+
static my_bool simple_cs_is_full(CHARSET_INFO *cs)
{
return ((cs->csname && cs->tab_to_uni && cs->ctype && cs->to_upper &&
@@ -315,14 +209,34 @@ static int add_collation(CHARSET_INFO *cs)
if (!(all_charsets[cs->number]->state & MY_CS_COMPILED))
{
- simple_cs_init_functions(all_charsets[cs->number]);
- if (simple_cs_copy_data(all_charsets[cs->number],cs))
- return MY_XML_ERROR;
- if (simple_cs_is_full(all_charsets[cs->number]))
+ CHARSET_INFO *new= all_charsets[cs->number];
+ if (cs_copy_data(all_charsets[cs->number],cs))
+ return MY_XML_ERROR;
+
+ if (!strcmp(cs->csname,"ucs2") )
+ {
+#ifdef HAVE_CHARSET_ucs2
+ new->cset= my_charset_ucs2_general_uca.cset;
+ new->coll= my_charset_ucs2_general_uca.coll;
+ new->strxfrm_multiply= my_charset_ucs2_general_uca.strxfrm_multiply;
+ new->min_sort_char= my_charset_ucs2_general_uca.min_sort_char;
+ new->max_sort_char= my_charset_ucs2_general_uca.max_sort_char;
+ new->mbminlen= 2;
+ new->mbmaxlen= 2;
+ new->state |= MY_CS_AVAILABLE | MY_CS_LOADED;
+#endif
+ }
+ else
{
- all_charsets[cs->number]->state |= MY_CS_LOADED;
+ simple_cs_init_functions(all_charsets[cs->number]);
+ new->mbminlen= 1;
+ new->mbmaxlen= 1;
+ if (simple_cs_is_full(all_charsets[cs->number]))
+ {
+ all_charsets[cs->number]->state |= MY_CS_LOADED;
+ }
+ all_charsets[cs->number]->state|= MY_CS_AVAILABLE;
}
- all_charsets[cs->number]->state|= MY_CS_AVAILABLE;
}
else
{
@@ -432,6 +346,10 @@ void add_compiled_collation(CHARSET_INFO *cs)
cs->state|= MY_CS_AVAILABLE;
}
+static void *cs_alloc(uint size)
+{
+ return my_once_alloc(size, MYF(MY_WME));
+}
#ifdef __NETWARE__
@@ -465,9 +383,9 @@ static my_bool init_available_charsets(myf myflags)
{
if (*cs)
{
- set_max_sort_char(*cs);
if (cs[0]->ctype)
- init_state_maps(*cs);
+ if (init_state_maps(*cs))
+ *cs= NULL;
}
}
@@ -551,6 +469,14 @@ static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags)
}
cs= (cs->state & MY_CS_AVAILABLE) ? cs : NULL;
}
+ if (cs && !(cs->state & MY_CS_READY))
+ {
+ if ((cs->cset->init && cs->cset->init(cs, cs_alloc)) ||
+ (cs->coll->init && cs->coll->init(cs, cs_alloc)))
+ cs= NULL;
+ else
+ cs->state|= MY_CS_READY;
+ }
pthread_mutex_unlock(&THR_LOCK_charset);
return cs;
}
diff --git a/mysys/default.c b/mysys/default.c
index 056f686e16f..792233ed10d 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -222,7 +222,7 @@ int load_defaults(const char *conf_file, const char **groups,
/* copy name + found arguments + command line arguments to new array */
res[0]= argv[0][0]; /* Name MUST be set, even by embedded library */
memcpy((gptr) (res+1), args.buffer, args.elements*sizeof(char*));
- /* Skipp --defaults-file and --defaults-extra-file */
+ /* Skip --defaults-file and --defaults-extra-file */
(*argc)-= args_used;
(*argv)+= args_used;
diff --git a/mysys/hash.c b/mysys/hash.c
index b7be41a9058..11cbbd6b898 100644
--- a/mysys/hash.c
+++ b/mysys/hash.c
@@ -122,7 +122,8 @@ static uint hash_rec_mask(HASH *hash,HASH_LINK *pos,uint buffmax,
-#if !defined(__SUNPRO_C) && !defined(__USLC__) /* broken compilers */
+/* for compilers which can not handle inline */
+#if !defined(__SUNPRO_C) && !defined(__USLC__) && !defined(__sgi)
inline
#endif
unsigned int rec_hashnr(HASH *hash,const byte *record)
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c
index 530721a79ad..f16f2b7ab72 100644
--- a/mysys/mf_iocache.c
+++ b/mysys/mf_iocache.c
@@ -55,7 +55,6 @@ TODO:
#include "mysys_err.h"
static void my_aiowait(my_aio_result *result);
#endif
-#include <assert.h>
#include <errno.h>
#ifdef THREAD
@@ -800,7 +799,7 @@ int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
{ /* Fix if skipped bytes */
if (info->aio_read_pos + read_length < info->pos_in_file)
{
- read_length=0; /* Skipp block */
+ read_length=0; /* Skip block */
next_pos_in_file=info->pos_in_file;
}
else
@@ -894,7 +893,7 @@ int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
if (aioread(info->file,read_buffer,(int) max_length,
(my_off_t) next_pos_in_file,MY_SEEK_SET,
&info->aio_result.result))
- { /* Skipp async io */
+ { /* Skip async io */
my_errno=errno;
DBUG_PRINT("error",("got error: %d, aio_result: %d from aioread, async skipped",
errno, info->aio_result.result.aio_errno));
diff --git a/mysys/mf_iocache2.c b/mysys/mf_iocache2.c
index 232097d355b..1f3db84304e 100644
--- a/mysys/mf_iocache2.c
+++ b/mysys/mf_iocache2.c
@@ -23,7 +23,6 @@
#include <m_string.h>
#include <stdarg.h>
#include <m_ctype.h>
-#include <assert.h>
my_off_t my_b_append_tell(IO_CACHE* info)
{
@@ -273,7 +272,7 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
fmt++;
/* Found one '%' */
}
- /* Skipp if max size is used (to be compatible with printf) */
+ /* Skip if max size is used (to be compatible with printf) */
while (my_isdigit(&my_charset_latin1, *fmt) || *fmt == '.' || *fmt == '-')
fmt++;
if (*fmt == 's') /* String parameter */
diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c
index 168483f276b..32b3154b8ed 100644
--- a/mysys/mf_keycache.c
+++ b/mysys/mf_keycache.c
@@ -44,7 +44,6 @@
#include "my_static.h"
#include <m_string.h>
#include <errno.h>
-#include <assert.h>
#include <stdarg.h>
/*
diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c
index 2d0a5ea282b..9193238708d 100644
--- a/mysys/mf_pack.c
+++ b/mysys/mf_pack.c
@@ -43,7 +43,7 @@ void pack_dirname(my_string to, const char *from)
(void) intern_filename(to,from); /* Change to intern name */
#ifdef FN_DEVCHAR
- if ((start=strrchr(to,FN_DEVCHAR)) != 0) /* Skipp device part */
+ if ((start=strrchr(to,FN_DEVCHAR)) != 0) /* Skip device part */
start++;
else
#endif
@@ -131,7 +131,7 @@ uint cleanup_dirname(register my_string to, const char *from)
from_ptr=(my_string) from;
#ifdef FN_DEVCHAR
if ((pos=strrchr(from_ptr,FN_DEVCHAR)) != 0)
- { /* Skipp device part */
+ { /* Skip device part */
length=(uint) (pos-from_ptr)+1;
start=strnmov(buff,from_ptr,length); from_ptr+=length;
}
@@ -195,7 +195,7 @@ uint cleanup_dirname(register my_string to, const char *from)
pos--; /* Remove dupplicate '/' */
}
else if (pos-start > 1 && pos[-1] == FN_CURLIB && pos[-2] == FN_LIBCHAR)
- pos-=2; /* Skipp /./ */
+ pos-=2; /* Skip /./ */
else if (pos > buff+1 && pos[-1] == FN_HOMELIB && pos[-2] == FN_LIBCHAR)
{ /* Found ..../~/ */
buff[0]=FN_HOMELIB;
@@ -409,7 +409,7 @@ uint system_filename(my_string to, const char *from)
libchar_found=0;
(void) strmov(buff,from); /* If to == from */
from_pos= buff;
- if ((pos=strrchr(from_pos,FN_DEVCHAR))) /* Skipp device part */
+ if ((pos=strrchr(from_pos,FN_DEVCHAR))) /* Skip device part */
{
pos++;
to_pos=strnmov(to,from_pos,(size_s) (pos-from_pos));
@@ -419,7 +419,7 @@ uint system_filename(my_string to, const char *from)
to_pos=to;
if (from_pos[0] == FN_CURLIB && from_pos[1] == FN_LIBCHAR)
- from_pos+=2; /* Skipp './' */
+ from_pos+=2; /* Skip './' */
if (strchr(from_pos,FN_LIBCHAR))
{
*(to_pos++) = FN_C_BEFORE_DIR;
@@ -487,7 +487,7 @@ my_string intern_filename(my_string to, const char *from)
convert_dirname(buff,from,NullS); /* change '<>' to '[]' */
from_pos=buff;
- if ((pos=strrchr(from_pos,FN_DEVCHAR))) /* Skipp device part */
+ if ((pos=strrchr(from_pos,FN_DEVCHAR))) /* Skip device part */
{
pos++;
to_pos=strnmov(to,from_pos,(size_s) (pos-from_pos));
diff --git a/mysys/mf_soundex.c b/mysys/mf_soundex.c
index 27ab4892c57..c0c6105a6eb 100644
--- a/mysys/mf_soundex.c
+++ b/mysys/mf_soundex.c
@@ -52,7 +52,7 @@ void soundex(CHARSET_INFO * cs,register my_string out_pntr, my_string in_pntr,
if (remove_garbage)
{
- while (*in_pntr && !my_isalpha(cs,*in_pntr)) /* Skipp pre-space */
+ while (*in_pntr && !my_isalpha(cs,*in_pntr)) /* Skip pre-space */
in_pntr++;
}
*out_pntr++ = map[(uchar)*in_pntr]; /* Copy first letter */
@@ -82,7 +82,7 @@ void soundex(CHARSET_INFO * cs,register my_string out_pntr, my_string in_pntr,
/*
If alpha, map input letter to soundex code.
- If not alpha and remove_garbage is set then skipp to next char
+ If not alpha and remove_garbage is set then skip to next char
else return 0
*/
diff --git a/mysys/mf_tempfile.c b/mysys/mf_tempfile.c
index 14b8fdc430c..0b337a74c19 100644
--- a/mysys/mf_tempfile.c
+++ b/mysys/mf_tempfile.c
@@ -83,7 +83,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
(*free)(res);
file=my_create(to, 0, mode, MyFlags);
}
-#elif defined(HAVE_MKSTEMP)
+#elif defined(HAVE_MKSTEMP) && !defined(__NETWARE__)
{
char prefix_buff[30];
uint pfx_len;
@@ -181,7 +181,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
for (length=0 ; length < 8 && uniq ; length++)
{
- *end_pos++= _dig_vec[(int) (uniq & 31)];
+ *end_pos++= _dig_vec_upper[(int) (uniq & 31)];
uniq >>= 5;
}
(void) strmov(end_pos,TMP_EXT);
diff --git a/mysys/mf_wfile.c b/mysys/mf_wfile.c
index b964d7ee494..7d537eaa06a 100644
--- a/mysys/mf_wfile.c
+++ b/mysys/mf_wfile.c
@@ -39,7 +39,7 @@ WF_PACK *wf_comp(my_string str)
WF_PACK *ret;
DBUG_ENTER("wf_comp");
- not_pos= -1; /* Skipp space and '!' in front */
+ not_pos= -1; /* Skip space and '!' in front */
while (*str == ' ')
str++;
if (*str == '!')
diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c
index cee46ad59b6..a596fcb6fd9 100644
--- a/mysys/my_bitmap.c
+++ b/mysys/my_bitmap.c
@@ -38,7 +38,6 @@
#include "mysys_priv.h"
#include <my_bitmap.h>
-#include <assert.h>
#include <m_string.h>
diff --git a/mysys/my_error.c b/mysys/my_error.c
index 6fd346c89f7..8a377f63c7e 100644
--- a/mysys/my_error.c
+++ b/mysys/my_error.c
@@ -33,6 +33,12 @@ char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE];
nr Errno
MyFlags Flags
... variable list
+ NOTE
+ The following subset of printf format is supported:
+ "%[0-9.-]*l?[sdu]", where all length flags are parsed but ignored.
+
+ Additionally "%.*s" is supported and "%.*[ud]" is correctly parsed but
+ the length value is ignored.
*/
int my_error(int nr,myf MyFlags, ...)
@@ -43,7 +49,10 @@ int my_error(int nr,myf MyFlags, ...)
reg2 char *endpos;
char * par;
char ebuff[ERRMSGSIZE+20];
+ int prec_chars; /* output precision */
+ my_bool prec_supplied;
DBUG_ENTER("my_error");
+ LINT_INIT(prec_chars); /* protected by prec_supplied */
va_start(ap,MyFlags);
DBUG_PRINT("my", ("nr: %d MyFlags: %d errno: %d", nr, MyFlags, errno));
@@ -59,7 +68,6 @@ int my_error(int nr,myf MyFlags, ...)
if (tpos[0] != '%')
{
*endpos++= *tpos++; /* Copy ordinary char */
- olen++;
continue;
}
if (*++tpos == '%') /* test if %% */
@@ -68,43 +76,71 @@ int my_error(int nr,myf MyFlags, ...)
}
else
{
- /* Skipp if max size is used (to be compatible with printf) */
- while (my_isdigit(&my_charset_latin1, *tpos) || *tpos == '.' || *tpos == '-')
- tpos++;
- if (*tpos == 'l') /* Skipp 'l' argument */
- tpos++;
+ /*
+ Skip size/precision flags to be compatible with printf.
+ The only size/precision flag supported is "%.*s".
+ If "%.*u" or "%.*d" are encountered, the precision number is read
+ from the variable argument list but its value is ignored.
+ */
+ prec_supplied= 0;
+ if (*tpos== '.')
+ {
+ tpos++;
+ olen--;
+ if (*tpos == '*')
+ {
+ tpos++;
+ olen--;
+ prec_chars= va_arg(ap, int); /* get length parameter */
+ prec_supplied= 1;
+ }
+ }
+
+ if (!prec_supplied)
+ {
+ while (my_isdigit(&my_charset_latin1, *tpos) || *tpos == '.' ||
+ *tpos == '-')
+ tpos++;
+
+ if (*tpos == 'l') /* Skip 'l' argument */
+ tpos++;
+ }
+
if (*tpos == 's') /* String parameter */
{
- par = va_arg(ap, char *);
- plen = (uint) strlen(par);
+ par= va_arg(ap, char *);
+ plen= (uint) strlen(par);
+ if (prec_supplied && prec_chars > 0)
+ plen= min((uint)prec_chars, plen);
if (olen + plen < ERRMSGSIZE+2) /* Replace if possible */
{
- endpos=strmov(endpos,par);
- tpos++;
- olen+=plen-2;
- continue;
+ strmake(endpos, par, plen);
+ endpos+= plen;
+ tpos++;
+ olen+= plen-2;
+ continue;
}
}
else if (*tpos == 'd' || *tpos == 'u') /* Integer parameter */
{
register int iarg;
- iarg = va_arg(ap, int);
+ iarg= va_arg(ap, int);
if (*tpos == 'd')
- plen= (uint) (int2str((long) iarg,endpos, -10) - endpos);
+ plen= (uint) (int10_to_str((long) iarg, endpos, -10) - endpos);
else
- plen= (uint) (int2str((long) (uint) iarg,endpos,10)- endpos);
+ plen= (uint) (int10_to_str((long) (uint) iarg, endpos, 10) - endpos);
if (olen + plen < ERRMSGSIZE+2) /* Replace parameter if possible */
{
- endpos+=plen;
+ endpos+= plen;
tpos++;
- olen+=plen-2;
+ olen+= plen-2;
continue;
}
}
}
- *endpos++='%'; /* % used as % or unknown code */
+ *endpos++= '%'; /* % used as % or unknown code */
}
- *endpos='\0'; /* End of errmessage */
+ *endpos= '\0'; /* End of errmessage */
va_end(ap);
DBUG_RETURN((*error_handler_hook)(nr, ebuff, MyFlags));
}
diff --git a/mysys/my_gethostbyname.c b/mysys/my_gethostbyname.c
index 5044a505054..27281f3489d 100644
--- a/mysys/my_gethostbyname.c
+++ b/mysys/my_gethostbyname.c
@@ -18,7 +18,6 @@
/* Thread safe version of gethostbyname_r() */
#include "mysys_priv.h"
-#include <assert.h>
#if !defined(MSDOS) && !defined(__WIN__)
#include <netdb.h>
#endif
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 8d0b05d55f7..d7a9babe5e7 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -18,7 +18,6 @@
#include <m_string.h>
#include <stdlib.h>
#include <my_getopt.h>
-#include <assert.h>
#include <my_sys.h>
#include <mysys_err.h>
diff --git a/mysys/my_getwd.c b/mysys/my_getwd.c
index a08d28d8545..fd47c532cff 100644
--- a/mysys/my_getwd.c
+++ b/mysys/my_getwd.c
@@ -108,7 +108,7 @@ int my_setwd(const char *dir, myf MyFlags)
{
uint drive,drives;
- pos++; /* Skipp FN_DEVCHAR */
+ pos++; /* Skip FN_DEVCHAR */
drive=(uint) (my_toupper(&my_charset_latin1,dir[0])-'A'+1);
drives= (uint) -1;
if ((pos-(byte*) dir) == 2 && drive > 0 && drive < 32)
diff --git a/mysys/my_handler.c b/mysys/my_handler.c
index de0fba56d21..6003808df25 100644
--- a/mysys/my_handler.c
+++ b/mysys/my_handler.c
@@ -21,13 +21,11 @@ int mi_compare_text(CHARSET_INFO *charset_info, uchar *a, uint a_length,
uchar *b, uint b_length, my_bool part_key,
my_bool skip_end_space)
{
- if (part_key && b_length < a_length)
- a_length=b_length;
if (skip_end_space)
return charset_info->coll->strnncollsp(charset_info, a, a_length,
b, b_length);
return charset_info->coll->strnncoll(charset_info, a, a_length,
- b, b_length);
+ b, b_length, part_key);
}
diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c
index 2667c0670d8..37517fb8327 100644
--- a/mysys/my_pthread.c
+++ b/mysys/my_pthread.c
@@ -23,7 +23,6 @@
#include <signal.h>
#include <m_string.h>
#include <thr_alarm.h>
-#include <assert.h>
#if (defined(__BSD__) || defined(_BSDI_VERSION)) && !defined(HAVE_mit_thread)
#define SCHED_POLICY SCHED_RR
@@ -98,25 +97,23 @@ void *my_pthread_getspecific_imp(pthread_key_t key)
#undef pthread_exit
void my_pthread_exit(void *status)
{
- NXThreadId_t tid = NXThreadGetId();
+ NXThreadId_t tid;
NXContext_t ctx;
- char name[PATH_MAX] = "";
-
- /* Do not call pthread_exit if it is not a LibC thread */
- if (tid != 0)
- {
- NXThreadGetContext(tid, &ctx);
- NXContextGetName(ctx, name, PATH_MAX);
-
- /*
- "MYSQLD.NLM's LibC Reaper" or "MYSQLD.NLM's main thread"
- with a debug build of LibC the reaper can have different names
- */
- if (!strindex(name, "\'s"))
- {
- pthread_exit(status);
- }
- }
+ char name[NX_MAX_OBJECT_NAME_LEN+1] = "";
+
+ tid= NXThreadGetId();
+ if (tid == NX_INVALID_THREAD_ID || !tid)
+ return;
+ if (NXThreadGetContext(tid, &ctx) ||
+ NXContextGetName(ctx, name, sizeof(name)-1))
+ return;
+
+ /*
+ "MYSQLD.NLM's LibC Reaper" or "MYSQLD.NLM's main thread"
+ with a debug build of LibC the reaper can have different names
+ */
+ if (!strindex(name, "\'s"))
+ pthread_exit(status);
}
#endif
diff --git a/mysys/my_seek.c b/mysys/my_seek.c
index ec24a26b3d9..6af65d70fd0 100644
--- a/mysys/my_seek.c
+++ b/mysys/my_seek.c
@@ -15,7 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "mysys_priv.h"
-#include <assert.h>
/* Seek to position in file */
/*ARGSUSED*/
diff --git a/mysys/my_static.h b/mysys/my_static.h
index bb408aa808d..51f9fbc922f 100644
--- a/mysys/my_static.h
+++ b/mysys/my_static.h
@@ -19,6 +19,7 @@
a shared library
*/
+C_MODE_START
#include <signal.h>
#define MAX_SIGNALS 10 /* Max signals under a dont-allow */
@@ -73,3 +74,4 @@ extern struct st_my_file_info my_file_info_default[MY_NFILE];
#if defined(THREAD) && !defined(__WIN__)
extern sigset_t my_signals; /* signals blocked by mf_brkhant */
#endif
+C_MODE_END
diff --git a/mysys/my_tempnam.c b/mysys/my_tempnam.c
index b4f76727ee0..9f765298fb6 100644
--- a/mysys/my_tempnam.c
+++ b/mysys/my_tempnam.c
@@ -161,7 +161,7 @@ my_string my_tempnam(const char *dir, const char *pfx,
for (length=0 ; length < 8 && uniq ; length++)
{
- *end_pos++= _dig_vec[(int) (uniq & 31)];
+ *end_pos++= _dig_vec_upper[(int) (uniq & 31)];
uniq >>= 5;
}
VOID(strmov(end_pos,TMP_EXT));
diff --git a/mysys/rijndael.c b/mysys/rijndael.c
index dd0c45445d5..43cd14101ca 100644
--- a/mysys/rijndael.c
+++ b/mysys/rijndael.c
@@ -26,7 +26,6 @@
*/
#include <my_global.h>
-#include <assert.h>
#include "rijndael.h"
/*
diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c
index 54aa4d421f6..84a8e779ae1 100644
--- a/mysys/thr_alarm.c
+++ b/mysys/thr_alarm.c
@@ -27,7 +27,6 @@
#include <m_string.h>
#include <queues.h>
#include "thr_alarm.h"
-#include <assert.h>
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h> /* AIX needs this for fd_set */