← Back to team overview

maria-developers team mailing list archive

[Branch ~maria-captains/maria/5.1] Rev 2769: Automatic merge

 

Merge authors:
  Michael Widenius (monty)
------------------------------------------------------------
revno: 2769 [merge]
committer: Michael Widenius <monty@xxxxxxxxxxxx>
branch nick: maria-5.1
timestamp: Mon 2009-11-30 13:13:02 +0200
message:
  Automatic merge
modified:
  .bzrignore
  BUILD/compile-pentium
  client/mysql_upgrade.c
  cmd-line-utils/readline/config_readline.h
  cmd-line-utils/readline/display.c
  cmd-line-utils/readline/history.c
  cmd-line-utils/readline/rlmbutil.h
  cmd-line-utils/readline/text.c
  cmd-line-utils/readline/xmalloc.c
  configure.in
  include/mysql/plugin.h
  include/mysql/plugin.h.pp
  libmysql/libmysql.c
  mysql-test/t/information_schema.test
  mysql-test/t/not_partition.test
  mysys/lf_hash.c
  mysys/my_redel.c
  regex/engine.c
  regex/engine.ih
  sql/log_event.cc
  sql/mysqld.cc
  sql/scheduler.cc
  sql/sp_head.cc
  sql/sql_base.cc
  sql/sql_builtin.cc.in
  sql/sql_class.cc
  sql/sql_class.h
  sql/sql_insert.cc
  sql/sql_parse.cc
  sql/sql_select.cc
  sql/sql_show.cc
  sql/table.cc
  storage/maria/ha_maria.cc
  storage/maria/lockman.c
  storage/maria/ma_check.c
  storage/maria/ma_check_standalone.h
  storage/maria/ma_ft_boolean_search.c
  storage/maria/ma_ft_nlq_search.c
  storage/maria/ma_ft_parser.c
  storage/maria/ma_ftdefs.h
  storage/maria/ma_sort.c
  storage/maria/ma_state.c
  storage/maria/maria_def.h
  storage/maria/maria_ftdump.c
  storage/maria/trnman.c
  storage/myisam/ft_boolean_search.c
  storage/myisam/ft_nlq_search.c
  storage/myisam/ft_parser.c
  storage/myisam/ft_stopwords.c
  storage/myisam/ftdefs.h
  storage/myisam/ha_myisam.cc
  storage/myisam/mi_check.c
  storage/myisam/myisam_ftdump.c
  storage/myisam/myisamchk.c
  storage/myisam/myisamdef.h
  storage/myisam/myisamlog.c
  storage/myisam/sort.c
  storage/xtradb/fil/fil0fil.c
  storage/xtradb/trx/trx0i_s.c


--
lp:maria
https://code.launchpad.net/~maria-captains/maria/5.1

Your team Maria developers is subscribed to branch lp:maria.
To unsubscribe from this branch go to https://code.launchpad.net/~maria-captains/maria/5.1/+edit-subscription.
=== modified file '.bzrignore'
--- .bzrignore	2009-11-06 17:22:32 +0000
+++ .bzrignore	2009-11-29 23:16:14 +0000
@@ -1922,3 +1922,4 @@
 extra/libevent/event-config.h
 libmysqld/opt_table_elimination.cc
 libmysqld/ha_federatedx.cc
+tmp

=== modified file 'BUILD/compile-pentium'
--- BUILD/compile-pentium	2007-04-11 12:12:00 +0000
+++ BUILD/compile-pentium	2009-11-29 23:08:56 +0000
@@ -4,7 +4,7 @@
 . "$path/SETUP.sh"
 
 extra_flags="$pentium_cflags $fast_cflags"
-extra_configs="$pentium_configs $static_link"
+extra_configs="$pentium_configs"
 strip=yes
 
 . "$path/FINISH.sh"

=== modified file 'client/mysql_upgrade.c'
--- client/mysql_upgrade.c	2009-11-06 17:22:32 +0000
+++ client/mysql_upgrade.c	2009-11-29 23:08:56 +0000
@@ -552,7 +552,6 @@
   FILE *in;
   char upgrade_info_file[FN_REFLEN]= {0};
   char buf[sizeof(MYSQL_SERVER_VERSION)+1];
-  char *res;
 
   if (get_upgrade_info_file_name(upgrade_info_file))
     return 0; /* Could not get filename => not sure */

=== modified file 'cmd-line-utils/readline/config_readline.h'
--- cmd-line-utils/readline/config_readline.h	2005-04-20 10:02:07 +0000
+++ cmd-line-utils/readline/config_readline.h	2009-11-29 23:08:56 +0000
@@ -7,6 +7,11 @@
 #  include <config.h>
 #endif
 
+/* to get wcwidth() defined */
+#define _XOPEN_SOURCE 600
+#define _XOPEN_SOURCE_EXTENDED
+#define _XOPEN_
+
 /*
  Ultrix botches type-ahead when switching from canonical to
    non-canonical mode, at least through version 4.3

=== modified file 'cmd-line-utils/readline/display.c'
--- cmd-line-utils/readline/display.c	2009-09-07 20:50:10 +0000
+++ cmd-line-utils/readline/display.c	2009-11-29 23:08:56 +0000
@@ -461,12 +461,12 @@
   register char *line;
   int inv_botlin, lb_linenum, o_cpos;
   int newlines, lpos, temp, modmark;
-  char *prompt_this_line;
+  const char *prompt_this_line;
 #if defined (HANDLE_MULTIBYTE)
-  int num, n0;
+  int num, n0= 0;
   wchar_t wc;
   size_t wc_bytes;
-  int wc_width;
+  int wc_width= 0;
   mbstate_t ps;
   int _rl_wrapped_multicolumn = 0;
 #endif
@@ -824,7 +824,7 @@
 		  cpos_buffer_position = out;
 		  lb_linenum = newlines;
 		}
-	      for (i = in; i < in+wc_bytes; i++)
+	      for (i = in; (size_t) i < in+wc_bytes; i++)
 		line[out++] = rl_line_buffer[i];
 	      for (i = 0; i < wc_width; i++)
 		CHECK_LPOS();

=== modified file 'cmd-line-utils/readline/history.c'
--- cmd-line-utils/readline/history.c	2008-04-28 16:24:05 +0000
+++ cmd-line-utils/readline/history.c	2009-11-29 23:08:56 +0000
@@ -211,14 +211,14 @@
 
 HIST_ENTRY *
 alloc_history_entry (string, ts)
-     char *string;
+     const char *string;
      char *ts;
 {
   HIST_ENTRY *temp;
 
   temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
 
-  temp->line = string ? savestring (string) : string;
+  temp->line = string ? savestring ((char*) string) : (char*) string;
   temp->data = (char *)NULL;
   temp->timestamp = ts;
 

=== modified file 'cmd-line-utils/readline/rlmbutil.h'
--- cmd-line-utils/readline/rlmbutil.h	2007-11-19 13:38:08 +0000
+++ cmd-line-utils/readline/rlmbutil.h	2009-11-29 23:08:56 +0000
@@ -109,8 +109,8 @@
 extern wchar_t _rl_char_value PARAMS((char *, int));
 extern int _rl_walphabetic PARAMS((wchar_t));
 
-#define _rl_to_wupper(wc)	(iswlower (wc) ? towupper (wc) : (wc))
-#define _rl_to_wlower(wc)	(iswupper (wc) ? towlower (wc) : (wc))
+#define _rl_to_wupper(wc)	(iswlower (wc) ? (wchar_t) towupper (wc) : (wc))
+#define _rl_to_wlower(wc)	(iswupper (wc) ? (wchar_t) towlower (wc) : (wc))
 
 #define MB_NEXTCHAR(b,s,c,f) \
 	((MB_CUR_MAX > 1 && rl_byte_oriented == 0) \

=== modified file 'cmd-line-utils/readline/text.c'
--- cmd-line-utils/readline/text.c	2009-09-07 20:50:10 +0000
+++ cmd-line-utils/readline/text.c	2009-11-29 23:08:56 +0000
@@ -614,7 +614,7 @@
 #ifdef HANDLE_MULTIBYTE
 static char pending_bytes[MB_LEN_MAX];
 static int pending_bytes_length = 0;
-static mbstate_t ps = {0};
+static mbstate_t ps;
 #endif
 
 /* Insert the character C at the current location, moving point forward.

=== modified file 'cmd-line-utils/readline/xmalloc.c'
--- cmd-line-utils/readline/xmalloc.c	2008-01-23 16:43:46 +0000
+++ cmd-line-utils/readline/xmalloc.c	2009-11-29 23:08:56 +0000
@@ -42,7 +42,7 @@
 
 static void
 memory_error_and_abort (fname)
-     char *fname;
+     const char *fname;
 {
   fprintf (stderr, "%s: out of virtual memory\n", fname);
   exit (2);

=== modified file 'configure.in'
--- configure.in	2009-11-07 15:56:51 +0000
+++ configure.in	2009-11-29 23:08:56 +0000
@@ -15,7 +15,7 @@
 # MySQL version number.
 #
 # Note: the following line must be parseable by win/configure.js:GetVersion()
-AM_INIT_AUTOMAKE(mysql, 5.1.39-maria-beta)
+AM_INIT_AUTOMAKE(mysql, 5.1.39-MariaDB-beta)
 AM_CONFIG_HEADER([include/config.h:config.h.in])
 
 PROTOCOL_VERSION=10

=== modified file 'include/mysql/plugin.h'
--- include/mysql/plugin.h	2009-09-07 20:50:10 +0000
+++ include/mysql/plugin.h	2009-11-29 23:08:56 +0000
@@ -567,9 +567,9 @@
 typedef struct st_mysql_ftparser_param
 {
   int (*mysql_parse)(struct st_mysql_ftparser_param *,
-                     char *doc, int doc_len);
+                     const unsigned char *doc, size_t doc_len);
   int (*mysql_add_word)(struct st_mysql_ftparser_param *,
-                        char *word, int word_len,
+                        const unsigned char *word, size_t word_len,
                         MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
   void *ftparser_state;
   void *mysql_ftparam;

=== modified file 'include/mysql/plugin.h.pp'
--- include/mysql/plugin.h.pp	2008-10-10 15:28:41 +0000
+++ include/mysql/plugin.h.pp	2009-11-29 23:08:56 +0000
@@ -73,9 +73,9 @@
 typedef struct st_mysql_ftparser_param
 {
   int (*mysql_parse)(struct st_mysql_ftparser_param *,
-                     char *doc, int doc_len);
+                     const unsigned char *doc, size_t doc_len);
   int (*mysql_add_word)(struct st_mysql_ftparser_param *,
-                        char *word, int word_len,
+                        const unsigned char *word, size_t word_len,
                         MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
   void *ftparser_state;
   void *mysql_ftparam;

=== modified file 'libmysql/libmysql.c'
--- libmysql/libmysql.c	2009-11-06 17:22:32 +0000
+++ libmysql/libmysql.c	2009-11-29 23:08:56 +0000
@@ -2284,7 +2284,7 @@
 
 /* Store type of parameter in network buffer. */
 
