Update of /cvsroot/cppunit/cppunit2/src/cpptl
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12154/src/cpptl
Modified Files:
json_value.cpp
Log Message:
- removed call to strdup with null pointer
Index: json_value.cpp
===================================================================
RCS file: /cvsroot/cppunit/cppunit2/src/cpptl/json_value.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** json_value.cpp 7 Nov 2005 22:43:07 -0000 1.1
--- json_value.cpp 9 Nov 2005 23:16:05 -0000 1.2
***************
*** 36,40 ****
if ( comment_ )
free( comment_ );
! comment_ = strdup( text );
}
--- 36,40 ----
if ( comment_ )
free( comment_ );
! comment_ = text ? strdup( text ) : 0;
}
***************
*** 57,62 ****
Value::CZString::CZString( const CZString &other )
! : cstr_( other.index_ != noDuplication ? strdup( other.cstr_ )
! : other.cstr_ )
, index_( other.cstr_ ? (other.index_ == noDuplication ? noDuplication : duplicate)
: other.index_ )
--- 57,62 ----
Value::CZString::CZString( const CZString &other )
! : cstr_( other.index_ != noDuplication && other.cstr_ != 0 ? strdup( other.cstr_ )
! : other.cstr_ )
, index_( other.cstr_ ? (other.index_ == noDuplication ? noDuplication : duplicate)
: other.index_ )
***************
*** 216,220 ****
break;
case stringValue:
! value_.string_ = strdup( other.value_.string_ );
break;
case arrayValue:
--- 216,223 ----
break;
case stringValue:
! if ( other.value_.string_ )
! value_.string_ = strdup( other.value_.string_ );
! else
! value_.string_ = 0;
break;
case arrayValue:
|