if (gRefCnt++ == 0) { rv = nsServiceManager::GetService("component: NS_GET_IID(nsIRDFService), NS_REINTERPRET_CAST(nsISupports**, &gRDF)); if (NS_FAILED(rv)) return rv;
static NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID); rv = nsComponentManager::CreateInstance(kRDFInMemoryDataSourceCID, nsnull, NS_GET_IID(nsIRDFDataSource), getter_AddRefs(mDataSource)); if (NS_FAILED(rv)) return rv;
nsHTTPIndexParser::Init(){  NS_PRECONDITION(mHTTPIndex != nsnull, "not initialized");  if (! mHTTPIndex)    return NS_ERROR_NOT_INITIALIZED;  nsresult rv;  rv = mHTTPIndex->GetDataSource(getter_AddRefs(mDataSource));  if (NS_FAILED(rv)) return rv;  // No datasource. Uh oh. We won't be much use then.  if (! mDataSource)    return NS_ERROR_UNEXPECTED;  if (gRefCnt++ == 0) {    rv = nsServiceManager::GetService("component://netscape/rdf/rdf-service",                                      NS_GET_IID(nsIRDFService),                                      NS_REINTERPRET_CAST(nsISupports**, &gRDF));    if (NS_FAILED(rv)) return rv;    rv = gRDF->GetResource(HTTPINDEX_NAMESPACE_URI "Comment",  &kHTTPIndex_Comment);    if (NS_FAILED(rv)) return rv;    rv = gRDF->GetResource(HTTPINDEX_NAMESPACE_URI "Filename", &kHTTPIndex_Filename);    if (NS_FAILED(rv)) return rv;    rv = gRDF->GetResource(HTTPINDEX_NAMESPACE_URI "Loading",  &kHTTPIndex_Loading);    if (NS_FAILED(rv)) return rv;    rv = gRDF->GetLiteral(nsAutoString("true").GetUnicode(), &kTrueLiteral);    if (NS_FAILED(rv)) return rv;    for (Field* field = gFieldTable; field->mName; ++field) {      nsCAutoString str(HTTPINDEX_NAMESPACE_URI);      str += field->mName;      rv = gRDF->GetResource(str, &field->mProperty);      if (NS_FAILED(rv)) return rv;    }  }  return NS_OK;}