summaryrefslogtreecommitdiff
path: root/mysys/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'mysys/string.c')
-rw-r--r--mysys/string.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/mysys/string.c b/mysys/string.c
index 1cbce7ca4e1..d9791341c60 100644
--- a/mysys/string.c
+++ b/mysys/string.c
@@ -1,6 +1,4 @@
-/*
- Copyright (c) 2000, 2001, 2005-2007 MySQL AB, 2009 Sun Microsystems, Inc.
- Use is subject to license terms.
+/* Copyright (c) 2000, 2010, 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
@@ -13,8 +11,7 @@
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/*
Code for handling strings with can grow dynamicly.
@@ -101,20 +98,21 @@ my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append,
size_t length)
{
char *new_ptr;
+ DBUG_ENTER("dynstr_append_mem");
if (str->length+length >= str->max_length)
{
size_t new_length=(str->length+length+str->alloc_increment)/
str->alloc_increment;
new_length*=str->alloc_increment;
if (!(new_ptr=(char*) my_realloc(str->str,new_length,MYF(MY_WME))))
- return TRUE;
+ DBUG_RETURN(TRUE);
str->str=new_ptr;
str->max_length=new_length;
}
memcpy(str->str + str->length,append,length);
str->length+=length;
str->str[str->length]=0; /* Safety for C programs */
- return FALSE;
+ DBUG_RETURN(FALSE);
}
@@ -180,11 +178,8 @@ my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append, ...)
void dynstr_free(DYNAMIC_STRING *str)
{
- if (str->str)
- {
- my_free(str->str,MYF(MY_WME));
- str->str=0;
- }
+ my_free(str->str);
+ str->str= NULL;
}