/* This function deletes all Simple Font packages from a package list node. This is a internal function. */
EFI_STATUS RemoveSimpleFontPackages(IN HII_DATABASE_PRIVATE_DATA *Private, IN EFI_HII_HANDLE Handle, IN OUT HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageList)
/* This function deletes all Simple Font packages from a package list node. This is a internal function. */
EFI_STATUS RemoveSimpleFontPackages(IN HII_DATABASE_PRIVATE_DATA *Private, IN EFI_HII_HANDLE Handle, IN OUT HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageList)
{
  LIST_ENTRY                        *ListHead;
  HII_SIMPLE_FONT_PACKAGE_INSTANCE  *Package;
  EFI_STATUS                        Status;
  ListHead = &PackageList->SimpleFontPkgHdr;
  while (!IsListEmpty (ListHead)) {
    Package = CR (
                ListHead->ForwardLink,
                HII_SIMPLE_FONT_PACKAGE_INSTANCE,
                SimpleFontEntry,
                HII_S_FONT_PACKAGE_SIGNATURE
                );
    Status = InvokeRegisteredFunction (
               Private,
               EFI_HII_DATABASE_NOTIFY_REMOVE_PACK,
               (VOID *)Package,
               EFI_HII_PACKAGE_SIMPLE_FONTS,
               Handle
               );
    if (EFI_ERROR (Status)) {
      return Status;
    }
    RemoveEntryList (&Package->SimpleFontEntry);
    PackageList->PackageListHdr.PackageLength -= Package->SimpleFontPkgHdr->Header.Length;
    FreePool (Package->SimpleFontPkgHdr);
    FreePool (Package);
  }
  return EFI_SUCCESS;
}