Commit 570bffe8 authored by brian@zim.tangent.org's avatar brian@zim.tangent.org

Rename of my_strdup_with_lenght to match the more common "strndup" method. Soo...

Rename of my_strdup_with_lenght to match the more common "strndup" method. Soo its now my_strndup().
my_stat() gettinng the correct parameter list may be next :)
parent 425553e0
......@@ -1184,7 +1184,7 @@ parse_delimiter(const char *script, statement **stmt, char delm)
tmp= tmp->next)
{
count++;
tmp->string= my_strdup_with_length(ptr, (size_t)(retstr - ptr), MYF(MY_FAE));
tmp->string= my_strndup(ptr, (size_t)(retstr - ptr), MYF(MY_FAE));
tmp->length= (size_t)(retstr - ptr);
DBUG_PRINT("info", (" Creating : %.*s\n", (uint)tmp->length, tmp->string));
ptr+= retstr - ptr + 1;
......@@ -1195,7 +1195,7 @@ parse_delimiter(const char *script, statement **stmt, char delm)
if (ptr != script+length)
{
tmp->string= my_strdup_with_length(ptr, (size_t)((script + length) - ptr),
tmp->string= my_strndup(ptr, (size_t)((script + length) - ptr),
MYF(MY_FAE));
tmp->length= (size_t)((script + length) - ptr);
DBUG_PRINT("info", (" Creating : %.*s\n", (uint)tmp->length, tmp->string));
......
......@@ -638,7 +638,7 @@ static char *get_word(char **str)
DBUG_ENTER("get_word");
*str= find_end_of_word(start);
DBUG_RETURN(my_strdup_with_length(start, (uint) (*str - start),
DBUG_RETURN(my_strndup(start, (uint) (*str - start),
MYF(MY_WME | MY_FAE)));
}
......@@ -672,7 +672,7 @@ static struct message *parse_message_string(struct message *new_message,
while (*str != ' ' && *str != '\t' && *str)
str++;
if (!(new_message->lang_short_name=
my_strdup_with_length(start, (uint) (str - start),
my_strndup(start, (uint) (str - start),
MYF(MY_WME | MY_FAE))))
DBUG_RETURN(0); /* Fatal error */
DBUG_PRINT("info", ("msg_slang: %s", new_message->lang_short_name));
......@@ -692,7 +692,7 @@ static struct message *parse_message_string(struct message *new_message,
start= str + 1;
str= parse_text_line(start);
if (!(new_message->text= my_strdup_with_length(start, (uint) (str - start),
if (!(new_message->text= my_strndup(start, (uint) (str - start),
MYF(MY_WME | MY_FAE))))
DBUG_RETURN(0); /* Fatal error */
DBUG_PRINT("info", ("msg_text: %s", new_message->text));
......
......@@ -136,7 +136,7 @@ extern int NEAR my_errno; /* Last error in mysys */
#define my_free(PTR,FLAG) _myfree((PTR), __FILE__, __LINE__,FLAG)
#define my_memdup(A,B,C) _my_memdup((A),(B), __FILE__,__LINE__,C)
#define my_strdup(A,C) _my_strdup((A), __FILE__,__LINE__,C)
#define my_strdup_with_length(A,B,C) _my_strdup_with_length((A),(B),__FILE__,__LINE__,C)
#define my_strndup(A,B,C) _my_strndup((A),(B),__FILE__,__LINE__,C)
#define TRASH(A,B) bfill(A, B, 0x8F)
#define QUICK_SAFEMALLOC sf_malloc_quick=1
#define NORMAL_SAFEMALLOC sf_malloc_quick=0
......@@ -158,7 +158,7 @@ extern gptr my_realloc(gptr oldpoint,uint Size,myf MyFlags);
extern void my_no_flags_free(gptr ptr);
extern gptr my_memdup(const byte *from,uint length,myf MyFlags);
extern char *my_strdup(const char *from,myf MyFlags);
extern char *my_strdup_with_length(const byte *from, uint length,
extern char *my_strndup(const byte *from, uint length,
myf MyFlags);
/* we do use FG (as a no-op) in below so that a typo on FG is caught */
#define my_free(PTR,FG) ((void)FG,my_no_flags_free(PTR))
......@@ -597,7 +597,7 @@ extern gptr _my_memdup(const byte *from,uint length,
const char *sFile, uint uLine,myf MyFlag);
extern my_string _my_strdup(const char *from, const char *sFile, uint uLine,
myf MyFlag);
extern char *_my_strdup_with_length(const byte *from, uint length,
extern char *_my_strndup(const byte *from, uint length,
const char *sFile, uint uLine,
myf MyFlag);
......
......@@ -53,7 +53,7 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist)
end=strcend(pathlist, DELIM);
strmake(buff, pathlist, (uint) (end-pathlist));
length= cleanup_dirname(buff, buff);
if (!(copy= my_strdup_with_length(buff, length, MYF(MY_WME))) ||
if (!(copy= my_strndup(buff, length, MYF(MY_WME))) ||
insert_dynamic(&t_arr, (gptr) &copy))
DBUG_RETURN(TRUE);
pathlist=end+1;
......
......@@ -83,7 +83,7 @@ char *my_strdup(const char *from, myf my_flags)
}
char *my_strdup_with_length(const byte *from, uint length, myf my_flags)
char *my_strndup(const byte *from, uint length, myf my_flags)
{
gptr ptr;
if ((ptr=my_malloc(length+1,my_flags)) != 0)
......
......@@ -525,7 +525,7 @@ char *_my_strdup(const char *from, const char *filename, uint lineno,
} /* _my_strdup */
char *_my_strdup_with_length(const byte *from, uint length,
char *_my_strndup(const byte *from, uint length,
const char *filename, uint lineno,
myf MyFlags)
{
......
......@@ -647,7 +647,7 @@ static int parse_url(FEDERATED_SHARE *share, TABLE *table,
DBUG_PRINT("info", ("Length: %d", table->s->connect_string.length));
DBUG_PRINT("info", ("String: '%.*s'", table->s->connect_string.length,
table->s->connect_string.str));
share->scheme= my_strdup_with_length((const byte*)table->s->
share->scheme= my_strndup((const byte*)table->s->
connect_string.str,
table->s->connect_string.length,
MYF(0));
......
......@@ -3138,7 +3138,7 @@ Rotate_log_event::Rotate_log_event(const char* new_log_ident_arg,
llstr(pos_arg, buff), flags));
#endif
if (flags & DUP_NAME)
new_log_ident= my_strdup_with_length((const byte*) new_log_ident_arg,
new_log_ident= my_strndup((const byte*) new_log_ident_arg,
ident_len, MYF(MY_WME));
DBUG_VOID_RETURN;
}
......@@ -3162,7 +3162,7 @@ Rotate_log_event::Rotate_log_event(const char* buf, uint event_len,
(header_size+post_header_len));
ident_offset = post_header_len;
set_if_smaller(ident_len,FN_REFLEN-1);
new_log_ident= my_strdup_with_length((byte*) buf + ident_offset,
new_log_ident= my_strndup((byte*) buf + ident_offset,
(uint) ident_len,
MYF(MY_WME));
DBUG_VOID_RETURN;
......
......@@ -1021,7 +1021,7 @@ bool update_sys_var_str(sys_var_str *var_str, rw_lock_t *var_mutex,
uint new_length= (var ? var->value->str_value.length() : 0);
if (!old_value)
old_value= (char*) "";
if (!(res= my_strdup_with_length((byte*)old_value, new_length, MYF(0))))
if (!(res= my_strndup((byte*)old_value, new_length, MYF(0))))
return 1;
/*
Replace the old value in such a way that the any thread using
......
......@@ -926,7 +926,7 @@ public:
uint name_length_arg, gptr data_arg)
:name_length(name_length_arg), data(data_arg)
{
name= my_strdup_with_length((byte*) name_arg, name_length, MYF(MY_WME));
name= my_strndup((byte*) name_arg, name_length, MYF(MY_WME));
links->push_back(this);
}
inline bool cmp(const char *name_cmp, uint length)
......
......@@ -83,7 +83,7 @@ int ft_init_stopwords()
end=start+len;
while (ft_simple_get_word(default_charset_info, &start, end, &w, TRUE))
{
if (ft_add_stopword(my_strdup_with_length(w.pos, w.len, MYF(0))))
if (ft_add_stopword(my_strndup(w.pos, w.len, MYF(0))))
goto err1;
}
error=0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment