Namespaces | |
namespace | TS |
Functions | |
Char * | string_alloc (UnsignedLong len) |
Char * | string_dup (const Char *str) |
void | string_free (Char *str) |
Variables | |
static Char | s_empty = 0 |
Char* FACE::string_alloc | ( | UnsignedLong | len | ) |
Definition at line 15 of file StringManager.cpp.
References s_empty.
Referenced by OpenDDS::FaceTypes::operator>>(), and string_dup().
00016 { 00017 if (len == 0) return &s_empty; 00018 void* const raw = 00019 ACE_Allocator::instance()->malloc(len + 1); 00020 Char* const str = static_cast<Char*>(raw); 00021 if (str) str[0] = static_cast<Char>(0); 00022 return str; 00023 }
Char* FACE::string_dup | ( | const Char * | str | ) |
Definition at line 25 of file StringManager.cpp.
References s_empty, and string_alloc().
00026 { 00027 if (!str) return 0; 00028 if (!*str) return &s_empty; 00029 const size_t len = std::strlen(str); 00030 Char* const cpy = string_alloc(static_cast<UnsignedLong>(len)); 00031 if (cpy) std::strncpy(cpy, str, len + 1); 00032 return cpy; 00033 }
void FACE::string_free | ( | Char * | str | ) |
Definition at line 35 of file StringManager.cpp.
References s_empty.
Referenced by OpenDDS::FaceTypes::operator>>().
00036 { 00037 if (str != &s_empty) ACE_Allocator::instance()->free(str); 00038 }
Char FACE::s_empty = 0 [static] |
Definition at line 9 of file StringManager.cpp.
Referenced by string_alloc(), string_dup(), and string_free().