michael@0: // Test03.cpp michael@0: michael@0: #include "nsIDOMNode.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsString.h" michael@0: michael@0: NS_DEF_PTR(nsIDOMNode); michael@0: michael@0: /* michael@0: Windows: michael@0: nsCOMPtr_optimized* 45 michael@0: raw_optimized 48 michael@0: nsCOMPtr_optimized 50 michael@0: nsCOMPtr 54 michael@0: nsCOMPtr* 59 michael@0: raw 62 michael@0: michael@0: Macintosh: michael@0: nsCOMPtr_optimized 112 (1.0000) michael@0: raw_optimized 124 bytes (1.1071) i.e., 10.71% bigger than nsCOMPtr_optimized michael@0: nsCOMPtr 144 (1.2857) michael@0: */ michael@0: michael@0: void // nsresult michael@0: Test03_raw( nsIDOMNode* aDOMNode, nsString* aResult ) michael@0: // m140, w62 michael@0: { michael@0: // -- the following code is assumed, but is commented out so we compare only michael@0: // the relevent generated code michael@0: michael@0: // if ( !aDOMNode || !aResult ) michael@0: // return NS_ERROR_NULL_POINTER; michael@0: michael@0: nsIDOMNode* parent = 0; michael@0: nsresult status = aDOMNode->GetParentNode(&parent); michael@0: michael@0: if ( NS_SUCCEEDED(status) ) michael@0: { michael@0: parent->GetNodeName(*aResult); michael@0: } michael@0: michael@0: NS_IF_RELEASE(parent); michael@0: michael@0: // return status; michael@0: } michael@0: michael@0: michael@0: void // nsresult michael@0: Test03_raw_optimized( nsIDOMNode* aDOMNode, nsString* aResult ) michael@0: // m124, w48 michael@0: { michael@0: // if ( !aDOMNode || !aResult ) michael@0: // return NS_ERROR_NULL_POINTER; michael@0: michael@0: nsIDOMNode* parent; michael@0: nsresult status = aDOMNode->GetParentNode(&parent); michael@0: michael@0: if ( NS_SUCCEEDED(status) ) michael@0: { michael@0: parent->GetNodeName(*aResult); michael@0: NS_RELEASE(parent); michael@0: } michael@0: michael@0: // return status; michael@0: } michael@0: michael@0: michael@0: void // nsresult michael@0: Test03_nsCOMPtr( nsIDOMNode* aDOMNode, nsString* aResult ) michael@0: // m144, w54/59 michael@0: { michael@0: // if ( !aDOMNode || !aResult ) michael@0: // return NS_ERROR_NULL_POINTER; michael@0: michael@0: nsCOMPtr parent; michael@0: nsresult status = aDOMNode->GetParentNode( getter_AddRefs(parent) ); michael@0: if ( parent ) michael@0: parent->GetNodeName(*aResult); michael@0: michael@0: // return status; michael@0: } michael@0: michael@0: void // nsresult michael@0: Test03_nsCOMPtr_optimized( nsIDOMNode* aDOMNode, nsString* aResult ) michael@0: // m112, w50/45 michael@0: { michael@0: // if ( !aDOMNode || !aResult ) michael@0: // return NS_ERROR_NULL_POINTER; michael@0: michael@0: nsIDOMNode* temp; michael@0: nsresult status = aDOMNode->GetParentNode(&temp); michael@0: nsCOMPtr parent( dont_AddRef(temp) ); michael@0: if ( parent ) michael@0: parent->GetNodeName(*aResult); michael@0: michael@0: // return status; michael@0: }