List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:January 11 2011 9:28am
Subject:Re: bzr commit into mysql-5.1-telco-7.0 branch (jonas:4058)
View as plain text  
On 01/05/2011 05:27 PM, Tor Didriksen wrote:
> On Wed, Jan 5, 2011 at 4:28 PM, Magnus
> Blåudd<magnus.blaudd@stripped>wrote:
>
>> On 12/14/2010 01:53 PM, jonas oreland wrote:
>>
>>> === modified file 'storage/ndb/src/common/util/BaseString.cpp'
>>> --- a/storage/ndb/src/common/util/BaseString.cpp        2010-11-28
>>> 11:34:01 +0000
>>> +++ b/storage/ndb/src/common/util/BaseString.cpp        2010-12-14
>>> 12:53:32 +0000
>>> @@ -54,6 +54,26 @@ BaseString::BaseString(const char* s)
>>>       m_len = n;
>>>   }
>>>
>>> +BaseString::BaseString(const char * s, size_t n)
>>> +{
>>> +  if (s == NULL || n == 0)
>>> +  {
>>> +    m_chr = NULL;
>>> +    m_len = 0;
>>> +    return;
>>> +  }
>>> +  m_chr = new char[n + 1];
>>>
>>
> Unlike malloc(), new *never* returns NULL
> (unless you have your own operator new() of course)

That would be greate, but have you checked mysys/my_new.cc ?

my_new.cc:>
<snip>
#ifdef USE_MYSYS_NEW

void *operator new (size_t sz)
{
   return (void *) malloc (sz ? sz : 1);
}

<snap>

And... don't we always compile with exceptions turned off?

/ Magnus

>
> -- didrik
>
>
> +  if (m_chr == NULL)
>>> +  {
>>> +    errno = ENOMEM;
>>> +    m_len = 0;
>>> +    return;
>>> +  }
>>>
>>
>> Is it really such a good idea to touch errno, don't you think "new" will
>> set it when it fails?
>>
>> --
>> MySQL Code Commits Mailing List
>> For list archives: http://lists.mysql.com/commits
>> To unsubscribe:
>> http://lists.mysql.com/commits?unsub=1
>>
>>
>

Thread
bzr commit into mysql-5.1-telco-7.0 branch (jonas:4058) jonas oreland14 Dec
  • Re: bzr commit into mysql-5.1-telco-7.0 branch (jonas:4058)Magnus Blåudd5 Jan
    • Re: bzr commit into mysql-5.1-telco-7.0 branch (jonas:4058)Tor Didriksen5 Jan
      • Re: bzr commit into mysql-5.1-telco-7.0 branch (jonas:4058)Tor Didriksen5 Jan
      • Re: bzr commit into mysql-5.1-telco-7.0 branch (jonas:4058)Magnus Blåudd11 Jan