summaryrefslogtreecommitdiff
path: root/TAO/tao/String_Alloc.cpp
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2006-05-09 07:46:29 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2006-05-09 07:46:29 +0000
commitef3e37df25974dbd932516f6d07c721bd297f857 (patch)
treeedbddb5e3fadf4717397405ea8d798f52aa7d77a /TAO/tao/String_Alloc.cpp
parenta97d14ea7f086bd11c405755b955dabfc43f7ba8 (diff)
downloadATCD-ef3e37df25974dbd932516f6d07c721bd297f857.tar.gz
ChangeLogTag: Tue May 10 07:18:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'TAO/tao/String_Alloc.cpp')
-rw-r--r--TAO/tao/String_Alloc.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/TAO/tao/String_Alloc.cpp b/TAO/tao/String_Alloc.cpp
index 5844fb9503f..253542123b4 100644
--- a/TAO/tao/String_Alloc.cpp
+++ b/TAO/tao/String_Alloc.cpp
@@ -22,20 +22,19 @@ CORBA::string_dup (const char *str)
return 0;
}
- const size_t len = ACE_OS::strlen (str);
+ size_t const len = ACE_OS::strlen (str);
// This allocates an extra byte for the '\0';
char * copy = CORBA::string_alloc (static_cast<CORBA::ULong> (len));
- // The memcpy() below assumes that the destination is a valid buffer.
- if (copy == 0)
+ if (copy != 0)
{
- return 0;
+ // The memcpy() assumes that the destination is a valid buffer.
+ ACE_OS::memcpy (copy,
+ str,
+ len + 1);
}
- ACE_OS::memcpy (copy,
- str,
- len + 1);
return copy;
}
@@ -43,7 +42,6 @@ char *
CORBA::string_alloc (CORBA::ULong len)
{
// Allocate 1 + strlen to accomodate the null terminating character.
-
char *s = 0;
ACE_NEW_RETURN (s,
char[size_t (len + 1)],