/* Free all the lines in HBufferImage. Fields affected: Lines CurrentLine NumLines ListHead */
EFI_STATUS HFreeLines(IN LIST_ENTRY *ListHead, IN HEFI_EDITOR_LINE *Lines)
/* Free all the lines in HBufferImage. Fields affected: Lines CurrentLine NumLines ListHead */
EFI_STATUS HFreeLines(IN LIST_ENTRY *ListHead, IN HEFI_EDITOR_LINE *Lines)
{
  LIST_ENTRY        *Link;
  HEFI_EDITOR_LINE  *Line;
  if (Lines != NULL) {
    Line = Lines;
    Link = &(Line->Link);
    do {
      Line = CR (Link, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST);
      Link = Link->ForwardLink;
      HLineFree (Line);
    } while (Link != ListHead);
  }
  ListHead->ForwardLink = ListHead;
  ListHead->BackLink    = ListHead;
  return EFI_SUCCESS;
}