-static void store_param_type(char **pos, MYSQL_BIND *param)
+static void store_param_type(uchar **pos, MYSQL_BIND *param)
 {
   uint typecode= param->buffer_type | (param->is_unsigned ? 32768 : 0);
   int2store(*pos, typecode);
@@ -2564,7 +2564,7 @@
 	that is sent to the server.
       */
       for (param= stmt->params;	param < param_end ; param++)
-        store_param_type((char**) &net->write_pos, param);
+        store_param_type(&net->write_pos, param);
     }
 
     for (param= stmt->params; param < param_end; param++)

=== modified file 'mysql-test/t/information_schema.test'
--- mysql-test/t/information_schema.test	2009-09-29 20:19:43 +0000
+++ mysql-test/t/information_schema.test	2009-11-29 23:08:56 +0000
@@ -5,6 +5,9 @@
 # on the presence of the log tables (which are CSV-based).
 --source include/have_csv.inc
 
+# Check that innodb/xtradb is incompiled in as result depends on it
+-- source include/have_innodb.inc
+
 # Save the initial number of concurrent sessions
 --source include/count_sessions.inc
 

=== modified file 'mysql-test/t/not_partition.test'
--- mysql-test/t/not_partition.test	2009-01-08 14:16:44 +0000
+++ mysql-test/t/not_partition.test	2009-11-29 23:08:56 +0000
@@ -15,7 +15,7 @@
 # Bug#39893: Crash if select on a partitioned table,
 #            when partitioning is disabled
 FLUSH TABLES;
---copy_file $MYSQLTEST_VARDIR/std_data_ln/parts/t1.frm $MYSQLD_DATADIR/test/t1.frm
+--copy_file $MYSQLTEST_VARDIR/std_data/parts/t1.frm $MYSQLD_DATADIR/test/t1.frm
 SELECT * FROM t1;
 TRUNCATE TABLE t1;
 ANALYZE TABLE t1;

=== modified file 'mysys/lf_hash.c'
--- mysys/lf_hash.c	2009-01-15 21:27:36 +0000
+++ mysys/lf_hash.c	2009-11-29 23:08:56 +0000
@@ -124,8 +124,8 @@
         we found a deleted node - be nice, help the other thread
         and remove this deleted node
       */
