summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKent Boortz <kent.boortz@oracle.com>2011-07-03 17:47:37 +0200
committerKent Boortz <kent.boortz@oracle.com>2011-07-03 17:47:37 +0200
commit027b5f1ed4f0130bbbc174eb45162a402c65f43f (patch)
tree448d397ed328f719a29a8fbbd54df8d943ed7274 /include
parent68f00a56868c5ca21b2d51598e1a43969ecf4896 (diff)
parentdd4957965411c1b67ebfb1ba8650a3090d305f63 (diff)
downloadmariadb-git-027b5f1ed4f0130bbbc174eb45162a402c65f43f.tar.gz
Updated/added copyright headers
Diffstat (limited to 'include')
-rw-r--r--include/Makefile.am4
-rw-r--r--include/heap.h4
-rw-r--r--include/m_string.h4
-rw-r--r--include/my_bit.h13
-rw-r--r--include/my_bitmap.h9
-rw-r--r--include/my_compare.h89
-rw-r--r--include/my_getopt.h6
-rw-r--r--include/my_global.h4
-rw-r--r--include/my_handler.h128
-rw-r--r--include/myisam.h26
10 files changed, 138 insertions, 149 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
index ae7f07e472e..0cb8557aeb5 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,4 +1,4 @@
-# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@@ -37,7 +37,7 @@ noinst_HEADERS = config-win.h config-netware.h my_bit.h \
my_nosys.h my_alarm.h queues.h rijndael.h sha1.h \
my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \
thr_lock.h t_ctype.h violite.h my_md5.h base64.h \
- my_handler.h my_time.h my_vle.h my_user.h \
+ my_compare.h my_time.h my_vle.h my_user.h \
my_libwrap.h my_stacktrace.h
EXTRA_DIST = mysql.h.pp mysql/plugin.h.pp
diff --git a/include/heap.h b/include/heap.h
index 4a1c7d419ed..0abdd71461e 100644
--- a/include/heap.h
+++ b/include/heap.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000,2004 MySQL AB
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ extern "C" {
#include <thr_lock.h>
#endif
-#include "my_handler.h"
+#include "my_compare.h"
#include "my_tree.h"
/* defines used by heap-funktions */
diff --git a/include/m_string.h b/include/m_string.h
index 2f5137cfa17..0e0090f52e6 100644
--- a/include/m_string.h
+++ b/include/m_string.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -60,7 +60,7 @@
# define bfill(A,B,C) memset((A),(C),(B))
#endif
-#if !defined(bzero) && !defined(HAVE_BZERO)
+#if !defined(bzero) && (!defined(HAVE_BZERO) || !defined(HAVE_DECL_BZERO))
# define bzero(A,B) memset((A),0,(B))
#endif
diff --git a/include/my_bit.h b/include/my_bit.h
index 0255d2a77c8..1e0a7488a81 100644
--- a/include/my_bit.h
+++ b/include/my_bit.h
@@ -1,5 +1,5 @@
-/* Copyright (c) 2007 MySQL AB
- Use is subject to license terms.
+/*
+ Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -58,9 +58,12 @@ STATIC_INLINE uint my_count_bits(ulonglong v)
#endif
}
-STATIC_INLINE uint my_count_bits_ushort(ushort v)
+STATIC_INLINE uint my_count_bits_uint32(uint32 v)
{
- return _my_bits_nbits[v];
+ return (uint) (uchar) (_my_bits_nbits[(uchar) v] +
+ _my_bits_nbits[(uchar) (v >> 8)] +
+ _my_bits_nbits[(uchar) (v >> 16)] +
+ _my_bits_nbits[(uchar) (v >> 24)]);
}
@@ -120,6 +123,6 @@ extern uint32 my_round_up_to_next_power(uint32 v);
uint32 my_clear_highest_bit(uint32 v);
uint32 my_reverse_bits(uint32 key);
extern uint my_count_bits(ulonglong v);
-extern uint my_count_bits_ushort(ushort v);
+extern uint my_count_bits_uint32(uint32 v);
#endif /* HAVE_INLINE */
C_MODE_END
diff --git a/include/my_bitmap.h b/include/my_bitmap.h
index 2c01254f203..34c9ac9bb96 100644
--- a/include/my_bitmap.h
+++ b/include/my_bitmap.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -151,9 +151,10 @@ bitmap_is_set(const MY_BITMAP *map,uint bit)
static inline my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2)
{
- *(map1)->last_word_ptr|= (map1)->last_word_mask;
- *(map2)->last_word_ptr|= (map2)->last_word_mask;
- return memcmp((map1)->bitmap, (map2)->bitmap, 4*no_words_in_map((map1)))==0;
+ if (memcmp(map1->bitmap, map2->bitmap, 4*(no_words_in_map(map1)-1)) != 0)
+ return FALSE;
+ return ((*map1->last_word_ptr | map1->last_word_mask) ==
+ (*map2->last_word_ptr | map2->last_word_mask));
}
#define bitmap_clear_all(MAP) \
diff --git a/include/my_compare.h b/include/my_compare.h
new file mode 100644
index 00000000000..dedae5c8052
--- /dev/null
+++ b/include/my_compare.h
@@ -0,0 +1,89 @@
+/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef _my_compare_h
+#define _my_compare_h
+
+#include "my_base.h"
+#include "m_ctype.h"
+#include "myisampack.h"
+
+typedef struct st_HA_KEYSEG /* Key-portion */
+{
+ CHARSET_INFO *charset;
+ uint32 start; /* Start of key in record */
+ uint32 null_pos; /* position to NULL indicator */
+ uint16 bit_pos; /* Position to bit part */
+ uint16 flag;
+ uint16 length; /* Keylength */
+ uint8 type; /* Type of key (for sort) */
+ uint8 language;
+ uint8 null_bit; /* bitmask to test for NULL */
+ uint8 bit_start,bit_end; /* if bit field */
+ uint8 bit_length; /* Length of bit part */
+} HA_KEYSEG;
+
+#define get_key_length(length,key) \
+{ if ((uchar) *(key) != 255) \
+ length= (uint) (uchar) *((key)++); \
+ else \
+ { length=mi_uint2korr((key)+1); (key)+=3; } \
+}
+
+#define get_key_length_rdonly(length,key) \
+{ if ((uchar) *(key) != 255) \
+ length= ((uint) (uchar) *((key))); \
+ else \
+ { length=mi_uint2korr((key)+1); } \
+}
+
+#define get_key_pack_length(length,length_pack,key) \
+{ if ((uchar) *(key) != 255) \
+ { length= (uint) (uchar) *((key)++); length_pack=1; }\
+ else \
+ { length=mi_uint2korr((key)+1); (key)+=3; length_pack=3; } \
+}
+
+#define store_key_length_inc(key,length) \
+{ if ((length) < 255) \
+ { *(key)++=(length); } \
+ else \
+ { *(key)=255; mi_int2store((key)+1,(length)); (key)+=3; } \
+}
+
+#define get_rec_bits(bit_ptr, bit_ofs, bit_len) \
+ (((((uint16) (bit_ptr)[1] << 8) | (uint16) (bit_ptr)[0]) >> (bit_ofs)) & \
+ ((1 << (bit_len)) - 1))
+
+#define set_rec_bits(bits, bit_ptr, bit_ofs, bit_len) \
+{ \
+ (bit_ptr)[0]= ((bit_ptr)[0] & ~(((1 << (bit_len)) - 1) << (bit_ofs))) | \
+ ((bits) << (bit_ofs)); \
+ if ((bit_ofs) + (bit_len) > 8) \
+ (bit_ptr)[1]= ((bit_ptr)[1] & ~((1 << ((bit_len) - 8 + (bit_ofs))) - 1)) | \
+ ((bits) >> (8 - (bit_ofs))); \
+}
+
+#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \
+ set_rec_bits(0, bit_ptr, bit_ofs, bit_len)
+
+extern int ha_compare_text(CHARSET_INFO *, uchar *, uint, uchar *, uint ,
+ my_bool, my_bool);
+extern int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
+ register uchar *b, uint key_length, uint nextflag,
+ uint *diff_pos);
+
+
+#endif /* _my_compare_h */
diff --git a/include/my_getopt.h b/include/my_getopt.h
index 43feac3fa43..8112303a6a5 100644
--- a/include/my_getopt.h
+++ b/include/my_getopt.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -61,7 +61,9 @@ struct my_option
};
typedef my_bool (*my_get_one_option)(int, const struct my_option *, char *);
-typedef void (*my_error_reporter)(enum loglevel level, const char *format, ...);
+typedef void (*my_error_reporter)(enum loglevel level, const char *format, ...)
+ ATTRIBUTE_FORMAT_FPTR(printf, 2, 3);
+
/**
Used to retrieve a reference to the object (variable) that holds the value
for the given option. For example, if var_type is GET_UINT, the function
diff --git a/include/my_global.h b/include/my_global.h
index fdb67e8dc4f..8f4b67855db 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -361,7 +361,7 @@ C_MODE_END
#define ulonglong2double(A) my_ulonglong2double(A)
#define my_off_t2double(A) my_ulonglong2double(A)
C_MODE_START
-double my_ulonglong2double(unsigned long long A);
+inline double my_ulonglong2double(unsigned long long A) { return (double) A; }
C_MODE_END
#endif /* _AIX */
diff --git a/include/my_handler.h b/include/my_handler.h
deleted file mode 100644
index 7dfdb345a89..00000000000
--- a/include/my_handler.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/* Copyright (C) 2002-2006 MySQL AB
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; version 2
- of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA */
-
-#ifndef _my_handler_h
-#define _my_handler_h
-
-#include "myisampack.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- There is a hard limit for the maximum number of keys as there are only
- 8 bits in the index file header for the number of keys in a table.
- This means that 0..255 keys can exist for a table. The idea of
- HA_MAX_POSSIBLE_KEY is to ensure that one can use myisamchk & tools on
- a MyISAM table for which one has more keys than MyISAM is normally
- compiled for. If you don't have this, you will get a core dump when
- running myisamchk compiled for 128 keys on a table with 255 keys.
-*/
-
-#define HA_MAX_POSSIBLE_KEY 255 /* For myisamchk */
-/*
- The following defines can be increased if necessary.
- But beware the dependency of MI_MAX_POSSIBLE_KEY_BUFF and HA_MAX_KEY_LENGTH.
-*/
-
-#define HA_MAX_KEY_LENGTH 1000 /* Max length in bytes */
-#define HA_MAX_KEY_SEG 16 /* Max segments for key */
-
-#define HA_MAX_POSSIBLE_KEY_BUFF (HA_MAX_KEY_LENGTH + 24+ 6+6)
-#define HA_MAX_KEY_BUFF (HA_MAX_KEY_LENGTH+HA_MAX_KEY_SEG*6+8+8)
-
-typedef struct st_HA_KEYSEG /* Key-portion */
-{
- CHARSET_INFO *charset;
- uint32 start; /* Start of key in record */
- uint32 null_pos; /* position to NULL indicator */
- uint16 bit_pos; /* Position to bit part */
- uint16 flag;
- uint16 length; /* Keylength */
- uint8 type; /* Type of key (for sort) */
- uint8 language;
- uint8 null_bit; /* bitmask to test for NULL */
- uint8 bit_start,bit_end; /* if bit field */
- uint8 bit_length; /* Length of bit part */
-} HA_KEYSEG;
-
-#define get_key_length(length,key) \
-{ if (*(uchar*) (key) != 255) \
- length= (uint) *(uchar*) ((key)++); \
- else \
- { length= mi_uint2korr((key)+1); (key)+=3; } \
-}
-
-#define get_key_length_rdonly(length,key) \
-{ if (*(uchar*) (key) != 255) \
- length= ((uint) *(uchar*) ((key))); \
- else \
- { length= mi_uint2korr((key)+1); } \
-}
-
-#define get_key_pack_length(length,length_pack,key) \
-{ if (*(uchar*) (key) != 255) \
- { length= (uint) *(uchar*) ((key)++); length_pack= 1; }\
- else \
- { length=mi_uint2korr((key)+1); (key)+= 3; length_pack= 3; } \
-}
-
-#define store_key_length_inc(key,length) \
-{ if ((length) < 255) \
- { *(key)++= (length); } \
- else \
- { *(key)=255; mi_int2store((key)+1,(length)); (key)+=3; } \
-}
-
-#define size_to_store_key_length(length) ((length) < 255 ? 1 : 3)
-
-#define get_rec_bits(bit_ptr, bit_ofs, bit_len) \
- (((((uint16) (bit_ptr)[1] << 8) | (uint16) (bit_ptr)[0]) >> (bit_ofs)) & \
- ((1 << (bit_len)) - 1))
-
-#define set_rec_bits(bits, bit_ptr, bit_ofs, bit_len) \
-{ \
- (bit_ptr)[0]= ((bit_ptr)[0] & ~(((1 << (bit_len)) - 1) << (bit_ofs))) | \
- ((bits) << (bit_ofs)); \
- if ((bit_ofs) + (bit_len) > 8) \
- (bit_ptr)[1]= ((bit_ptr)[1] & ~((1 << ((bit_len) - 8 + (bit_ofs))) - 1)) | \
- ((bits) >> (8 - (bit_ofs))); \
-}
-
-#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \
- set_rec_bits(0, bit_ptr, bit_ofs, bit_len)
-
-extern int ha_compare_text(CHARSET_INFO *, uchar *, uint, uchar *, uint ,
- my_bool, my_bool);
-extern int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
- register uchar *b, uint key_length, uint nextflag,
- uint *diff_pos);
-
-extern HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, uchar *a);
-extern void my_handler_error_register(void);
-extern void my_handler_error_unregister(void);
-/*
- Inside an in-memory data record, memory pointers to pieces of the
- record (like BLOBs) are stored in their native byte order and in
- this amount of bytes.
-*/
-#define portable_sizeof_char_ptr 8
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _my_handler_h */
diff --git a/include/myisam.h b/include/myisam.h
index 459943d89ae..92e6699896a 100644
--- a/include/myisam.h
+++ b/include/myisam.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -32,8 +32,30 @@ extern "C" {
#ifndef _keycache_h
#include "keycache.h"
#endif
-#include "my_handler.h"
#include <mysql/plugin.h>
+#include "my_compare.h"
+
+/*
+ There is a hard limit for the maximum number of keys as there are only
+ 8 bits in the index file header for the number of keys in a table.
+ This means that 0..255 keys can exist for a table. The idea of
+ HA_MAX_POSSIBLE_KEY is to ensure that one can use myisamchk & tools on
+ a MyISAM table for which one has more keys than MyISAM is normally
+ compiled for. If you don't have this, you will get a core dump when
+ running myisamchk compiled for 128 keys on a table with 255 keys.
+*/
+
+#define HA_MAX_POSSIBLE_KEY 255 /* For myisamchk */
+/*
+ The following defines can be increased if necessary.
+ But beware the dependency of MI_MAX_POSSIBLE_KEY_BUFF and HA_MAX_KEY_LENGTH.
+*/
+
+#define HA_MAX_KEY_LENGTH 1000 /* Max length in bytes */
+#define HA_MAX_KEY_SEG 16 /* Max segments for key */
+
+#define HA_MAX_POSSIBLE_KEY_BUFF (HA_MAX_KEY_LENGTH + 24+ 6+6)
+#define HA_MAX_KEY_BUFF (HA_MAX_KEY_LENGTH+HA_MAX_KEY_SEG*6+8+8)
/*
Limit max keys according to HA_MAX_POSSIBLE_KEY