Commit 4736d0fe authored by unknown's avatar unknown
Browse files

Review of all code pushed since last review

Simple optimzations and cleanups
Removed compiler warnings and fixed portability issues
Added client functions 'mysql_embedded()' to allow client to check if we are using embedded server
Fixes for purify


client/mysqlimport.c:
  Remove not used variable
client/mysqltest.c:
  Remove usage of MAXPATHLEN (all MySQL code uses FN_REFLEN)
  Simplified code
  Remove usage of sprintf("%llu") as this is not portable
include/mysql.h:
  Added mysql_embedded() to be able to easily check if we are using the embedded server
innobase/srv/srv0start.c:
  Don't use memcmp() when using purify (to avoid false warnings)
libmysql/libmysql.c:
  Added mysql_embedded() to be able to easily check if we are using the embedded server
libmysql/libmysql.def:
  Added mysql_embedded() to be able to easily check if we are using the embedded server
myisam/myisam_ftdump.c:
  Remove compiler warning
myisam/myisamchk.c:
  Remove compiler warning
myisam/rt_test.c:
  #ifdef not used code
mysys/hash.c:
  Remove compiler warning (from last push)
mysys/my_gethwaddr.c:
  Remove compiler warning
ndb/src/ndbapi/ndberror.c:
  #ifdef not used code
regex/regcomp.c:
  Remove not used code
regex/regcomp.ih:
  Remove not used code (to remove compiler warnings)
sql-common/client.c:
  Remove compiler warnings
sql/field.cc:
  Simple optimization
sql/ha_innodb.cc:
  Rename mysql_embedded -> mysqld_embedded
sql/item.cc:
  Fix comments
  Move variables first on block
  Remove else after return
  Simple optimizations
  (no logic changes)
sql/item_cmpfunc.cc:
  Added comment
sql/mysql_priv.h:
  Rename mysql_embedded -> mysqld_embedded
sql/mysqld.cc:
  Rename mysql_embedded -> mysqld_embedded
sql/sql_acl.cc:
  Added comments
  simple optimization
  Fixed 'very unlikely' bug when doing REVOKE ALL PRIVILEGES
sql/sql_select.cc:
  More comments
  Simple optimization
sql/sql_show.cc:
  Simple changes to make similar code similar
  More comments
sql/sql_string.cc:
  Trivial optimization and better code layout
strings/Makefile.am:
  Change xml.c to use bcmp to avoid warnings from purify
strings/xml.c:
  Change xml.c to use bcmp to avoid warnings from purify
tests/client_test.c:
  Remove usage of MAXPATHLEN (all MySQL code uses FN_REFLEN)
parent 46b10a30
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -264,7 +264,6 @@ static int write_to_table(char *filename, MYSQL *sock)
{
  char tablename[FN_REFLEN], hard_path[FN_REFLEN],
       sql_statement[FN_REFLEN*16+256], *end;
  my_bool local_file;
  DBUG_ENTER("write_to_table");
  DBUG_PRINT("enter",("filename: %s",filename));

+7 −15
Original line number Diff line number Diff line
@@ -58,13 +58,6 @@
#include <stdarg.h>
#include <sys/stat.h>
#include <violite.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif

#ifndef MAXPATHLEN
#define MAXPATHLEN 256
#endif

#define MAX_QUERY     131072
#define MAX_VAR_NAME	256
@@ -2105,10 +2098,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
      embedded_server_arg_count=1;
      embedded_server_args[0]= (char*) "";
    }
    embedded_server_args[embedded_server_arg_count++]=
      my_strdup(argument, MYF(MY_FAE));
    if (embedded_server_arg_count == MAX_SERVER_ARGS ||
	!embedded_server_args[embedded_server_arg_count-1])
    if (embedded_server_arg_count == MAX_SERVER_ARGS-1 ||
        !(embedded_server_args[embedded_server_arg_count++]=
          my_strdup(argument, MYF(MY_FAE))))
    {
      die("Can't use server argument");
    }
@@ -2166,7 +2158,7 @@ char* safe_str_append(char* buf, const char* str, int size)
void str_to_file(const char* fname, char* str, int size)
{
  int fd;
  char buff[MAXPATHLEN];
  char buff[FN_REFLEN];
  if (!test_if_hard_path(fname))
  {
    strxmov(buff, opt_basedir, fname, NullS);
@@ -2979,10 +2971,10 @@ static void timer_output(void)
{
  if (timer_file)
  {
    char buf[1024];
    char buf[32], *end;
    ulonglong timer= timer_now() - timer_start;
    sprintf(buf,"%llu",timer);
    str_to_file(timer_file,buf,strlen(buf));
    end= longlong2str(timer, buf, 10);
    str_to_file(timer_file,buf, (int) (end-buf));
  }
}

+1 −0
Original line number Diff line number Diff line
@@ -506,6 +506,7 @@ char * STDCALL mysql_odbc_escape_string(MYSQL *mysql,
						  unsigned long *length));
void 		STDCALL myodbc_remove_escape(MYSQL *mysql,char *name);
unsigned int	STDCALL mysql_thread_safe(void);
my_bool		STDCALL mysql_embedded(void);
MYSQL_MANAGER*  STDCALL mysql_manager_init(MYSQL_MANAGER* con);  
MYSQL_MANAGER*  STDCALL mysql_manager_connect(MYSQL_MANAGER* con,
					      const char* host,
+13 −0
Original line number Diff line number Diff line
@@ -95,6 +95,19 @@ static char* srv_monitor_file_name;
#define SRV_N_PENDING_IOS_PER_THREAD 	OS_AIO_N_PENDING_IOS_PER_THREAD
#define SRV_MAX_N_PENDING_SYNC_IOS	100


/* Avoid warnings when using purify */

#ifdef HAVE_purify
static int inno_bcmp(register const char *s1, register const char *s2,
                     register uint len)
{
  while (len-- != 0 && *s1++ == *s2++) ;
  return len+1;
}
#define memcmp(A,B,C) inno_bcmp((A),(B),(C))
#endif

/*************************************************************************
Reads the data files and their sizes from a character string given in
the .cnf file. */
+10 −0
Original line number Diff line number Diff line
@@ -1516,6 +1516,16 @@ uint STDCALL mysql_thread_safe(void)
#endif
}


my_bool STDCALL mysql_embedded(void)
{
#ifdef EMBEDDED_LIBRARY
  return 1;
#else
  return 0;
#endif
}

/****************************************************************************
  Some support functions
****************************************************************************/
Loading