if (PrintersAreAllocated()) {
if (PrintersAreAllocated())
nsresult GlobalPrinters::InitializeGlobalPrinters (){  if (PrintersAreAllocated()) {    return NS_OK;  }  mGlobalNumPrinters = 0;  mGlobalPrinterList = new nsStringArray();  if (!mGlobalPrinterList)     return NS_ERROR_OUT_OF_MEMORY;#ifdef USE_POSTSCRIPT        /* add an entry for the default printer (see nsPostScriptObj.cpp) */  mGlobalPrinterList->AppendString(    nsString(NS_ConvertASCIItoUCS2(NS_POSTSCRIPT_DRIVER_NAME "default")));  mGlobalNumPrinters++;#endif /* USE_POSTSCRIPT */  /* get the list of printers */  char *printerList = nsnull;    /* the env var MOZILLA_PRINTER_LIST can "override" the prefs */  printerList = PR_GetEnv("MOZILLA_PRINTER_LIST");    if (!printerList) {    nsresult rv;    nsCOMPtr<nsIPref> pPrefs = do_GetService(NS_PREF_CONTRACTID, &rv);    if (NS_SUCCEEDED(rv)) {      (void) pPrefs->CopyCharPref("print.printer_list", &printerList);    }  }    if (printerList) {    char *tok_lasts;    char *name;        /* PL_strtok_r() will modify the string - copy it! */    printerList = strdup(printerList);    if (!printerList)      return NS_ERROR_OUT_OF_MEMORY;    #ifdef USE_POSTSCRIPT        for( name = PL_strtok_r(printerList, " ", &tok_lasts) ;          name != nsnull ;          name = PL_strtok_r(nsnull, " ", &tok_lasts) )    {      mGlobalPrinterList->AppendString(        nsString(NS_ConvertASCIItoUCS2(NS_POSTSCRIPT_DRIVER_NAME)) +         nsString(NS_ConvertASCIItoUCS2(name)));      mGlobalNumPrinters++;          }#endif /* USE_POSTSCRIPT */    free(printerList);  }        if (mGlobalNumPrinters == 0)    return NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE;   return NS_OK;}