summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2010-07-02 16:38:04 -0300
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2010-07-02 16:38:04 -0300
commit5641fb64b4719774f6c4ba4c1ec85fa5312c5ecf (patch)
tree3c6e29d5a9d1f0a067dcdf4cca5b5747721aee89 /mysys
parentaa4357f3944032ab95137d52342bc7673159fc64 (diff)
parent0eb26fdfa83d2ddd5f3dc3f8cf6e372a55b4c270 (diff)
downloadmariadb-git-5641fb64b4719774f6c4ba4c1ec85fa5312c5ecf.tar.gz
Merge of mysql-5.1-bugteam into mysql-trunk-merge.
Diffstat (limited to 'mysys')
-rw-r--r--mysys/mf_loadpath.c2
-rw-r--r--mysys/mf_pack.c12
-rw-r--r--mysys/my_bitmap.c6
-rw-r--r--mysys/my_gethwaddr.c2
-rw-r--r--mysys/my_getopt.c14
-rw-r--r--mysys/my_handler.c1
-rw-r--r--mysys/safemalloc.c2
-rw-r--r--mysys/thr_lock.c3
8 files changed, 18 insertions, 24 deletions
diff --git a/mysys/mf_loadpath.c b/mysys/mf_loadpath.c
index 07851ab6e92..9350babc176 100644
--- a/mysys/mf_loadpath.c
+++ b/mysys/mf_loadpath.c
@@ -42,7 +42,7 @@ char * my_load_path(char * to, const char *path,
if (is_cur)
is_cur=2; /* Remove current dir */
if (! my_getwd(buff,(uint) (FN_REFLEN-strlen(path)+is_cur),MYF(0)))
- (void) strncat(buff, path+is_cur, FN_REFLEN);
+ (void) strncat(buff, path+is_cur, FN_REFLEN-1);
else
(void) strnmov(buff, path, FN_REFLEN); /* Return org file name */
}
diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c
index 4f7cd90e8aa..86fd61537e7 100644
--- a/mysys/mf_pack.c
+++ b/mysys/mf_pack.c
@@ -52,7 +52,7 @@ void pack_dirname(char * to, const char *from)
buff_length= strlen(buff);
d_length= (size_t) (start-to);
if ((start == to ||
- (buff_length == d_length && !bcmp(buff,start,d_length))) &&
+ (buff_length == d_length && !memcmp(buff,start,d_length))) &&
*start != FN_LIBCHAR && *start)
{ /* Put current dir before */
bchange((uchar*) to, d_length, (uchar*) buff, buff_length, strlen(to)+1);
@@ -70,7 +70,7 @@ void pack_dirname(char * to, const char *from)
}
if (length > 1 && length < d_length)
{ /* test if /xx/yy -> ~/yy */
- if (bcmp(to,home_dir,length) == 0 && to[length] == FN_LIBCHAR)
+ if (memcmp(to,home_dir,length) == 0 && to[length] == FN_LIBCHAR)
{
to[0]=FN_HOMELIB; /* Filename begins with ~ */
(void) strmov_overlapp(to+1,to+length);
@@ -80,7 +80,7 @@ void pack_dirname(char * to, const char *from)
{ /* Test if cwd is ~/... */
if (length > 1 && length < buff_length)
{
- if (bcmp(buff,home_dir,length) == 0 && buff[length] == FN_LIBCHAR)
+ if (memcmp(buff,home_dir,length) == 0 && buff[length] == FN_LIBCHAR)
{
buff[0]=FN_HOMELIB;
(void) strmov_overlapp(buff+1,buff+length);
@@ -166,7 +166,7 @@ size_t cleanup_dirname(register char *to, const char *from)
*pos = FN_LIBCHAR;
if (*pos == FN_LIBCHAR)
{
- if ((size_t) (pos-start) > length && bcmp(pos-length,parent,length) == 0)
+ if ((size_t) (pos-start) > length && memcmp(pos-length,parent,length) == 0)
{ /* If .../../; skip prev */
pos-=length;
if (pos != start)
@@ -197,7 +197,7 @@ size_t cleanup_dirname(register char *to, const char *from)
end_parentdir=pos;
while (pos >= start && *pos != FN_LIBCHAR) /* remove prev dir */
pos--;
- if (pos[1] == FN_HOMELIB || bcmp(pos,parent,length) == 0)
+ if (pos[1] == FN_HOMELIB || memcmp(pos,parent,length) == 0)
{ /* Don't remove ~user/ */
pos=strmov(end_parentdir+1,parent);
*pos=FN_LIBCHAR;
@@ -206,7 +206,7 @@ size_t cleanup_dirname(register char *to, const char *from)
}
}
else if ((size_t) (pos-start) == length-1 &&
- !bcmp(start,parent+1,length-1))
+ !memcmp(start,parent+1,length-1))
start=pos; /* Starts with "../" */
else if (pos-start > 0 && pos[-1] == FN_LIBCHAR)
{
diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c
index 91370bd3727..fc5d1dba217 100644
--- a/mysys/my_bitmap.c
+++ b/mysys/my_bitmap.c
@@ -508,10 +508,8 @@ uint bitmap_get_first_set(const MY_BITMAP *map)
if (*byte_ptr & (1 << k))
return (i*32) + (j*8) + k;
}
- DBUG_ASSERT(0);
}
}
- DBUG_ASSERT(0);
}
}
return MY_BIT_NONE;
@@ -534,7 +532,7 @@ uint bitmap_get_first(const MY_BITMAP *map)
{
byte_ptr= (uchar*)data_ptr;
for (j=0; ; j++, byte_ptr++)
- {
+ {
if (*byte_ptr != 0xFF)
{
for (k=0; ; k++)
@@ -542,10 +540,8 @@ uint bitmap_get_first(const MY_BITMAP *map)
if (!(*byte_ptr & (1 << k)))
return (i*32) + (j*8) + k;
}
- DBUG_ASSERT(0);
}
}
- DBUG_ASSERT(0);
}
}
return MY_BIT_NONE;
diff --git a/mysys/my_gethwaddr.c b/mysys/my_gethwaddr.c
index c6a7af58f57..bfbe205be39 100644
--- a/mysys/my_gethwaddr.c
+++ b/mysys/my_gethwaddr.c
@@ -47,7 +47,7 @@ my_bool my_gethwaddr(uchar *to)
uchar *buf, *next, *end, *addr;
struct if_msghdr *ifm;
struct sockaddr_dl *sdl;
- int i, res=1, mib[6]={CTL_NET, AF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, 0};
+ int res=1, mib[6]={CTL_NET, AF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, 0};
if (sysctl(mib, 6, NULL, &len, NULL, 0) == -1)
goto err;
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 1e94dd2d761..30f4888cd98 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -28,7 +28,7 @@ typedef void (*init_func_p)(const struct my_option *option, void *variable,
static void default_reporter(enum loglevel level, const char *format, ...);
my_error_reporter my_getopt_error_reporter= &default_reporter;
-static int findopt(char *, uint, const struct my_option **, char **);
+static int findopt(char *, uint, const struct my_option **, const char **);
my_bool getopt_compare_strings(const char *, const char *, uint);
static longlong getopt_ll(char *arg, const struct my_option *optp, int *err);
static ulonglong getopt_ull(char *, const struct my_option *, int *);
@@ -113,8 +113,8 @@ int handle_options(int *argc, char ***argv,
uint opt_found, argvpos= 0, length;
my_bool end_of_options= 0, must_be_var, set_maximum_value,
option_is_loose;
- char **pos, **pos_end, *optend, *UNINIT_VAR(prev_found),
- *opt_str, key_name[FN_REFLEN];
+ char **pos, **pos_end, *optend, *opt_str, key_name[FN_REFLEN];
+ const char *UNINIT_VAR(prev_found);
const struct my_option *optp;
void *value;
int error, i;
@@ -185,7 +185,6 @@ int handle_options(int *argc, char ***argv,
Find first the right option. Return error in case of an ambiguous,
or unknown option
*/
- LINT_INIT(prev_found);
optp= longopts;
if (!(opt_found= findopt(opt_str, length, &optp, &prev_found)))
{
@@ -696,10 +695,10 @@ ret:
static int findopt(char *optpat, uint length,
const struct my_option **opt_res,
- char **ffname)
+ const char **ffname)
{
uint count;
- struct my_option *opt= (struct my_option *) *opt_res;
+ const struct my_option *opt= *opt_res;
for (count= 0; opt->name; opt++)
{
@@ -710,8 +709,9 @@ static int findopt(char *optpat, uint length,
return 1;
if (!count)
{
+ /* We only need to know one prev */
count= 1;
- *ffname= (char *) opt->name; /* We only need to know one prev */
+ *ffname= opt->name;
}
else if (strcmp(*ffname, opt->name))
{
diff --git a/mysys/my_handler.c b/mysys/my_handler.c
index 3f8af553db6..48d100f2d3f 100644
--- a/mysys/my_handler.c
+++ b/mysys/my_handler.c
@@ -269,7 +269,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
a+=a_length;
b+=b_length;
- break;
}
break;
case HA_KEYTYPE_INT8:
diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c
index 6d0f7e5dd53..8407657efb7 100644
--- a/mysys/safemalloc.c
+++ b/mysys/safemalloc.c
@@ -163,7 +163,7 @@ void *_mymalloc(size_t size, const char *filename, uint lineno, myf MyFlags)
my_message(EE_OUTOFMEMORY, buff, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH));
}
DBUG_PRINT("error",("Out of memory, in use: %ld at line %d, '%s'",
- (long)sf_malloc_max_memory,lineno, filename));
+ (long) sf_malloc_max_memory, lineno, filename));
DBUG_EXECUTE_IF("simulate_out_of_memory",
DBUG_SET("-d,simulate_out_of_memory"););
if (MyFlags & MY_FAE)
diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c
index cff1b9b9845..9d10ba1fb01 100644
--- a/mysys/thr_lock.c
+++ b/mysys/thr_lock.c
@@ -122,8 +122,7 @@ static int check_lock(struct st_lock_list *list, const char* lock_type,
{
THR_LOCK_DATA *data,**prev;
uint count=0;
- THR_LOCK_OWNER *first_owner;
- LINT_INIT(first_owner);
+ THR_LOCK_OWNER *UNINIT_VAR(first_owner);
prev= &list->data;
if (list->data)