nsresult rv;
NS_PRECONDITION(aEnv != nsnull, "null ptr"); if (! aEnv) return NS_ERROR_NULL_POINTER;
nsGlobalHistory::Init(){  nsresult rv;  if (gRefCnt++ == 0) {    rv = nsServiceManager::GetService(kRDFServiceCID,                                      nsIRDFService::GetIID(),                                      (nsISupports**) &gRDFService);    NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service");    if (NS_FAILED(rv)) return rv;    gRDFService->GetResource(NC_NAMESPACE_URI "Page",        &kNC_Page);    gRDFService->GetResource(NC_NAMESPACE_URI "Date",        &kNC_Date);    gRDFService->GetResource(NC_NAMESPACE_URI "VisitCount",  &kNC_VisitCount);    gRDFService->GetResource(NC_NAMESPACE_URI "Name",        &kNC_Name);    gRDFService->GetResource(NC_NAMESPACE_URI "Referrer",    &kNC_Referrer);    gRDFService->GetResource(NC_NAMESPACE_URI "child",       &kNC_child);    gRDFService->GetResource(NC_NAMESPACE_URI "URL",         &kNC_URL);    gRDFService->GetResource("NC:HistoryRoot",               &kNC_HistoryRoot);    gRDFService->GetResource("NC:HistoryBySite",             &kNC_HistoryBySite);    gRDFService->GetResource("NC:HistoryByDate",             &kNC_HistoryByDate);  }  // register this as a named data source with the RDF service  rv = gRDFService->RegisterDataSource(this, PR_FALSE);  NS_ASSERTION(NS_SUCCEEDED(rv), "somebody already created & registered the history data source");  if (NS_FAILED(rv)) return rv;  rv = OpenDB();  if (NS_FAILED(rv)) return rv;  return NS_OK;}