Permission_Save();
Permission_Save(PR_TRUE);
Permission_AddHost(char * host, PRBool permission, PRInt32 type, PRBool save) {  /* create permission list if it does not yet exist */  if(!permission_list) {    permission_list = new nsVoidArray();    if(!permission_list) {      Recycle(host);      return NS_ERROR_OUT_OF_MEMORY;    }  }  /* find existing entry for host */  permission_HostStruct * hostStruct = nsnull; // initialized only to avoid warning message  PRBool HostFound = PR_FALSE;  PRInt32 hostCount = permission_list->Count();  PRInt32 i;  for (i = 0; i < hostCount; ++i) {    hostStruct = NS_STATIC_CAST(permission_HostStruct*, permission_list->ElementAt(i));    if (hostStruct) {      if (PL_strcasecmp(host,hostStruct->host)==0) {        /* host found in list */        Recycle(host);        HostFound = PR_TRUE;        break;#ifdef alphabetize      } else if (PL_strcasecmp(host, hostStruct->host) < 0) {        /* need to insert new entry here */        break;#endif      }    }  }  if (!HostFound) {    /* create a host structure for the host */    hostStruct = PR_NEW(permission_HostStruct);    if (!hostStruct) {      Recycle(host);      return NS_ERROR_FAILURE;    }    hostStruct->host = host;    hostStruct->permissionList = new nsVoidArray();    if(!hostStruct->permissionList) {      PR_Free(hostStruct);      Recycle(host);      return NS_ERROR_FAILURE;    }    /* insert host structure into the list */    if (i == permission_list->Count()) {      permission_list->AppendElement(hostStruct);    } else {      permission_list->InsertElementAt(hostStruct, i);    }  }  /* see if host already has an entry for this type */  permission_TypeStruct * typeStruct;  PRBool typeFound = PR_FALSE;  PRInt32 typeCount = hostStruct->permissionList->Count();  for (PRInt32 typeIndex=0; typeIndex<typeCount; typeIndex++) {    typeStruct = NS_STATIC_CAST      (permission_TypeStruct*, hostStruct->permissionList->ElementAt(typeIndex));    if (typeStruct->type == type) {      /* type found.  Modify the corresponding permission */      typeStruct->permission = permission;      typeFound = PR_TRUE;      break;    }  }  /* create a type structure and attach it to the host structure */  if (!typeFound) {    typeStruct = PR_NEW(permission_TypeStruct);    typeStruct->type = type;    typeStruct->permission = permission;    hostStruct->permissionList->AppendElement(typeStruct);  }  /* write the changes out to a file */  if (save) {    permission_changed = PR_TRUE;    Permission_Save();  }  return NS_OK;}