~ubuntu-branches/ubuntu/maverick/mysql-5.1/maverick-proposed

« back to all changes in this revision

Viewing changes to include/my_global.h

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 14:16:05 UTC
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: package-import@ubuntu.com-20120222141605-nxlu9yzc6attylc2
Tags: upstream-5.1.61
ImportĀ upstreamĀ versionĀ 5.1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2000-2003 MySQL AB
 
1
/*
 
2
   Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
2
3
 
3
4
   This program is free software; you can redistribute it and/or modify
4
5
   it under the terms of the GNU General Public License as published by
11
12
 
12
13
   You should have received a copy of the GNU General Public License
13
14
   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
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
 
16
*/
15
17
 
16
18
/* This is the include file that should be included 'first' in every C file. */
17
19
 
359
361
#define ulonglong2double(A) my_ulonglong2double(A)
360
362
#define my_off_t2double(A)  my_ulonglong2double(A)
361
363
C_MODE_START
362
 
double my_ulonglong2double(unsigned long long A);
 
364
inline double my_ulonglong2double(unsigned long long A) { return (double) A; }
363
365
C_MODE_END
364
366
#endif /* _AIX */
365
367
 
556
558
#endif
557
559
#endif /* DONT_DEFINE_VOID */
558
560
 
559
 
#if defined(_lint) || defined(FORCE_INIT_OF_VARS)
560
 
#define LINT_INIT(var)  var=0                   /* No uninitialize-warning */
 
561
/*
 
562
  Deprecated workaround for false-positive uninitialized variables
 
563
  warnings. Those should be silenced using tool-specific heuristics.
 
564
 
 
565
  Enabled by default for g++ due to the bug referenced below.
 
566
*/
 
567
#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
 
568
    (defined(__GNUC__) && defined(__cplusplus))
 
569
#define LINT_INIT(var) var= 0
561
570
#else
562
571
#define LINT_INIT(var)
563
572
#endif
564
573
 
565
 
/* 
 
574
/*
566
575
   Suppress uninitialized variable warning without generating code.
567
576
 
568
577
   The _cplusplus is a temporary workaround for C++ code pending a fix
569
 
   for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772). 
 
578
   for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772).
570
579
*/
571
 
#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(__cplusplus) || \
572
 
  !defined(__GNUC__)
 
580
#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
 
581
    defined(__cplusplus) || !defined(__GNUC__)
573
582
#define UNINIT_VAR(x) x= 0
574
583
#else
 
584
/* GCC specific self-initialization which inhibits the warning. */
575
585
#define UNINIT_VAR(x) x= x
576
586
#endif
577
587
 
595
605
#define set_if_bigger(a,b)  do { if ((a) < (b)) (a)=(b); } while(0)
596
606
#define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0)
597
607
#define test_all_bits(a,b) (((a) & (b)) == (b))
598
 
#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1))
599
608
#define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))
600
609
 
601
610
/* Define some general constants */
616
625
#define my_const_cast(A) (A)
617
626
#endif
618
627
 
619
 
#include <my_attribute.h>
 
628
#include <my_compiler.h>
620
629
 
621
630
/*
622
631
  Wen using the embedded library, users might run into link problems,
751
760
 
752
761
#ifndef FN_LIBCHAR
753
762
#define FN_LIBCHAR      '/'
 
763
#define FN_DIRSEP       "/"     /* Valid directory separators */
754
764
#define FN_ROOTDIR      "/"
755
765
#endif
756
766
#define MY_NFILE        64      /* This is only used to save filenames */
934
944
#define ADD_TO_PTR(ptr,size,type) (type) ((uchar*) (ptr)+size)
935
945
#define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((uchar*) (A) - (uchar*) (B))
936
946
 
937
 
#define MY_DIV_UP(A, B) (((A) + (B) - 1) / (B))
938
 
#define MY_ALIGNED_BYTE_ARRAY(N, S, T) T N[MY_DIV_UP(S, sizeof(T))]
939
 
 
940
947
/*
941
948
  Custom version of standard offsetof() macro which can be used to get
942
949
  offsets of members in class for non-POD types (according to the current
1460
1467
 
1461
1468
#endif /* WORDS_BIGENDIAN */
1462
1469
 
1463
 
/* sprintf does not always return the number of bytes :- */
1464
 
#ifdef SPRINTF_RETURNS_INT
1465
 
#define my_sprintf(buff,args) sprintf args
1466
 
#else
1467
 
#ifdef SPRINTF_RETURNS_PTR
1468
 
#define my_sprintf(buff,args) ((int)(sprintf args - buff))
1469
 
#else
1470
 
#define my_sprintf(buff,args) ((ulong) sprintf args, (ulong) strlen(buff))
1471
 
#endif
1472
 
#endif
1473
 
 
1474
1470
#ifndef THREAD
1475
1471
#define thread_safe_increment(V,L) (V)++
1476
1472
#define thread_safe_decrement(V,L) (V)--