-      if (my_atomic_casptr((void **)cursor->prev,
-                           (void **)&cursor->curr, cursor->next))
+      if (my_atomic_casptr((void **) cursor->prev,
+                           (void **)(char*) &cursor->curr, cursor->next))
         _lf_alloc_free(pins, cursor->curr);
       else
       {
@@ -171,7 +171,8 @@
       node->link= (intptr)cursor.curr;
       DBUG_ASSERT(node->link != (intptr)node); /* no circular references */
       DBUG_ASSERT(cursor.prev != &node->link); /* no circular references */
-      if (my_atomic_casptr((void **)cursor.prev, (void **)&cursor.curr, node))
+      if (my_atomic_casptr((void **) cursor.prev,
+                           (void **)(char*) &cursor.curr, node))
       {
         res= 1; /* inserted ok */
         break;
@@ -218,13 +219,13 @@
     else
     {
       /* mark the node deleted */
-      if (my_atomic_casptr((void **)&(cursor.curr->link),
-                           (void **)&cursor.next,
+      if (my_atomic_casptr((void **) (char*) &(cursor.curr->link),
+                           (void **) (char*) &cursor.next,
                            (void *)(((intptr)cursor.next) | 1)))
       {
         /* and remove it from the list */
         if (my_atomic_casptr((void **)cursor.prev,
-                             (void **)&cursor.curr, cursor.next))
+                             (void **)(char*)&cursor.curr, cursor.next))
           _lf_alloc_free(pins, cursor.curr);
         else
         {
@@ -493,7 +494,7 @@
     my_free((void *)dummy, MYF(0));
     dummy= cur;
   }
-  my_atomic_casptr((void **)node, (void **)&tmp, dummy);
+  my_atomic_casptr((void **)node, (void **)(char*) &tmp, dummy);
   /*
     note that if the CAS above failed (after linsert() succeeded),
     it would mean that some other thread has executed linsert() for

=== modified file 'mysys/my_redel.c'
--- mysys/my_redel.c	2009-11-06 17:22:32 +0000
+++ mysys/my_redel.c	2009-11-29 23:08:56 +0000
@@ -77,9 +77,6 @@
 int my_copystat(const char *from, const char *to, int MyFlags)
 {
   struct stat statbuf;
-#if !defined(__WIN__) && !defined(__NETWARE__)
-  int res;
-#endif
 
   if (stat((char*) from, &statbuf))
   {

=== modified file 'regex/engine.c'
--- regex/engine.c	2005-09-29 01:20:31 +0000
+++ regex/engine.c	2009-11-29 23:08:56 +0000
@@ -33,11 +33,11 @@
 	struct re_guts *g;
 	int eflags;
 	my_regmatch_t *pmatch;	/* [nsub+1] (0 element unused) */
-	char *offp;		/* offsets work from here */
-	char *beginp;		/* start of string -- virtual NUL precedes */
-	char *endp;		/* end of string -- virtual NUL here */
-	char *coldp;		/* can be no match starting before here */
-	char **lastpos;		/* [nplus+1] */
+	const char *offp;	/* offsets work from here */
+	const char *beginp;	/* start of string -- virtual NUL precedes */
+	const char *endp;	/* end of string -- virtual NUL here */
+	const char *coldp;	/* can be no match starting before here */
+	const char **lastpos;	/* [nplus+1] */
 	STATEVARS;
 	states st;		/* current states */
 	states fresh;		/* states for a fresh start */
@@ -66,20 +66,20 @@
 matcher(charset,g, str, nmatch, pmatch, eflags)
 CHARSET_INFO *charset;
 register struct re_guts *g;
-char *str;
+const char *str;
 size_t nmatch;
 my_regmatch_t pmatch[];
 int eflags;
 {
-	register char *endp;
+	register const char *endp;
 	register uint i;
 	struct match mv;
 	register struct match *m = &mv;
-	register char *dp;
+	register const char *dp;
 	register const sopno gf = g->firststate+1;	/* +1 for OEND */
 	register const sopno gl = g->laststate;
-	char *start;
-	char *stop;
+	const char *start;
+	const char *stop;
 
 	/* simplify the situation where possible */
 	if (g->cflags&REG_NOSUB)
@@ -163,7 +163,7 @@
 			dp = dissect(charset, m, m->coldp, endp, gf, gl);
 		} else {
 			if (g->nplus > 0 && m->lastpos == NULL)
-				m->lastpos = (char **)malloc((g->nplus+1) *
+				m->lastpos = (const char **)malloc((g->nplus+1) *
 							sizeof(char *));
 			if (g->nplus > 0 && m->lastpos == NULL) {
 				free(m->pmatch);
@@ -235,28 +235,28 @@
  == static char *dissect(register struct match *m, char *start, \
  ==	char *stop, sopno startst, sopno stopst);
  */
-static char *			/* == stop (success) always */
+static const char *			/* == stop (success) always */
 dissect(charset, m, start, stop, startst, stopst)
 CHARSET_INFO *charset;
 register struct match *m;
-char *start;
-char *stop;
+const char *start;
+const char *stop;
 sopno startst;
 sopno stopst;
 {
 	register uint i;
 	register sopno ss;	/* start sop of current subRE */
 	register sopno es;	/* end sop of current subRE */
-	register char *sp;	/* start of string matched by it */
-	register char *stp;	/* string matched by it cannot pass here */
-	register char *rest;	/* start of rest of string */
-	register char *tail;	/* string unmatched by rest of RE */
+	register const char *sp;	/* start of string matched by it */
+	register const char *stp;	/* string matched by it cannot pass here */
+	register const char *rest;	/* start of rest of string */
+	register const char *tail;	/* string unmatched by rest of RE */
 	register sopno ssub;	/* start sop of subsubRE */
 	register sopno esub;	/* end sop of subsubRE */
-	register char *ssp;	/* start of string matched by subsubRE */
-	register char *sep;	/* end of string matched by subsubRE */
-	register char *oldssp;	/* previous ssp */
-	register char *dp;      /* used in debug mode to check asserts */
+	register const char *ssp;	/* start of string matched by subsubRE */
+	register const char *sep;	/* end of string matched by subsubRE */
+	register const char *oldssp;	/* previous ssp */
+	register const char *dp;      /* used in debug mode to check asserts */
 
 	AT("diss", start, stop, startst, stopst);
 	sp = start;
@@ -424,23 +424,23 @@
  == static char *backref(register struct match *m, char *start, \
  ==	char *stop, sopno startst, sopno stopst, sopno lev);
  */
-static char *			/* == stop (success) or NULL (failure) */
+static const char *			/* == stop (success) or NULL (failure) */
 backref(charset,m, start, stop, startst, stopst, lev)
 CHARSET_INFO *charset;
 register struct match *m;
-char *start;
-char *stop;
+const char *start;
+const char *stop;
 sopno startst;
 sopno stopst;
 sopno lev;			/* PLUS nesting level */
 {
 	register uint i;
 	register sopno ss;	/* start sop of current subRE */
-	register char *sp;	/* start of string matched by it */
+	register const char *sp;	/* start of string matched by it */
 	register sopno ssub;	/* start sop of subsubRE */
 	register sopno esub;	/* end sop of subsubRE */
-	register char *ssp;	/* start of string matched by subsubRE */
-	register char *dp;
+	register const char *ssp;	/* start of string matched by subsubRE */
+	register const char *dp;
 	register size_t len;
 	register int hard;
 	register sop s;
@@ -630,24 +630,24 @@
  == static char *fast(register struct match *m, char *start, \
  ==	char *stop, sopno startst, sopno stopst);
  */
-static char *			/* where tentative match ended, or NULL */
+static const char *		/* where tentative match ended, or NULL */
 fast(charset, m, start, stop, startst, stopst)
 CHARSET_INFO *charset;
 register struct match *m;
-char *start;
-char *stop;
+const char *start;
+const char *stop;
 sopno startst;
 sopno stopst;
 {
 	register states st = m->st;
 	register states fresh = m->fresh;
 	register states tmp = m->tmp;
-	register char *p = start;
+	register const char *p = start;
 	register int c = (start == m->beginp) ? OUT : *(start-1);
 	register int lastc;	/* previous c */
 	register int flagch;
 	register int i;
-	register char *coldp;	/* last p after which no match was underway */
+	register const char *coldp;	/* last p after which no match was underway */
 
 	CLEAR(st);
 	SET1(st, startst);
@@ -722,24 +722,24 @@
  == static char *slow(register struct match *m, char *start, \
  ==	char *stop, sopno startst, sopno stopst);
  */
-static char *			/* where it ended */
+static const char *			/* where it ended */
 slow(charset, m, start, stop, startst, stopst)
 CHARSET_INFO *charset;
 register struct match *m;
-char *start;
-char *stop;
+const char *start;
+const char *stop;
 sopno startst;
 sopno stopst;
 {
 	register states st = m->st;
 	register states empty = m->empty;
 	register states tmp = m->tmp;
-	register char *p = start;
+	register const char *p = start;
 	register int c = (start == m->beginp) ? OUT : *(start-1);
 	register int lastc;	/* previous c */
 	register int flagch;
 	register int i;
-	register char *matchp;	/* last p at which a match ended */
+	register const char *matchp;	/* last p at which a match ended */
 
 	AT("slow", start, stop, startst, stopst);
 	CLEAR(st);

=== modified file 'regex/engine.ih'
--- regex/engine.ih	2005-09-29 00:08:24 +0000
+++ regex/engine.ih	2009-11-29 23:08:56 +0000
@@ -4,11 +4,11 @@
 #endif
 
 /* === engine.c === */
-static int matcher(CHARSET_INFO *charset,register struct re_guts *g, char *string, size_t nmatch, my_regmatch_t pmatch[], int eflags);
-static char *dissect(CHARSET_INFO *charset,register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static char *backref(CHARSET_INFO *charset, register struct match *m, char *start, char *stop, sopno startst, sopno stopst, sopno lev);
-static char *fast(CHARSET_INFO *charset, register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static char *slow(CHARSET_INFO *charset, register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
+static int matcher(CHARSET_INFO *charset,register struct re_guts *g, const char *string, size_t nmatch, my_regmatch_t pmatch[], int eflags);
+static const char *dissect(CHARSET_INFO *charset,register struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
+static const char *backref(CHARSET_INFO *charset, register struct match *m, const char *start, const char *stop, sopno startst, sopno stopst, sopno lev);
+static const char *fast(CHARSET_INFO *charset, register struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
+static const char *slow(CHARSET_INFO *charset, register struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
 static states step(register struct re_guts *g, sopno start, sopno stop, register states bef, int ch, register states aft);
 #define	BOL	(OUT+1)
 #define	EOL	(BOL+1)

=== modified file 'sql/log_event.cc'
--- sql/log_event.cc	2009-11-26 15:32:49 +0000
+++ sql/log_event.cc	2009-11-30 11:13:02 +0000
@@ -2142,7 +2142,7 @@
   */
   DBUG_ASSERT(len <= 255);
   DBUG_ASSERT(src);
-  *((*dst)++)= code;
+  *((*dst)++)= (uchar) code;
   *((*dst)++)= (uchar) len;
   bmove(*dst, src, len);
   (*dst)+= len;

=== modified file 'sql/mysqld.cc'
--- sql/mysqld.cc	2009-10-31 19:22:50 +0000
+++ sql/mysqld.cc	2009-11-26 20:19:33 +0000
@@ -957,6 +957,7 @@
 
     tmp->killed= THD::KILL_CONNECTION;
     thread_scheduler.post_kill_notification(tmp);
+    pthread_mutex_lock(&tmp->LOCK_thd_data);
     if (tmp->mysys_var)
     {
       tmp->mysys_var->abort=1;
@@ -979,6 +980,7 @@
       }
       pthread_mutex_unlock(&tmp->mysys_var->mutex);
     }
+    pthread_mutex_unlock(&tmp->LOCK_thd_data);
   }
   (void) pthread_mutex_unlock(&LOCK_thread_count); // For unlink from list
 

=== modified file 'sql/scheduler.cc'
--- sql/scheduler.cc	2009-09-07 20:50:10 +0000
+++ sql/scheduler.cc	2009-11-26 20:19:33 +0000
@@ -235,9 +235,7 @@
   if (thread_attached)
   {
     THD* thd = (THD*)list.data;
-    pthread_mutex_lock(&thd->LOCK_thd_data);
-    thd->mysys_var= NULL;
-    pthread_mutex_unlock(&thd->LOCK_thd_data);
+    thd->reset_globals();
     thread_attached= FALSE;
 #ifndef DBUG_OFF
     /*

=== modified file 'sql/sp_head.cc'
--- sql/sp_head.cc	2009-09-15 10:46:35 +0000
+++ sql/sp_head.cc	2009-11-29 23:08:56 +0000
@@ -1924,9 +1924,10 @@
       if (spvar->mode == sp_param_out)
       {
         Item_null *null_item= new Item_null();
+        Item *tmp_item= (Item*) null_item;
 
         if (!null_item ||
-            nctx->set_variable(thd, i, (Item **)&null_item))
+            nctx->set_variable(thd, i, &tmp_item))
         {
           err_status= TRUE;
           break;

=== modified file 'sql/sql_base.cc'
--- sql/sql_base.cc	2009-10-15 21:38:29 +0000
+++ sql/sql_base.cc	2009-11-29 23:08:56 +0000
@@ -5823,6 +5823,7 @@
   {
     /* This is a base table. */
     DBUG_ASSERT(nj_col->view_field == NULL);
+    Item *ref= 0;
     /*
       This fix_fields is not necessary (initially this item is fixed by
       the Item_field constructor; after reopen_tables the Item_func_eq
@@ -5830,12 +5831,13 @@
       reopening for columns that was dropped by the concurrent connection.
     */
     if (!nj_col->table_field->fixed &&
-        nj_col->table_field->fix_fields(thd, (Item **)&nj_col->table_field))
+        nj_col->table_field->fix_fields(thd, &ref))
     {
       DBUG_PRINT("info", ("column '%s' was dropped by the concurrent connection",
                           nj_col->table_field->name));
       DBUG_RETURN(NULL);
     }
+    DBUG_ASSERT(ref == 0);                      // Should not have changed
     DBUG_ASSERT(nj_col->table_ref->table == nj_col->table_field->field->table);
     found_field= nj_col->table_field->field;
     update_field_dependencies(thd, found_field, nj_col->table_ref->table);

=== modified file 'sql/sql_builtin.cc.in'
--- sql/sql_builtin.cc.in	2006-12-31 01:29:11 +0000
+++ sql/sql_builtin.cc.in	2009-11-29 23:08:56 +0000
@@ -13,6 +13,7 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
+#include <my_global.h>
 #include <mysql/plugin.h>
 
 typedef struct st_mysql_plugin builtin_plugin[];

=== modified file 'sql/sql_class.cc'
--- sql/sql_class.cc	2009-09-15 10:46:35 +0000
+++ sql/sql_class.cc	2009-11-26 20:19:33 +0000
@@ -1166,6 +1166,19 @@
 }
 
 
+/**
+   Untie THD from current thread
+
+   Used when using --thread-handling=pool-of-threads
+*/
+
+void THD::reset_globals()
+{
+  pthread_mutex_lock(&LOCK_thd_data);
+  mysys_var= 0;
+  pthread_mutex_unlock(&LOCK_thd_data);
+}
+
 /*
   Cleanup after query.
 

=== modified file 'sql/sql_class.h'
--- sql/sql_class.h	2009-09-15 10:46:35 +0000
+++ sql/sql_class.h	2009-11-26 20:19:33 +0000
@@ -1906,6 +1906,7 @@
   void cleanup(void);
   void cleanup_after_query();
   bool store_globals();
+  void reset_globals();
 #ifdef SIGNAL_WITH_VIO_CLOSE
   inline void set_active_vio(Vio* vio)
   {

=== modified file 'sql/sql_insert.cc'
--- sql/sql_insert.cc	2009-11-07 10:34:19 +0000
+++ sql/sql_insert.cc	2009-11-26 20:19:33 +0000
@@ -2279,6 +2279,7 @@
   while ((di= it++))
   {
     di->thd.killed= THD::KILL_CONNECTION;
+    pthread_mutex_lock(&di->thd.LOCK_thd_data);
     if (di->thd.mysys_var)
     {
       pthread_mutex_lock(&di->thd.mysys_var->mutex);
@@ -2297,6 +2298,7 @@
       }
       pthread_mutex_unlock(&di->thd.mysys_var->mutex);
     }
+    pthread_mutex_unlock(&di->thd.LOCK_thd_data);
   }
   VOID(pthread_mutex_unlock(&LOCK_delayed_insert)); // For unlink from list
 }

=== modified file 'sql/sql_parse.cc'
--- sql/sql_parse.cc	2009-11-06 17:22:32 +0000
+++ sql/sql_parse.cc	2009-11-29 23:08:56 +0000
@@ -464,7 +464,7 @@
   thd->init_for_queries();
   while (fgets(buff, thd->net.max_packet, file))
   {
-    char *query, *res;
+    char *query;
     /* strlen() can't be deleted because fgets() doesn't return length */
     ulong length= (ulong) strlen(buff);
     while (buff[length-1] != '\n' && !feof(file))

=== modified file 'sql/sql_select.cc'
--- sql/sql_select.cc	2009-11-06 17:22:32 +0000
+++ sql/sql_select.cc	2009-11-29 23:08:56 +0000
@@ -3586,8 +3586,9 @@
         {
           if (!field->eq(item->field))
           {
+            Item *tmp_item= (Item*) item;
             add_key_field(key_fields, *and_level, cond_func, field,
-                          TRUE, (Item **) &item, 1, usable_tables,
+                          TRUE, &tmp_item, 1, usable_tables,
                           sargables);
           }
         }
@@ -15748,7 +15749,11 @@
     DBUG_RETURN(TRUE);
 
   if (!cond->fixed)
-    cond->fix_fields(thd, (Item**)&cond);
+  {
+    Item *tmp_item= (Item*) cond;
+    cond->fix_fields(thd, &tmp_item);
+    DBUG_ASSERT(cond == tmp_item);
+  }
   if (join_tab->select)
   {
     error=(int) cond->add(join_tab->select->cond);

=== modified file 'sql/sql_show.cc'
--- sql/sql_show.cc	2009-11-02 09:30:21 +0000
+++ sql/sql_show.cc	2009-11-29 23:08:56 +0000
@@ -1747,6 +1747,7 @@
         if ((thd_info->db=tmp->db))             // Safe test
           thd_info->db=thd->strdup(thd_info->db);
         thd_info->command=(int) tmp->command;
+        pthread_mutex_lock(&tmp->LOCK_thd_data);
         if ((mysys_var= tmp->mysys_var))
           pthread_mutex_lock(&mysys_var->mutex);
         thd_info->proc_info= (char*) (tmp->killed == THD::KILL_CONNECTION? "Killed" : 0);
@@ -1766,6 +1767,7 @@
 #endif
         if (mysys_var)
           pthread_mutex_unlock(&mysys_var->mutex);
+        pthread_mutex_unlock(&tmp->LOCK_thd_data);
 
         thd_info->start_time= tmp->start_time;
         thd_info->query=0;
@@ -3549,7 +3551,9 @@
     TABLE_SHARE *share= show_table->s;
     handler *file= show_table->file;
     handlerton *tmp_db_type= share->db_type();
+#ifdef WITH_PARTITION_STORAGE_ENGINE
     bool is_partitioned= FALSE;
+#endif
     if (share->tmp_table == SYSTEM_TMP_TABLE)
       table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"), cs);
     else if (share->tmp_table)

=== modified file 'sql/table.cc'
--- sql/table.cc	2009-10-15 21:38:29 +0000
+++ sql/table.cc	2009-11-29 23:08:56 +0000
@@ -2077,8 +2077,9 @@
   else
   {
     char *str;
+    const char **tmp = (const char**) (char*) buf;
     str=(char *) (buf+a_length);
-    fix_type_pointers((const char ***) &buf,save_names,1,&str);
+    fix_type_pointers(&tmp, save_names, 1, &str);
   }
   DBUG_RETURN(ret_value);
 }

=== modified file 'storage/maria/ha_maria.cc'
--- storage/maria/ha_maria.cc	2009-11-07 10:34:19 +0000
+++ storage/maria/ha_maria.cc	2009-11-29 23:08:56 +0000
@@ -665,10 +665,9 @@
 
 extern "C" {
 
-volatile int *_ma_killed_ptr(HA_CHECK *param)
+int _ma_killed_ptr(HA_CHECK *param)
 {
-  /* In theory Unsafe conversion, but should be ok for now */
-  return (int*) &(((THD *) (param->thd))->killed);
+  return thd_killed((THD*)param->thd);
 }
 
 

=== modified file 'storage/maria/lockman.c'
--- storage/maria/lockman.c	2008-02-21 00:51:51 +0000
+++ storage/maria/lockman.c	2009-11-29 23:08:56 +0000
@@ -360,7 +360,7 @@
     else
     {
       if (my_atomic_casptr((void **)cursor->prev,
-                           (void **)&cursor->curr, cursor->next))
+                           (void **)(char*) &cursor->curr, cursor->next))
         _lf_alloc_free(pins, cursor->curr);
       else
       {
@@ -421,7 +421,8 @@
       node->link= (intptr)cursor.curr;
       DBUG_ASSERT(node->link != (intptr)node);
       DBUG_ASSERT(cursor.prev != &node->link);
-      if (!my_atomic_casptr((void **)cursor.prev, (void **)&cursor.curr, node))
+      if (!my_atomic_casptr((void **)cursor.prev,
+                            (void **)(char*) &cursor.curr, node))
       {
         res= REPEAT_ONCE_MORE;
         node->flags&= ~ACTIVE;
@@ -498,11 +499,11 @@
       then we can delete. Good news is - this is only required when rolling
       back a savepoint.
     */
-    if (my_atomic_casptr((void **)&(cursor.curr->link),
-                         (void **)&cursor.next, 1+(char *)cursor.next))
+    if (my_atomic_casptr((void **)(char*)&(cursor.curr->link),
+                         (void **)(char*)&cursor.next, 1+(char *)cursor.next))
     {
       if (my_atomic_casptr((void **)cursor.prev,
-                           (void **)&cursor.curr, cursor.next))
+                           (void **)(char*)&cursor.curr, cursor.next))
         _lf_alloc_free(pins, cursor.curr);
       else
         lockfind(head, node, &cursor, pins);
@@ -573,7 +574,7 @@
     my_free((void *)dummy, MYF(0));
     dummy= cur;
   }
-  my_atomic_casptr((void **)node, (void **)&tmp, dummy);
+  my_atomic_casptr((void **)node, (void **)(char*) &tmp, dummy);
 }
 
 static inline uint calc_hash(uint64 resource)

=== modified file 'storage/maria/ma_check.c'
--- storage/maria/ma_check.c	2009-05-06 12:03:24 +0000
+++ storage/maria/ma_check.c	2009-11-29 23:08:56 +0000
@@ -215,7 +215,7 @@
     empty=0;
     for (i= share->state.state.del ; i > 0L && next_link != HA_OFFSET_ERROR ; i--)
     {
-      if (*_ma_killed_ptr(param))
+      if (_ma_killed_ptr(param))
         DBUG_RETURN(1);
       if (test_flag & T_VERBOSE)
 	printf(" %9s",llstr(next_link,buff));
@@ -310,7 +310,7 @@
   records= (ha_rows) (share->state.state.key_file_length / block_size);
   while (next_link != HA_OFFSET_ERROR && records > 0)
   {
-    if (*_ma_killed_ptr(param))
+    if (_ma_killed_ptr(param))
       DBUG_RETURN(1);
     if (param->testflag & T_VERBOSE)
       printf("%16s",llstr(next_link,llbuff));
@@ -876,10 +876,10 @@
   tmp_key.data= tmp_key_buff;
   for ( ;; )
   {
-    if (*_ma_killed_ptr(param))
-      goto err;
     if (nod_flag)
     {
+      if (_ma_killed_ptr(param))
+        goto err;
       next_page= _ma_kpos(nod_flag,keypos);
       if (chk_index_down(param,info,keyinfo,next_page,
                          temp_buff,keys,key_checksum,level+1))
@@ -1180,7 +1180,7 @@
   pos= 0;
   while (pos < share->state.state.data_file_length)
   {
-    if (*_ma_killed_ptr(param))
+    if (_ma_killed_ptr(param))
       return -1;
     if (my_b_read(&param->read_cache, record,
                   share->base.pack_reclength))
@@ -1230,7 +1230,7 @@
   {
     my_bool got_error= 0;
     int flag;
-    if (*_ma_killed_ptr(param))
+    if (_ma_killed_ptr(param))
       DBUG_RETURN(-1);
 
     flag= block_info.second_read=0;
@@ -1451,7 +1451,7 @@
   pos= share->pack.header_length;             /* Skip header */
   while (pos < share->state.state.data_file_length)
   {
-    if (*_ma_killed_ptr(param))
+    if (_ma_killed_ptr(param))
       DBUG_RETURN(-1);
 
     if (_ma_read_cache(&param->read_cache, block_info.header, pos,
@@ -1815,7 +1815,7 @@
     LINT_INIT(row_count);
     LINT_INIT(empty_space);
 
-    if (*_ma_killed_ptr(param))
+    if (_ma_killed_ptr(param))
     {
       _ma_scan_end_block_record(info);
       return -1;
@@ -4631,7 +4631,7 @@
   char llbuff[22],llbuff2[22];
   DBUG_ENTER("sort_get_next_record");
 
-  if (*_ma_killed_ptr(param))
+  if (_ma_killed_ptr(param))
     DBUG_RETURN(1);
 
   switch (sort_info->org_data_file_type) {

=== modified file 'storage/maria/ma_check_standalone.h'
--- storage/maria/ma_check_standalone.h	2007-10-03 16:10:32 +0000
+++ storage/maria/ma_check_standalone.h	2009-11-29 23:08:56 +0000
@@ -30,11 +30,9 @@
   Check if check/repair operation was killed by a signal
 */
 
-static int not_killed= 0;
-
-volatile int *_ma_killed_ptr(HA_CHECK *param __attribute__((unused)))
+int _ma_killed_ptr(HA_CHECK *param __attribute__((unused)))
 {
-  return &not_killed;			/* always NULL */
+  return 0;
 }
 
 	/* print warnings and errors */

=== modified file 'storage/maria/ma_ft_boolean_search.c'
--- storage/maria/ma_ft_boolean_search.c	2009-02-19 09:01:25 +0000
+++ storage/maria/ma_ft_boolean_search.c	2009-11-29 23:08:56 +0000
@@ -180,7 +180,7 @@
 
 
 static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
-                              char *word, int word_len,
+                              const uchar *word, size_t word_len,
                               MYSQL_FTPARSER_BOOLEAN_INFO *info)
 {
   MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
@@ -282,19 +282,19 @@
 
 
 static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
-                                    char *query, int len)
+                                    const uchar *query, size_t len)
 {
   MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
   MYSQL_FTPARSER_BOOLEAN_INFO info;
   CHARSET_INFO *cs= ftb_param->ftb->charset;
-  uchar **start= (uchar**) &query;
-  uchar *end= (uchar*) query + len;
+  const uchar **start= &query;
+  const uchar *end= query + len;
   FT_WORD w;
 
   info.prev= ' ';
   info.quot= 0;
   while (maria_ft_get_word(cs, start, end, &w, &info))
-    param->mysql_add_word(param, (char *) w.pos, w.len, &info);
+    param->mysql_add_word(param, w.pos, w.len, &info);
   return(0);
 }
 
@@ -615,7 +615,7 @@
 
 
 static int ftb_phrase_add_word(MYSQL_FTPARSER_PARAM *param,
-                               char *word, int word_len,
+                               const uchar *word, size_t word_len,
     MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
 {
   MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
@@ -647,15 +647,15 @@
 
 
 static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
-                                     char *document, int len)
+                                     const uchar *document, size_t len)
 {
   FT_WORD word;
   MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
-  const uchar *docend= (uchar*) document + len;
-  while (maria_ft_simple_get_word(phrase_param->cs, (uchar**) &document,
+  const uchar *docend= document + len;
+  while (maria_ft_simple_get_word(phrase_param->cs, &document,
                                   docend, &word, FALSE))
   {
-    param->mysql_add_word(param, (char*) word.pos, word.len, 0);
+    param->mysql_add_word(param, word.pos, word.len, 0);
     if (phrase_param->match)
       break;
   }
@@ -872,7 +872,7 @@
 
 
 static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
-                                       char *word, int len,
+                                       const uchar *word, size_t len,
              MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
 {
   MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
@@ -933,15 +933,14 @@
 
 
 static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param,
-                                    char *doc, int len)
+                                    const uchar *doc, size_t len)
 {
   MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
   FT_INFO *ftb= ftb_param->ftb;
-  uchar *end= (uchar*) doc + len;
+  const uchar *end= doc + len;
   FT_WORD w;
-  while (maria_ft_simple_get_word(ftb->charset, (uchar**) &doc,
-                                  end, &w, TRUE))
-    param->mysql_add_word(param, (char *) w.pos, w.len, 0);
+  while (maria_ft_simple_get_word(ftb->charset, &doc, end, &w, TRUE))
+    param->mysql_add_word(param, w.pos, w.len, 0);
   return(0);
 }
 

=== modified file 'storage/maria/ma_ft_nlq_search.c'
--- storage/maria/ma_ft_nlq_search.c	2009-01-09 04:23:25 +0000
+++ storage/maria/ma_ft_nlq_search.c	2009-11-29 23:08:56 +0000
@@ -63,7 +63,8 @@
 
 static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
 {
-  int	       subkeys, r;
+  int32	       subkeys;
+  int          r;
   uint	       doc_cnt;
   FT_SUPERDOC  sdoc, *sptr;
   TREE_ELEMENT *selem;
@@ -127,7 +128,7 @@
       goto do_skip;
     }
 #if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
-    tmp_weight=*(float*)&subkeys;
+    tmp_weight=*(float*) (char*) &subkeys;
 #else
 #error
 #endif

=== modified file 'storage/maria/ma_ft_parser.c'
--- storage/maria/ma_ft_parser.c	2009-02-19 09:01:25 +0000
+++ storage/maria/ma_ft_parser.c	2009-11-29 23:08:56 +0000
@@ -109,10 +109,11 @@
   3 - right bracket
   4 - stopword found
 */
-uchar maria_ft_get_word(CHARSET_INFO *cs, uchar **start, uchar *end,
+uchar maria_ft_get_word(CHARSET_INFO *cs, const uchar **start,
+                        const uchar *end,
                         FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *param)
 {
-  uchar *doc=*start;
+  const uchar *doc= *start;
   int ctype;
   uint mwc, length;
   int mbl;
@@ -203,11 +204,11 @@
   return param->type;
 }
 
-uchar maria_ft_simple_get_word(CHARSET_INFO *cs, uchar **start,
+uchar maria_ft_simple_get_word(CHARSET_INFO *cs, const uchar **start,
                                const uchar *end, FT_WORD *word,
                                my_bool skip_stopwords)
 {
-  uchar *doc= *start;
+  const uchar *doc= *start;
   uint mwc, length;
   int ctype, mbl;
   DBUG_ENTER("maria_ft_simple_get_word");
@@ -259,8 +260,9 @@
 
 
 static int maria_ft_add_word(MYSQL_FTPARSER_PARAM *param,
-                       char *word, int word_len,
-             MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
+                             const uchar *word, size_t word_len,
+                             MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info
+                             __attribute__((unused)))
 {
   TREE *wtree;
   FT_WORD w;
@@ -276,7 +278,7 @@
     w.pos= ptr;
   }
   else
-    w.pos= (uchar *) word;
+    w.pos= word;
   w.len= word_len;
   if (!tree_insert(wtree, &w, 0, wtree->custom_arg))
   {
@@ -288,17 +290,17 @@
 
 
 static int maria_ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
-                                   char *doc_arg, int doc_len)
+                                   const uchar *doc_arg, size_t doc_len)
 {
-  uchar *doc= (uchar*) doc_arg;
-  uchar *end= doc + doc_len;
+  const uchar *doc= doc_arg;
+  const uchar *end= doc + doc_len;
   MY_FT_PARSER_PARAM *ft_param=param->mysql_ftparam;
   TREE *wtree= ft_param->wtree;
   FT_WORD w;
   DBUG_ENTER("maria_ft_parse_internal");
 
   while (maria_ft_simple_get_word(wtree->custom_arg, &doc, end, &w, TRUE))
-    if (param->mysql_add_word(param, (char *) w.pos, w.len, 0))
+    if (param->mysql_add_word(param, w.pos, w.len, 0))
       DBUG_RETURN(1);
   DBUG_RETURN(0);
 }
@@ -378,7 +380,7 @@
        mysql_add_word != 0 - parser is initialized, or no
                              initialization needed. */
     info->ftparser_param[ftparser_nr].mysql_add_word=
-      (int (*)(struct st_mysql_ftparser_param *, char *, int,
+      (int (*)(struct st_mysql_ftparser_param *, const uchar *, size_t,
                MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
     if (parser->init && parser->init(&info->ftparser_param[ftparser_nr]))
       return 0;

=== modified file 'storage/maria/ma_ftdefs.h'
--- storage/maria/ma_ftdefs.h	2009-02-12 17:51:00 +0000
+++ storage/maria/ma_ftdefs.h	2009-11-29 23:08:56 +0000
@@ -96,7 +96,7 @@
 #define FTB_RQUOT (ft_boolean_syntax[11])
 
 typedef struct st_maria_ft_word {
-  uchar * pos;
+  const uchar * pos;
   uint	 len;
   double weight;
 } FT_WORD;
@@ -106,9 +106,9 @@
 MARIA_KEY *_ma_ft_make_key(MARIA_HA *, MARIA_KEY *, uint , uchar *, FT_WORD *,
                            my_off_t);
 
-uchar maria_ft_get_word(CHARSET_INFO *, uchar **, uchar *, FT_WORD *,
-                        MYSQL_FTPARSER_BOOLEAN_INFO *);
-uchar maria_ft_simple_get_word(CHARSET_INFO *, uchar **, const uchar *,
+uchar maria_ft_get_word(CHARSET_INFO *, const uchar **, const uchar *,
+                        FT_WORD *, MYSQL_FTPARSER_BOOLEAN_INFO *);
+uchar maria_ft_simple_get_word(CHARSET_INFO *, const uchar **, const uchar *,
                                FT_WORD *, my_bool);
 
 typedef struct _st_maria_ft_seg_iterator {

=== modified file 'storage/maria/ma_sort.c'
--- storage/maria/ma_sort.c	2009-01-09 04:23:25 +0000
+++ storage/maria/ma_sort.c	2009-11-29 23:08:56 +0000
@@ -920,7 +920,6 @@
   uchar *strpos;
   BUFFPEK *buffpek,**refpek;
   QUEUE queue;
-  volatile int *killed= _ma_killed_ptr(info->sort_info->param);
   DBUG_ENTER("merge_buffers");
 
   count=error=0;
@@ -953,10 +952,6 @@
   {
     for (;;)
     {
-      if (*killed)
-      {
-        error=1; goto err;
-      }
       buffpek=(BUFFPEK*) queue_top(&queue);
       if (to_file)
       {
@@ -976,6 +971,12 @@
       buffpek->key+=sort_length;
       if (! --buffpek->mem_count)
       {
+        /* It's enough to check for killedptr before a slow operation */
+        if (_ma_killed_ptr(info->sort_info->param))
+        {
+          error=1;
+          goto err;
+        }
         if (!(error=(int) info->read_to_buffer(from_file,buffpek,sort_length)))
         {
           uchar *base= buffpek->base;

=== modified file 'storage/maria/ma_state.c'
--- storage/maria/ma_state.c	2009-10-06 06:57:22 +0000
+++ storage/maria/ma_state.c	2009-11-29 23:08:56 +0000
@@ -528,7 +528,7 @@
 
   safe_mutex_assert_owner(&share->intern_lock);
   
-  for (prev= (MARIA_USED_TABLES**) &trn->used_tables, tables= *prev;
+  for (prev= (MARIA_USED_TABLES**) (char*) &trn->used_tables, tables= *prev;
        tables;
        tables= *prev)
   {

=== modified file 'storage/maria/maria_def.h'
--- storage/maria/maria_def.h	2009-10-06 06:57:22 +0000
+++ storage/maria/maria_def.h	2009-11-29 23:08:56 +0000
@@ -1160,7 +1160,7 @@
   Functions needed by _ma_check (are overridden in MySQL/ha_maria.cc).
   See ma_check_standalone.h .
 */
-volatile int *_ma_killed_ptr(HA_CHECK *param);
+int _ma_killed_ptr(HA_CHECK *param);
 void _ma_check_print_error _VARARGS((HA_CHECK *param, const char *fmt, ...))
   ATTRIBUTE_FORMAT(printf, 2, 3);
 void _ma_check_print_warning _VARARGS((HA_CHECK *param, const char *fmt, ...))

=== modified file 'storage/maria/maria_ftdump.c'
--- storage/maria/maria_ftdump.c	2008-08-25 11:49:47 +0000
+++ storage/maria/maria_ftdump.c	2009-11-29 23:08:56 +0000
@@ -116,7 +116,7 @@
 
     subkeys=ft_sintXkorr(info->lastkey_buff + keylen + 1);
     if (subkeys >= 0)
-      weight=*(float*)&subkeys;
+      weight=*(float*) (char*) &subkeys;
 
 #ifdef HAVE_SNPRINTF
     snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey_buff+1);

=== modified file 'storage/maria/trnman.c'
--- storage/maria/trnman.c	2009-03-05 13:46:45 +0000
+++ storage/maria/trnman.c	2009-11-29 23:08:56 +0000
@@ -300,8 +300,8 @@
     (ABA isn't possible, we're behind a mutex
   */
   my_atomic_rwlock_wrlock(&LOCK_pool);
-  while (tmp.trn && !my_atomic_casptr((void **)&pool, &tmp.v,
-                                  (void *)tmp.trn->next))
+  while (tmp.trn && !my_atomic_casptr((void **)(char*) &pool, &tmp.v,
+                                      (void *)tmp.trn->next))
     /* no-op */;
   my_atomic_rwlock_wrunlock(&LOCK_pool);
 
@@ -545,7 +545,7 @@
       down after the loop at -O2
     */
     *(TRN * volatile *)&(trn->next)= tmp.trn;
-  } while (!my_atomic_casptr((void **)&pool, &tmp.v, trn));
+  } while (!my_atomic_casptr((void **)(char*)&pool, &tmp.v, trn));
   my_atomic_rwlock_wrunlock(&LOCK_pool);
 }
 

=== modified file 'storage/myisam/ft_boolean_search.c'
--- storage/myisam/ft_boolean_search.c	2009-10-15 21:38:29 +0000
+++ storage/myisam/ft_boolean_search.c	2009-11-29 23:08:56 +0000
@@ -180,7 +180,7 @@
 
 
 static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
-                              char *word, int word_len,
+                              const uchar *word, size_t word_len,
                               MYSQL_FTPARSER_BOOLEAN_INFO *info)
 {
   MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
@@ -282,19 +282,19 @@
 
 
 static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
-                                    char *query, int len)
+                                    const uchar *query, size_t len)
 {
   MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
   MYSQL_FTPARSER_BOOLEAN_INFO info;
   CHARSET_INFO *cs= ftb_param->ftb->charset;
-  uchar **start= (uchar**) &query;
-  uchar *end= (uchar*) query + len;
+  const uchar **start= &query;
+  const uchar *end= query + len;
   FT_WORD w;
 
   info.prev= ' ';
   info.quot= 0;
   while (ft_get_word(cs, start, end, &w, &info))
-    param->mysql_add_word(param, (char*) w.pos, w.len, &info);
+    param->mysql_add_word(param, w.pos, w.len, &info);
   return(0);
 }
 
@@ -616,7 +616,7 @@
 
 
 static int ftb_phrase_add_word(MYSQL_FTPARSER_PARAM *param,
-                               char *word, int word_len,
+                               const uchar *word, size_t word_len,
     MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
 {
   MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
@@ -648,15 +648,15 @@
 
 
 static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
-                                     char *document, int len)
+                                     const uchar *document, size_t len)
 {
   FT_WORD word;
   MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
   const uchar *docend= (uchar*) document + len;
-  while (ft_simple_get_word(phrase_param->cs, (uchar**) &document, docend,
+  while (ft_simple_get_word(phrase_param->cs, &document, docend,
                             &word, FALSE))
   {
-    param->mysql_add_word(param, (char*) word.pos, word.len, 0);
+    param->mysql_add_word(param, word.pos, word.len, 0);
     if (phrase_param->match)
       break;
   }
@@ -874,7 +874,7 @@
 
 
 static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
-                                       char *word, int len,
+                                       const uchar *word, size_t len,
              MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
 {
   MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
@@ -888,8 +888,8 @@
   for (a= 0, b= ftb->queue.elements, c= (a+b)/2; b-a>1; c= (a+b)/2)
   {
     ftbw= ftb->list[c];
-    if (ha_compare_text(ftb->charset, (uchar*)word, len,
-                        (uchar*)ftbw->word+1, ftbw->len-1,
+    if (ha_compare_text(ftb->charset, word, len,
+                        ftbw->word+1, ftbw->len-1,
                         (my_bool) (ftbw->flags & FTB_FLAG_TRUNC), 0) < 0)
       b= c;
     else
@@ -915,8 +915,8 @@
   for (; c >= 0; c--)
   {
     ftbw= ftb->list[c];
-    if (ha_compare_text(ftb->charset, (uchar*)word, len,
-                        (uchar*)ftbw->word + 1,ftbw->len - 1,
+    if (ha_compare_text(ftb->charset, word, len,
+                        ftbw->word + 1,ftbw->len - 1,
                         (my_bool)(ftbw->flags & FTB_FLAG_TRUNC), 0))
     {
       if (ftb->with_scan & FTB_FLAG_TRUNC)
@@ -935,14 +935,14 @@
 
 
 static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param,
-                                    char *doc, int len)
+                                    const uchar *doc, size_t len)
 {
   MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
   FT_INFO *ftb= ftb_param->ftb;
-  uchar *end= (uchar*) doc + len;
+  const uchar *end= doc + len;
   FT_WORD w;
-  while (ft_simple_get_word(ftb->charset, (uchar**) &doc, end, &w, TRUE))
-    param->mysql_add_word(param, (char*) w.pos, w.len, 0);
+  while (ft_simple_get_word(ftb->charset, &doc, end, &w, TRUE))
+    param->mysql_add_word(param, w.pos, w.len, 0);
   return(0);
 }
 

=== modified file 'storage/myisam/ft_nlq_search.c'
--- storage/myisam/ft_nlq_search.c	2008-04-28 16:24:05 +0000
+++ storage/myisam/ft_nlq_search.c	2009-11-29 23:08:56 +0000
@@ -63,7 +63,8 @@
 
 static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
 {
-  int	       subkeys, r;
+  int32	       subkeys;
+  int          r;
   uint	       keylen, doc_cnt;
   FT_SUPERDOC  sdoc, *sptr;
   TREE_ELEMENT *selem;
@@ -123,7 +124,8 @@
       goto do_skip;
     }
 #if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
-    tmp_weight=*(float*)&subkeys;
+    /* The weight we read was actually a float */
+    tmp_weight=*(float*) (char*) &subkeys;
 #else
 #error
 #endif

=== modified file 'storage/myisam/ft_parser.c'
--- storage/myisam/ft_parser.c	2009-02-12 14:08:56 +0000
+++ storage/myisam/ft_parser.c	2009-11-29 23:08:56 +0000
@@ -106,10 +106,10 @@
   3 - right bracket
   4 - stopword found
 */
-uchar ft_get_word(CHARSET_INFO *cs, uchar **start, uchar *end,
+uchar ft_get_word(CHARSET_INFO *cs, const uchar **start, const uchar *end,
                   FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *param)
 {
-  uchar *doc=*start;
+  const uchar *doc= *start;
   int ctype;
   uint mwc, length;
   int mbl;
@@ -201,10 +201,11 @@
   return param->type;
 }
 
-uchar ft_simple_get_word(CHARSET_INFO *cs, uchar **start, const uchar *end,
-                         FT_WORD *word, my_bool skip_stopwords)
+uchar ft_simple_get_word(CHARSET_INFO *cs, const uchar **start,
+                         const uchar *end, FT_WORD *word,
+                         my_bool skip_stopwords)
 {
-  uchar *doc= *start;
+  const uchar *doc= *start;
   uint mwc, length;
   int mbl;
   int ctype;
@@ -216,7 +217,7 @@
     {
       if (doc >= end)
         DBUG_RETURN(0);
-      mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end);
+      mbl= cs->cset->ctype(cs, &ctype, doc, end);
       if (true_word_char(ctype, *doc))
         break;
     }
@@ -225,7 +226,7 @@
     for (word->pos= doc; doc < end; length++,
          doc+= (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1)))
     {
-      mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end);
+      mbl= cs->cset->ctype(cs, &ctype, doc, end);
       if (true_word_char(ctype, *doc))
         mwc= 0;
       else if (!misc_word_char(*doc) || mwc)
@@ -238,7 +239,7 @@
 
     if (skip_stopwords == FALSE ||
         (length >= ft_min_word_len && length < ft_max_word_len &&
-         !is_stopword((char*) word->pos, word->len)))
+         !is_stopword(word->pos, word->len)))
     {
       *start= doc;
       DBUG_RETURN(1);
@@ -257,8 +258,9 @@
 
 
 static int ft_add_word(MYSQL_FTPARSER_PARAM *param,
-                       char *word, int word_len,
-             MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
+                       const uchar *word, size_t word_len,
+                       MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info
+                       __attribute__((unused)))
 {
   TREE *wtree;
   FT_WORD w;
@@ -286,10 +288,10 @@
 
 
 static int ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
-                             char *doc_arg, int doc_len)
+                             const uchar *doc_arg, size_t doc_len)
 {
-  uchar *doc= (uchar*) doc_arg;
-  uchar *end= doc + doc_len;
+  const uchar *doc= doc_arg;
+  const uchar *end= doc + doc_len;
   MY_FT_PARSER_PARAM *ft_param=param->mysql_ftparam;
   TREE *wtree= ft_param->wtree;
   FT_WORD w;
@@ -302,7 +304,7 @@
 }
 
 
-int ft_parse(TREE *wtree, uchar *doc, int doclen,
+int ft_parse(TREE *wtree, const uchar *doc, int doclen,
              struct st_mysql_ftparser *parser,
              MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root)
 {
@@ -377,7 +379,7 @@
        mysql_add_word != 0 - parser is initialized, or no
                              initialization needed. */
     info->ftparser_param[ftparser_nr].mysql_add_word=
-      (int (*)(struct st_mysql_ftparser_param *, char *, int,
+      (int (*)(struct st_mysql_ftparser_param *, const uchar *, size_t,
               MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
     if (parser->init && parser->init(&info->ftparser_param[ftparser_nr]))
       return 0;

=== modified file 'storage/myisam/ft_stopwords.c'
--- storage/myisam/ft_stopwords.c	2008-04-28 16:24:05 +0000
+++ storage/myisam/ft_stopwords.c	2009-11-29 23:08:56 +0000
@@ -66,7 +66,8 @@
   {
     File fd;
     uint len;
-    uchar *buffer, *start, *end;
+    uchar *buffer;
+    const uchar *start, *end;
     FT_WORD w;
     int error=-1;
 
@@ -109,7 +110,7 @@
 }
 
 
-int is_stopword(char *word, uint len)
+int is_stopword(const uchar *word, size_t len)
 {
   FT_STOPWORD sw;
   sw.pos=word;

=== modified file 'storage/myisam/ftdefs.h'
--- storage/myisam/ftdefs.h	2009-01-26 06:35:15 +0000
+++ storage/myisam/ftdefs.h	2009-11-29 23:08:56 +0000
@@ -96,18 +96,18 @@
 #define FTB_RQUOT (ft_boolean_syntax[11])
 
 typedef struct st_ft_word {
-  uchar * pos;
+  const uchar *pos;
   uint	 len;
   double weight;
 } FT_WORD;
 
-int is_stopword(char *word, uint len);
+int is_stopword(const uchar *word, size_t len);
 
 uint _ft_make_key(MI_INFO *, uint , uchar *, FT_WORD *, my_off_t);
 
-uchar ft_get_word(CHARSET_INFO *, uchar **, uchar *, FT_WORD *,
+uchar ft_get_word(CHARSET_INFO *, const uchar **, const uchar *, FT_WORD *,
                   MYSQL_FTPARSER_BOOLEAN_INFO *);
-uchar ft_simple_get_word(CHARSET_INFO *, uchar **, const uchar *,
+uchar ft_simple_get_word(CHARSET_INFO *, const uchar **, const uchar *,
                          FT_WORD *, my_bool);
 
 typedef struct _st_ft_seg_iterator {
@@ -121,7 +121,7 @@
 uint _mi_ft_segiterator(FT_SEG_ITERATOR *);
 
 void ft_parse_init(TREE *, CHARSET_INFO *);
-int ft_parse(TREE *, uchar *, int, struct st_mysql_ftparser *parser,
+int ft_parse(TREE *, const uchar *, int, struct st_mysql_ftparser *parser,
              MYSQL_FTPARSER_PARAM *, MEM_ROOT *);
 FT_WORD * ft_linearize(TREE *, MEM_ROOT *);
 FT_WORD * _mi_ft_parserecord(MI_INFO *, uint, const uchar *, MEM_ROOT *);

=== modified file 'storage/myisam/ha_myisam.cc'
--- storage/myisam/ha_myisam.cc	2009-10-06 14:53:46 +0000
+++ storage/myisam/ha_myisam.cc	2009-11-29 23:08:56 +0000
@@ -497,10 +497,9 @@
 
 extern "C" {
 
-volatile int *killed_ptr(HA_CHECK *param)
+int killed_ptr(HA_CHECK *param)
 {
-  /* In theory Unsafe conversion, but should be ok for now */
-  return (int*) &(((THD *)(param->thd))->killed);
+  return thd_killed((THD*)param->thd);
 }
 
 void mi_check_print_error(HA_CHECK *param, const char *fmt,...)

=== modified file 'storage/myisam/mi_check.c'
--- storage/myisam/mi_check.c	2009-10-15 21:38:29 +0000
+++ storage/myisam/mi_check.c	2009-11-29 23:08:56 +0000
@@ -166,7 +166,7 @@
     empty=0;
     for (i= info->state->del ; i > 0L && next_link != HA_OFFSET_ERROR ; i--)
     {
-      if (*killed_ptr(param))
+      if (killed_ptr(param))
         DBUG_RETURN(1);
       if (test_flag & T_VERBOSE)
 	printf(" %9s",llstr(next_link,buff));
@@ -261,7 +261,7 @@
   records= (ha_rows) (info->state->key_file_length / block_size);
   while (next_link != HA_OFFSET_ERROR && records > 0)
   {
-    if (*killed_ptr(param))
+    if (killed_ptr(param))
       DBUG_RETURN(1);
     if (param->testflag & T_VERBOSE)
       printf("%16s",llstr(next_link,llbuff));
@@ -778,7 +778,7 @@
   }
   for ( ;; )
   {
-    if (*killed_ptr(param))
+    if (killed_ptr(param))
       goto err;
     memcpy((char*) info->lastkey,(char*) key,key_length);
     info->lastkey_length=key_length;
@@ -990,7 +990,7 @@
   bzero((char*) key_checksum, info->s->base.keys * sizeof(key_checksum[0]));
   while (pos < info->state->data_file_length)
   {
-    if (*killed_ptr(param))
+    if (killed_ptr(param))
       goto err2;
     switch (info->s->data_file_type) {
     case BLOCK_RECORD:
@@ -3247,7 +3247,7 @@
   char llbuff[22],llbuff2[22];
   DBUG_ENTER("sort_get_next_record");
 
-  if (*killed_ptr(param))
+  if (killed_ptr(param))
     DBUG_RETURN(1);
 
   switch (share->data_file_type) {

=== modified file 'storage/myisam/myisam_ftdump.c'
--- storage/myisam/myisam_ftdump.c	2007-05-10 09:59:39 +0000
+++ storage/myisam/myisam_ftdump.c	2009-11-29 23:08:56 +0000
@@ -113,7 +113,7 @@
 
     subkeys=ft_sintXkorr(info->lastkey+keylen+1);
     if (subkeys >= 0)
-      weight=*(float*)&subkeys;
+      weight= *(float*) (char*) &subkeys;
 
 #ifdef HAVE_SNPRINTF
     snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey+1);

=== modified file 'storage/myisam/myisamchk.c'
--- storage/myisam/myisamchk.c	2009-09-19 21:21:29 +0000
+++ storage/myisam/myisamchk.c	2009-11-29 23:08:56 +0000
@@ -1745,11 +1745,9 @@
   sorting
 */
 
-static int not_killed= 0;
-
-volatile int *killed_ptr(HA_CHECK *param __attribute__((unused)))
+int killed_ptr(HA_CHECK *param __attribute__((unused)))
 {
-  return &not_killed;			/* always NULL */
+  return 0;
 }
 
 	/* print warnings and errors */

=== modified file 'storage/myisam/myisamdef.h'
--- storage/myisam/myisamdef.h	2009-10-06 06:57:22 +0000
+++ storage/myisam/myisamdef.h	2009-11-29 23:08:56 +0000
@@ -725,7 +725,7 @@
 void mi_remap_file(MI_INFO *info, my_off_t size);
 
     /* Functions needed by mi_check */
-volatile int *killed_ptr(HA_CHECK *param);
+int killed_ptr(HA_CHECK *param);
 void mi_check_print_error _VARARGS((HA_CHECK *param, const char *fmt, ...));
 void mi_check_print_warning _VARARGS((HA_CHECK *param, const char *fmt, ...));
 void mi_check_print_info _VARARGS((HA_CHECK *param, const char *fmt, ...));

=== modified file 'storage/myisam/myisamlog.c'
--- storage/myisam/myisamlog.c	2008-02-18 22:35:17 +0000
+++ storage/myisam/myisamlog.c	2009-11-29 23:08:56 +0000
@@ -385,7 +385,7 @@
       file_info.name=0;
       file_info.show_name=0;
       file_info.record=0;
-      if (read_string(&cache,(uchar**) &file_info.name,
+      if (read_string(&cache,(uchar**) (char*) &file_info.name,
 		      (uint) mi_uint2korr(head)))
 	goto err;
       {

=== modified file 'storage/myisam/sort.c'
--- storage/myisam/sort.c	2009-10-15 21:38:29 +0000
+++ storage/myisam/sort.c	2009-11-29 23:08:56 +0000
@@ -900,7 +900,6 @@
   uchar *strpos;
   BUFFPEK *buffpek,**refpek;
   QUEUE queue;
-  volatile int *killed= killed_ptr(info->sort_info->param);
   DBUG_ENTER("merge_buffers");
 
   count=error=0;
@@ -933,10 +932,6 @@
   {
     for (;;)
     {
-      if (*killed)
-      {
-        error=1; goto err;
-      }
       buffpek=(BUFFPEK*) queue_top(&queue);
       if (to_file)
       {
@@ -956,6 +951,12 @@
       buffpek->key+=sort_length;
       if (! --buffpek->mem_count)
       {
+        /* It's enough to check for killedptr before a slow operation */
+        if (killed_ptr(info->sort_info->param))
+        {
+          error=1;
+          goto err;
+        }
         if (!(error=(int) info->read_to_buffer(from_file,buffpek,sort_length)))
         {
           uchar *base= buffpek->base;

=== modified file 'storage/xtradb/fil/fil0fil.c'
--- storage/xtradb/fil/fil0fil.c	2009-11-13 21:26:08 +0000
+++ storage/xtradb/fil/fil0fil.c	2009-11-29 23:08:56 +0000
@@ -3139,7 +3139,7 @@
 				if (mach_read_from_4(page + FIL_PAGE_OFFSET) || !offset) {
 					mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, id);
 
-					for (i = 0; i < n_index; i++) {
+					for (i = 0; (ulint) i < n_index; i++) {
 						if (offset / UNIV_PAGE_SIZE == root_page[i]) {
 							/* this is index root page */
 							mach_write_to_4(page + FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF

=== modified file 'storage/xtradb/trx/trx0i_s.c'
--- storage/xtradb/trx/trx0i_s.c	2009-09-07 10:22:53 +0000
+++ storage/xtradb/trx/trx0i_s.c	2009-11-29 23:08:56 +0000
@@ -28,11 +28,11 @@
 Created July 17, 2007 Vasil Dimov
 *******************************************************/
 
-#include <mysql/plugin.h>
 
 #include "mysql_addons.h"
 
 #include "univ.i"
+#include <mysql/plugin.h>
 #include "buf0buf.h"
 #include "dict0dict.h"
 #include "ha0storage.h"