mirror of
				https://github.com/MariaDB/server.git
				synced 2025-11-04 04:46:15 +01:00 
			
		
		
		
	Dead code cleanup: part_info->num_parts usage was wrong and working incorrectly in mysql_drop_partitions() because num_parts is already updated in prep_alter_part_table(). We don't have to update part_info->partitions because part_info is destroyed at alter_partition_lock_handling(). Cleanups: - DBUG_EVALUATE_IF() macro replaced by shorter form DBUG_IF(); - Typo in ER_KEY_COLUMN_DOES_NOT_EXITS. Refactorings: - Splitted write_log_replace_delete_frm() into write_log_delete_frm() and write_log_replace_frm(); - partition_info via DDL_LOG_STATE; - set_part_info_exec_log_entry() removed. DBUG_EVALUATE removed DBUG_EVALUTATE was only added for consistency together with DBUG_EVALUATE_IF. It is not used anywhere in the code. DBUG_SUICIDE() fix on release build On release DBUG_SUICIDE() was statement. It was wrong as DBUG_SUICIDE() is used in expression context.
		
			
				
	
	
		
			99 lines
		
	
	
	
		
			1.9 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			99 lines
		
	
	
	
		
			1.9 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/*
 | 
						|
  A program to test DBUG features. Used by tests-t.pl
 | 
						|
*/
 | 
						|
 | 
						|
char *push1=0;
 | 
						|
 | 
						|
#ifndef DBUG_TRACE
 | 
						|
#define DBUG_TRACE
 | 
						|
#endif
 | 
						|
 | 
						|
#include <my_global.h>  /* This includes dbug.h */
 | 
						|
#include <my_sys.h>
 | 
						|
#include <my_pthread.h>
 | 
						|
#include <string.h>
 | 
						|
 | 
						|
const char *func3()
 | 
						|
{
 | 
						|
  DBUG_ENTER("func3");
 | 
						|
  DBUG_EXECUTE("ret3", DBUG_RETURN("ok"););
 | 
						|
  DBUG_RETURN("ko");
 | 
						|
}
 | 
						|
 | 
						|
void func2()
 | 
						|
{
 | 
						|
  const char *s __attribute__((unused));
 | 
						|
  DBUG_ENTER("func2");
 | 
						|
  s=func3();
 | 
						|
  DBUG_PRINT("info", ("s=%s", s));
 | 
						|
  DBUG_VOID_RETURN;
 | 
						|
}
 | 
						|
 | 
						|
int func1()
 | 
						|
{
 | 
						|
  DBUG_ENTER("func1");
 | 
						|
  func2();
 | 
						|
  if (push1)
 | 
						|
  {
 | 
						|
    DBUG_PUSH(push1);
 | 
						|
    fprintf(DBUG_FILE, "=> push1\n");
 | 
						|
  }
 | 
						|
  DBUG_RETURN(10);
 | 
						|
}
 | 
						|
 | 
						|
int main (int argc __attribute__((unused)),
 | 
						|
          char *argv[] __attribute__((unused)))
 | 
						|
{
 | 
						|
#ifdef DBUG_OFF
 | 
						|
  return 1;
 | 
						|
#else
 | 
						|
  int i;
 | 
						|
  if (argc == 1)
 | 
						|
    return 0;
 | 
						|
 | 
						|
  MY_INIT("dbug-tests");
 | 
						|
 | 
						|
  dup2(1, 2);
 | 
						|
  for (i = 1; i < argc; i++)
 | 
						|
  {
 | 
						|
    if (strncmp(argv[i], "--push1=", 8) == 0)
 | 
						|
      push1=argv[i]+8;
 | 
						|
    else
 | 
						|
      DBUG_PUSH (argv[i]);
 | 
						|
  }
 | 
						|
  {
 | 
						|
    DBUG_ENTER ("main");
 | 
						|
    func1();
 | 
						|
    DBUG_EXECUTE_IF("dump",
 | 
						|
    {
 | 
						|
      char s[1000];
 | 
						|
      DBUG_EXPLAIN(s, sizeof(s)-1);
 | 
						|
      DBUG_DUMP("dump", (uchar*)s, strlen(s));
 | 
						|
    });
 | 
						|
    DBUG_EXECUTE_IF("push",  DBUG_PUSH("+t"); );
 | 
						|
    DBUG_EXECUTE("execute", fprintf(DBUG_FILE, "=> execute\n"); );
 | 
						|
    DBUG_EXECUTE_IF("set",  DBUG_SET("+F"); );
 | 
						|
    fprintf(DBUG_FILE, "=> evaluate_if: %s\n",
 | 
						|
            (DBUG_IF("evaluate_if") ? "ON": "OFF"));
 | 
						|
    DBUG_EXECUTE_IF("pop",  DBUG_POP(); );
 | 
						|
    {
 | 
						|
      char s[1000] __attribute__((unused));
 | 
						|
      DBUG_EXPLAIN(s, sizeof(s)-1);
 | 
						|
      DBUG_PRINT("explain", ("dbug explained: %s", s));
 | 
						|
    }
 | 
						|
    func2();
 | 
						|
    DBUG_LEAVE;
 | 
						|
  }
 | 
						|
  DBUG_SET(""); /* to not have my_end() in the traces */
 | 
						|
  my_end(0);
 | 
						|
  return 0;
 | 
						|
#endif /* DBUG_OFF */
 | 
						|
}
 | 
						|
 | 
						|
#ifdef __SANITIZE_ADDRESS__
 | 
						|
/* Disable LeakSanitizer in this executable */
 | 
						|
const char* __asan_default_options()
 | 
						|
{
 | 
						|
  return "detect_leaks=0";
 | 
						|
}
 | 
						|
#endif
 |