[Cmake-commits] [cmake-commits] king committed cmTarget.cxx 1.247 1.248 cmTarget.h 1.127 1.128

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Jul 6 16:24:34 EDT 2009


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv15499/Source

Modified Files:
	cmTarget.cxx cmTarget.h 
Log Message:
ENH: Exception safe link interface computation

This fixes cmTarget::GetLinkInterface to compute and return the link
interface in an exception-safe manner.  We manage the link interface
returned by cmTarget::ComputeLinkInterface using auto_ptr.


Index: cmTarget.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.h,v
retrieving revision 1.127
retrieving revision 1.128
diff -C 2 -d -r1.127 -r1.128
*** cmTarget.h	3 Jul 2009 14:33:59 -0000	1.127
--- cmTarget.h	6 Jul 2009 20:24:32 -0000	1.128
***************
*** 22,25 ****
--- 22,27 ----
  #include "cmPolicies.h"
  
+ #include <cmsys/auto_ptr.hxx>
+ 
  class cmake;
  class cmMakefile;
***************
*** 534,538 ****
  
    // Link interface.
!   cmTargetLinkInterface* ComputeLinkInterface(const char* config);
    cmTargetLinkInterfaceMap LinkInterface;
  
--- 536,541 ----
  
    // Link interface.
!   cmsys::auto_ptr<cmTargetLinkInterface>
!   ComputeLinkInterface(const char* config);
    cmTargetLinkInterfaceMap LinkInterface;
  

Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.247
retrieving revision 1.248
diff -C 2 -d -r1.247 -r1.248
*** cmTarget.cxx	3 Jul 2009 14:33:57 -0000	1.247
--- cmTarget.cxx	6 Jul 2009 20:24:32 -0000	1.248
***************
*** 3697,3706 ****
      {
      // Compute the link interface for this configuration.
!     cmTargetLinkInterface* iface = this->ComputeLinkInterface(config);
  
      // Store the information for this configuration.
      std::map<cmStdString, cmTargetLinkInterface*>::value_type
!       entry(config?config:"", iface);
      i = this->LinkInterface.insert(entry).first;
      }
  
--- 3697,3708 ----
      {
      // Compute the link interface for this configuration.
!     cmsys::auto_ptr<cmTargetLinkInterface>
!       iface(this->ComputeLinkInterface(config));
  
      // Store the information for this configuration.
      std::map<cmStdString, cmTargetLinkInterface*>::value_type
!       entry(config?config:"", 0);
      i = this->LinkInterface.insert(entry).first;
+     i->second = iface.release();
      }
  
***************
*** 3709,3713 ****
  
  //----------------------------------------------------------------------------
! cmTargetLinkInterface* cmTarget::ComputeLinkInterface(const char* config)
  {
    // Construct the property name suffix for this configuration.
--- 3711,3716 ----
  
  //----------------------------------------------------------------------------
! cmsys::auto_ptr<cmTargetLinkInterface>
! cmTarget::ComputeLinkInterface(const char* config)
  {
    // Construct the property name suffix for this configuration.
***************
*** 3740,3751 ****
    if(!libs)
      {
!     return 0;
      }
  
    // Allocate the interface.
!   cmTargetLinkInterface* iface = new cmTargetLinkInterface;
!   if(!iface)
      {
!     return 0;
      }
  
--- 3743,3754 ----
    if(!libs)
      {
!     return cmsys::auto_ptr<cmTargetLinkInterface>();
      }
  
    // Allocate the interface.
!   cmsys::auto_ptr<cmTargetLinkInterface> iface(new cmTargetLinkInterface);
!   if(!iface.get())
      {
!     return cmsys::auto_ptr<cmTargetLinkInterface>();
      }
  



More information about the Cmake-commits mailing list