Mozilla.com

  1. MDC
  2. Main Page
  3. NS ENSURE SUCCESS
Table of contents
  1. 1. Summary
  2. 2. Syntax
  3. 3. Usage

NS ENSURE SUCCESS

Table of contents
  1. 1. Summary
  2. 2. Syntax
  3. 3. Usage

Summary

Macro

Returns return-value if NS_FAILED(nsresult) evaluates to true, and shows a warning on stderr in that case.

Syntax

NS_ENSURE_SUCCESS(nsresult, return-value);


Usage

nsresult mozMyClass::MozStringMucking()
{
  nsresult rv = NS_CStringCopy(mDestString, mSrcString);
  NS_ENSURE_SUCCESS(rv, rv);

  // this is the same as doing:
  nsresult rv = NS_CStringCopy(mDestString, mSrcString);
  if (NS_FAILED(rv))
    return rv;

  return NS_OK;
}

Page last modified 19:58, 14 Oct 2005 by Biesi

Files (0)