Salome HOME
NRI : Comment unused ComponentType enum.
[modules/kernel.git] / src / Utils / duplicate.cxx
1 using namespace std;
2 //=============================================================================
3 // File      : duplicate.cxx
4 // Created   : lun nov  5 16:04:47 CET 2001
5 // Author    : Antoine YESSAYAN, EDF
6 // Project   : SALOME
7 // Copyright : EDF 2001
8 // $Header$
9 //=============================================================================
10
11 /*!
12  *      This function can be changed by strdup() if strdup() is ANSI.
13  *      It is strongly (and only) used in the Registry environment
14  *      (RegistryService, RegistryConnexion, Identity, ...)
15  */
16 extern "C"
17 {
18 #include <stdlib.h>
19 #include <string.h>
20 }
21 #include  "utilities.h"
22
23 const char* duplicate( const char *const str )
24 {
25         ASSERT(str!=NULL) ;
26         const size_t length = strlen( str ) ;
27         ASSERT(length>0) ;
28         char *new_str = new char[ 1+length ] ;
29         ASSERT(new_str) ;
30         strcpy( new_str , str ) ;
31         return new_str ;
32 }