MCPcopy Create free account
hub / github.com/NetHack/NetHack / free_window_info

Function free_window_info

win/tty/wintty.c:986–1031  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

984}
985
986static void
987free_window_info(struct WinDesc *cw, boolean free_data)
988{
989 int i;
990
991 if (cw->data) {
992 if (WIN_MESSAGE != WIN_ERR && cw == wins[WIN_MESSAGE]
993 && cw->rows > cw->maxrow)
994 cw->maxrow = cw->rows; /* topl data */
995 for (i = 0; i < cw->maxrow; i++)
996 if (cw->data[i]) {
997 free((genericptr_t) cw->data[i]);
998 cw->data[i] = (char *) 0;
999 if (cw->datlen)
1000 cw->datlen[i] = 0;
1001 }
1002 if (free_data) {
1003 free((genericptr_t) cw->data);
1004 cw->data = (char **) 0;
1005 if (cw->datlen)
1006 free((genericptr_t) cw->datlen);
1007 cw->datlen = (short *) 0;
1008 cw->rows = 0;
1009 }
1010 }
1011 cw->maxrow = cw->maxcol = 0;
1012 if (cw->mlist) {
1013 tty_menu_item *temp;
1014
1015 while ((temp = cw->mlist) != 0) {
1016 cw->mlist = temp->next;
1017 if (temp->str)
1018 free((genericptr_t) temp->str);
1019 free((genericptr_t) temp);
1020 }
1021 }
1022 if (cw->plist) {
1023 free((genericptr_t) cw->plist);
1024 cw->plist = 0;
1025 }
1026 cw->plist_size = cw->npages = cw->nitems = cw->how = 0;
1027 if (cw->morestr) {
1028 free((genericptr_t) cw->morestr);
1029 cw->morestr = 0;
1030 }
1031}
1032
1033void
1034tty_clear_nhwindow(winid window)

Callers 3

tty_exit_nhwindowsFunction · 0.85
tty_clear_nhwindowFunction · 0.85
tty_destroy_nhwindowFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected