summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <jani@hynda.mysql.fi>2007-07-02 20:45:15 +0300
committerunknown <jani@hynda.mysql.fi>2007-07-02 20:45:15 +0300
commit631ecaabea7336a8f28367c0d1c291f0433f7e88 (patch)
tree2eb68f1f6af5e60c4bcdd8fcfa7e14f3650de830 /mysys
parentcfdd73369c0c2d57908af8dc727de33567fe9e0b (diff)
downloadmariadb-git-631ecaabea7336a8f28367c0d1c291f0433f7e88.tar.gz
Merged with mysql-5.1 main tree.
BUILD/compile-pentium-debug-max: Added definition after macro was removed from main tree. This will be fixed back in main tree later.
Diffstat (limited to 'mysys')
-rw-r--r--mysys/lf_hash.c28
-rw-r--r--mysys/my_compress.c3
-rw-r--r--mysys/my_rename.c5
-rw-r--r--mysys/my_safehash.c30
-rw-r--r--mysys/my_safehash.h18
-rw-r--r--mysys/my_sync.c3
6 files changed, 45 insertions, 42 deletions
diff --git a/mysys/lf_hash.c b/mysys/lf_hash.c
index 832f0eb5852..3f6b9082ab9 100644
--- a/mysys/lf_hash.c
+++ b/mysys/lf_hash.c
@@ -34,7 +34,7 @@ LF_REQUIRE_PINS(3);
typedef struct {
intptr volatile link; /* a pointer to the next element in a listand a flag */
uint32 hashnr; /* reversed hash number, for sorting */
- const byte *key;
+ const uchar *key;
uint keylen;
/*
data is stored here, directly after the keylen.
@@ -72,10 +72,10 @@ typedef struct {
pins[0..2] are used, they are NOT removed on return
*/
static int lfind(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
- const byte *key, uint keylen, CURSOR *cursor, LF_PINS *pins)
+ const uchar *key, uint keylen, CURSOR *cursor, LF_PINS *pins)
{
uint32 cur_hashnr;
- const byte *cur_key;
+ const uchar *cur_key;
uint cur_keylen;
intptr link;
@@ -201,7 +201,7 @@ static LF_SLIST *linsert(LF_SLIST * volatile *head, CHARSET_INFO *cs,
it uses pins[0..2], on return all pins are removed.
*/
static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
- const byte *key, uint keylen, LF_PINS *pins)
+ const uchar *key, uint keylen, LF_PINS *pins)
{
CURSOR cursor;
int res;
@@ -259,7 +259,7 @@ static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
all other pins are removed.
*/
static LF_SLIST *lsearch(LF_SLIST * volatile *head, CHARSET_INFO *cs,
- uint32 hashnr, const byte *key, uint keylen,
+ uint32 hashnr, const uchar *key, uint keylen,
LF_PINS *pins)
{
CURSOR cursor;
@@ -271,8 +271,8 @@ static LF_SLIST *lsearch(LF_SLIST * volatile *head, CHARSET_INFO *cs,
return res ? cursor.curr : 0;
}
-static inline const byte* hash_key(const LF_HASH *hash,
- const byte *record, uint *length)
+static inline const uchar* hash_key(const LF_HASH *hash,
+ const uchar *record, uint *length)
{
if (hash->get_key)
return (*hash->get_key)(record, length, 0);
@@ -285,7 +285,7 @@ static inline const byte* hash_key(const LF_HASH *hash,
note, that the hash value is limited to 2^31, because we need one
bit to distinguish between normal and dummy nodes.
*/
-static inline uint calc_hash(LF_HASH *hash, const byte *key, uint keylen)
+static inline uint calc_hash(LF_HASH *hash, const uchar *key, uint keylen)
{
ulong nr1= 1, nr2= 4;
hash->charset->coll->hash_sort(hash->charset, (uchar*) key, keylen,
@@ -362,7 +362,7 @@ int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data)
if (unlikely(!node))
return -1;
memcpy(node+1, data, hash->element_size);
- node->key= hash_key(hash, (byte *)(node+1), &node->keylen);
+ node->key= hash_key(hash, (uchar *)(node+1), &node->keylen);
hashnr= calc_hash(hash, node->key, node->keylen);
bucket= hashnr % hash->size;
el= _lf_dynarray_lvalue(&hash->array, bucket);
@@ -399,7 +399,7 @@ int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data)
int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
{
LF_SLIST * volatile *el;
- uint bucket, hashnr= calc_hash(hash, (byte *)key, keylen);
+ uint bucket, hashnr= calc_hash(hash, (uchar *)key, keylen);
bucket= hashnr % hash->size;
lf_rwlock_by_pins(pins);
@@ -415,7 +415,7 @@ int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins)))
return -1;
if (ldelete(el, hash->charset, my_reverse_bits(hashnr) | 1,
- (byte *)key, keylen, pins))
+ (uchar *)key, keylen, pins))
{
lf_rwunlock_by_pins(pins);
return 1;
@@ -438,7 +438,7 @@ int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
void *lf_hash_search(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
{
LF_SLIST * volatile *el, *found;
- uint bucket, hashnr= calc_hash(hash, (byte *)key, keylen);
+ uint bucket, hashnr= calc_hash(hash, (uchar *)key, keylen);
bucket= hashnr % hash->size;
lf_rwlock_by_pins(pins);
@@ -448,12 +448,12 @@ void *lf_hash_search(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins)))
return MY_ERRPTR;
found= lsearch(el, hash->charset, my_reverse_bits(hashnr) | 1,
- (byte *)key, keylen, pins);
+ (uchar *)key, keylen, pins);
lf_rwunlock_by_pins(pins);
return found ? found+1 : 0;
}
-static const byte *dummy_key= "";
+static const uchar *dummy_key= "";
/*
RETURN
diff --git a/mysys/my_compress.c b/mysys/my_compress.c
index d495a1c1c6d..5e770959105 100644
--- a/mysys/my_compress.c
+++ b/mysys/my_compress.c
@@ -178,7 +178,8 @@ int packfrm(const uchar *data, size_t len,
if (my_compress((uchar*)data, &org_len, &comp_len))
goto err;
- DBUG_PRINT("info", ("org_len: %lu comp_len: %lu", org_len, comp_len));
+ DBUG_PRINT("info", ("org_len: %lu comp_len: %lu", (ulong) org_len,
+ (ulong) comp_len));
DBUG_DUMP("compressed", (char*)data, org_len);
error= 2;
diff --git a/mysys/my_rename.c b/mysys/my_rename.c
index 64dbac955ea..39e6056a9e4 100644
--- a/mysys/my_rename.c
+++ b/mysys/my_rename.c
@@ -66,8 +66,9 @@ int my_rename(const char *from, const char *to, myf MyFlags)
#ifdef NEED_EXPLICIT_SYNC_DIR
/* do only the needed amount of syncs: */
char dir_from[FN_REFLEN], dir_to[FN_REFLEN];
- dirname_part(dir_from, from);
- dirname_part(dir_to, to);
+ size_t dir_from_length, dir_to_length;
+ dirname_part(dir_from, from, &dir_from_length);
+ dirname_part(dir_to, to, &dir_to_length);
if (my_sync_dir(dir_from, MyFlags) ||
(strcmp(dir_from, dir_to) &&
my_sync_dir(dir_to, MyFlags)))
diff --git a/mysys/my_safehash.c b/mysys/my_safehash.c
index 57f408942bf..b34ad5f16ff 100644
--- a/mysys/my_safehash.c
+++ b/mysys/my_safehash.c
@@ -53,7 +53,7 @@
static void safe_hash_entry_free(SAFE_HASH_ENTRY *entry)
{
DBUG_ENTER("safe_hash_entry_free");
- my_free((gptr) entry, MYF(0));
+ my_free((uchar*) entry, MYF(0));
DBUG_VOID_RETURN;
}
@@ -70,11 +70,11 @@ static void safe_hash_entry_free(SAFE_HASH_ENTRY *entry)
# reference on the key
*/
-static byte *safe_hash_entry_get(SAFE_HASH_ENTRY *entry, uint *length,
- my_bool not_used __attribute__((unused)))
+static uchar *safe_hash_entry_get(SAFE_HASH_ENTRY *entry, uint *length,
+ my_bool not_used __attribute__((unused)))
{
*length= entry->length;
- return (byte*) entry->key;
+ return (uchar*) entry->key;
}
@@ -97,7 +97,7 @@ static byte *safe_hash_entry_get(SAFE_HASH_ENTRY *entry, uint *length,
*/
my_bool safe_hash_init(SAFE_HASH *hash, uint elements,
- byte *default_value)
+ uchar *default_value)
{
DBUG_ENTER("safe_hash_init");
if (hash_init(&hash->hash, &my_charset_bin, elements,
@@ -154,10 +154,10 @@ void safe_hash_free(SAFE_HASH *hash)
# data associated with the key of default value if data was not found
*/
-byte *safe_hash_search(SAFE_HASH *hash, const byte *key, uint length,
- byte *def)
+uchar *safe_hash_search(SAFE_HASH *hash, const uchar *key, uint length,
+ uchar *def)
{
- byte *result;
+ uchar *result;
DBUG_ENTER("safe_hash_search");
rw_rdlock(&hash->mutex);
result= hash_search(&hash->hash, key, length);
@@ -191,8 +191,8 @@ byte *safe_hash_search(SAFE_HASH *hash, const byte *key, uint length,
1 error (Can only be EOM). In this case my_message() is called.
*/
-my_bool safe_hash_set(SAFE_HASH *hash, const byte *key, uint length,
- byte *data)
+my_bool safe_hash_set(SAFE_HASH *hash, const uchar *key, uint length,
+ uchar *data)
{
SAFE_HASH_ENTRY *entry;
my_bool error= 0;
@@ -214,7 +214,7 @@ my_bool safe_hash_set(SAFE_HASH *hash, const byte *key, uint length,
/* unlink entry from list */
if ((*entry->prev= entry->next))
entry->next->prev= entry->prev;
- hash_delete(&hash->hash, (byte*) entry);
+ hash_delete(&hash->hash, (uchar*) entry);
goto end;
}
if (entry)
@@ -230,7 +230,7 @@ my_bool safe_hash_set(SAFE_HASH *hash, const byte *key, uint length,
error= 1;
goto end;
}
- entry->key= (byte*) (entry +1);
+ entry->key= (uchar*) (entry +1);
memcpy((char*) entry->key, (char*) key, length);
entry->length= length;
entry->data= data;
@@ -239,7 +239,7 @@ my_bool safe_hash_set(SAFE_HASH *hash, const byte *key, uint length,
entry->next->prev= &entry->next;
entry->prev= &hash->root;
hash->root= entry;
- if (my_hash_insert(&hash->hash, (byte*) entry))
+ if (my_hash_insert(&hash->hash, (uchar*) entry))
{
/* This can only happen if hash got out of memory */
my_free((char*) entry, MYF(0));
@@ -269,7 +269,7 @@ end:
default value.
*/
-void safe_hash_change(SAFE_HASH *hash, byte *old_data, byte *new_data)
+void safe_hash_change(SAFE_HASH *hash, uchar *old_data, uchar *new_data)
{
SAFE_HASH_ENTRY *entry, *next;
DBUG_ENTER("safe_hash_change");
@@ -285,7 +285,7 @@ void safe_hash_change(SAFE_HASH *hash, byte *old_data, byte *new_data)
{
if ((*entry->prev= entry->next))
entry->next->prev= entry->prev;
- hash_delete(&hash->hash, (byte*) entry);
+ hash_delete(&hash->hash, (uchar*) entry);
}
else
entry->data= new_data;
diff --git a/mysys/my_safehash.h b/mysys/my_safehash.h
index 53845a5fec7..8a5856b6763 100644
--- a/mysys/my_safehash.h
+++ b/mysys/my_safehash.h
@@ -30,9 +30,9 @@
typedef struct st_safe_hash_entry
{
- byte *key;
+ uchar *key;
uint length;
- byte *data;
+ uchar *data;
struct st_safe_hash_entry *next, **prev;
} SAFE_HASH_ENTRY;
@@ -43,16 +43,16 @@ typedef struct st_safe_hash_with_default
rw_lock_t mutex;
#endif
HASH hash;
- byte *default_value;
+ uchar *default_value;
SAFE_HASH_ENTRY *root;
} SAFE_HASH;
my_bool safe_hash_init(SAFE_HASH *hash, uint elements,
- byte *default_value);
+ uchar *default_value);
void safe_hash_free(SAFE_HASH *hash);
-byte *safe_hash_search(SAFE_HASH *hash, const byte *key, uint length,
- byte *def);
-my_bool safe_hash_set(SAFE_HASH *hash, const byte *key, uint length,
- byte *data);
-void safe_hash_change(SAFE_HASH *hash, byte *old_data, byte *new_data);
+uchar *safe_hash_search(SAFE_HASH *hash, const uchar *key, uint length,
+ uchar *def);
+my_bool safe_hash_set(SAFE_HASH *hash, const uchar *key, uint length,
+ uchar *data);
+void safe_hash_change(SAFE_HASH *hash, uchar *old_data, uchar *new_data);
diff --git a/mysys/my_sync.c b/mysys/my_sync.c
index ab3fc89e0d3..ba6964b00d6 100644
--- a/mysys/my_sync.c
+++ b/mysys/my_sync.c
@@ -145,7 +145,8 @@ int my_sync_dir_by_file(const char *file_name, myf my_flags)
{
#ifdef NEED_EXPLICIT_SYNC_DIR
char dir_name[FN_REFLEN];
- dirname_part(dir_name, file_name);
+ size_t dir_name_length;
+ dirname_part(dir_name, file_name, &dir_name_length);
return my_sync_dir(dir_name, my_flags);
#else
return 0;