LTP GCOV extension - code coverage report
Current view: directory - storage/maria - ma_check_standalone.h
Test: mtr_and_unit.info
Date: 2009-03-05 Instrumented lines: 42
Code covered: 42.9 % Executed lines: 18

       1                 : /* Copyright (C) 2007 MySQL AB
       2                 : 
       3                 :    This program is free software; you can redistribute it and/or modify
       4                 :    it under the terms of the GNU General Public License as published by
       5                 :    the Free Software Foundation; version 2 of the License.
       6                 : 
       7                 :    This program is distributed in the hope that it will be useful,
       8                 :    but WITHOUT ANY WARRANTY; without even the implied warranty of
       9                 :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      10                 :    GNU General Public License for more details.
      11                 : 
      12                 :    You should have received a copy of the GNU General Public License
      13                 :    along with this program; if not, write to the Free Software
      14                 :    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
      15                 : 
      16                 : /*
      17                 :   All standalone programs which need to use functions from ma_check.c
      18                 :   (like maria_repair()) must define their version of _ma_killed_ptr()
      19                 :   and _ma_check_print_info|warning|error(). Indeed, linking with ma_check.o
      20                 :   brings in the dependencies of ma_check.o which are definitions of the above
      21                 :   functions; if the program does not define them then the ones of
      22                 :   ha_maria.o are used i.e. ha_maria.o is linked into the program, and this
      23                 :   brings dependencies of ha_maria.o on mysqld.o into the program's linking
      24                 :   which thus fails, as the program is not linked with mysqld.o.
      25                 :   This file contains the versions of these functions used by maria_chk and
      26                 :   maria_read_log.
      27                 : */
      28                 : 
      29                 : /*
      30                 :   Check if check/repair operation was killed by a signal
      31                 : */
      32                 : 
      33                 : static int not_killed= 0;
      34                 : 
      35                 : volatile int *_ma_killed_ptr(HA_CHECK *param __attribute__((unused)))
      36          429099 : {
      37          429099 :   return &not_killed;                       /* always NULL */
      38                 : }
      39                 : 
      40                 :         /* print warnings and errors */
      41                 :         /* VARARGS */
      42                 : 
      43                 : void _ma_check_print_info(HA_CHECK *param __attribute__((unused)),
      44                 :                          const char *fmt,...)
      45               0 : {
      46                 :   va_list args;
      47               0 :   DBUG_ENTER("_ma_check_print_info");
      48               0 :   DBUG_PRINT("enter", ("format: %s", fmt));
      49                 : 
      50               0 :   va_start(args,fmt);
      51               0 :   VOID(vfprintf(stdout, fmt, args));
      52               0 :   VOID(fputc('\n',stdout));
      53               0 :   va_end(args);
      54               0 :   DBUG_VOID_RETURN;
      55                 : }
      56                 : 
      57                 : /* VARARGS */
      58                 : 
      59                 : void _ma_check_print_warning(HA_CHECK *param, const char *fmt,...)
      60              86 : {
      61                 :   va_list args;
      62              86 :   DBUG_ENTER("_ma_check_print_warning");
      63              86 :   DBUG_PRINT("enter", ("format: %s", fmt));
      64                 : 
      65              86 :   fflush(stdout);
      66              86 :   if (!param->warning_printed && !param->error_printed)
      67                 :   {
      68              11 :     if (param->testflag & T_SILENT)
      69              11 :       fprintf(stderr,"%s: MARIA file %s\n",my_progname_short,
      70                 :               param->isam_file_name);
      71              11 :     param->out_flag|= O_DATA_LOST;
      72                 :   }
      73              86 :   param->warning_printed=1;
      74              86 :   va_start(args,fmt);
      75              86 :   fprintf(stderr,"%s: warning: ",my_progname_short);
      76              86 :   VOID(vfprintf(stderr, fmt, args));
      77              86 :   VOID(fputc('\n',stderr));
      78              86 :   fflush(stderr);
      79              86 :   va_end(args);
      80              86 :   DBUG_VOID_RETURN;
      81                 : }
      82                 : 
      83                 : /* VARARGS */
      84                 : 
      85                 : void _ma_check_print_error(HA_CHECK *param, const char *fmt,...)
      86               0 : {
      87                 :   va_list args;
      88               0 :   DBUG_ENTER("_ma_check_print_error");
      89               0 :   DBUG_PRINT("enter", ("format: %s", fmt));
      90                 : 
      91               0 :   fflush(stdout);
      92               0 :   if (!param->warning_printed && !param->error_printed)
      93                 :   {
      94               0 :     if (param->testflag & T_SILENT)
      95               0 :       fprintf(stderr,"%s: MARIA file %s\n",my_progname_short,param->isam_file_name);
      96               0 :     param->out_flag|= O_DATA_LOST;
      97                 :   }
      98               0 :   param->error_printed|=1;
      99               0 :   va_start(args,fmt);
     100               0 :   fprintf(stderr,"%s: error: ",my_progname_short);
     101               0 :   VOID(vfprintf(stderr, fmt, args));
     102               0 :   VOID(fputc('\n',stderr));
     103               0 :   fflush(stderr);
     104               0 :   va_end(args);
     105               0 :   DBUG_VOID_RETURN;
     106                 : }

Generated by: LTP GCOV extension version 1.4