} else if((ptr->item1.Compare(item1))>=0) {
} else if((mapElementPtr->item1.Compare(item1))>=0) {
wallet_WriteToList(    nsString item1,     // not ref. Locally modified    nsString item2,     // not ref. Locally modified    nsVoidArray* itemList,    nsVoidArray*& list,    PRBool obscure,    PlacementType placement = DUP_BEFORE) {  wallet_MapElement * ptr;  PRBool added_to_list = PR_FALSE;  wallet_MapElement * mapElement;  if (list == wallet_URLFieldToSchema_list || list == wallet_FieldToSchema_list ||      list == wallet_SchemaConcat_list  || list == wallet_DistinguishedSchema_list) {    mapElement = wallet_AlocateMapElement();  } else {    mapElement = new wallet_MapElement;  }  if (!mapElement) {    return PR_FALSE;  }  item1.ToLowerCase();  if (obscure) {    nsAutoString crypt;    if (NS_FAILED(Wallet_Encrypt(item2, crypt))) {      return PR_FALSE;    }    item2 = crypt;  }  mapElement->item1.SetCapacity(item1.Length());  mapElement->item2.SetCapacity(item2.Length());  mapElement->item1 = item1;  mapElement->item2 = item2;  mapElement->itemList = itemList;  /* make sure the list exists */  if(!list) {      list = new nsVoidArray();      if(!list) {          return PR_FALSE;      }  }  /*   * Add new entry to the list in alphabetical order by item1.   * If identical value of item1 exists, use "placement" parameter to    * determine what to do   */  if (AT_END==placement) {    list->AppendElement(mapElement);    return PR_TRUE;  }  PRInt32 count = LIST_COUNT(list);  for (PRInt32 i=0; i<count; i++) {    ptr = NS_STATIC_CAST(wallet_MapElement*, list->ElementAt(i));    if((ptr->item1.Compare(item1))==0) {      if (DUP_OVERWRITE==placement) {        delete mapElement;        ptr->item1.SetCapacity(item1.Length());        ptr->item2.SetCapacity(item2.Length());        ptr->item1 = item1;        ptr->item2 = item2;        ptr->itemList = itemList;      } else if (DUP_BEFORE==placement) {        list->InsertElementAt(mapElement, i);      }      if (DUP_AFTER!=placement) {        added_to_list = PR_TRUE;        break;      }    } else if((ptr->item1.Compare(item1))>=0) {      list->InsertElementAt(mapElement, i);      added_to_list = PR_TRUE;      break;    }  }  if (!added_to_list) {    list->AppendElement(mapElement);  }  return PR_TRUE;}