| 2755 | #ifndef SFCTOOL |
| 2756 | |
| 2757 | DISABLE_WARNING_FORMAT_NONLITERAL |
| 2758 | |
| 2759 | /* for '#stats' wizard-mode command, to show memory used for #overview data */ |
| 2760 | void |
| 2761 | overview_stats( |
| 2762 | winid win, /* output window */ |
| 2763 | const char *statsfmt, /* format */ |
| 2764 | long *total_count, long *total_size) /* args for the format */ |
| 2765 | { |
| 2766 | char buf[BUFSZ], hdrbuf[QBUFSZ]; |
| 2767 | long ocount, osize, bcount, bsize, acount, asize; |
| 2768 | struct cemetery *ce; |
| 2769 | mapseen *mptr; |
| 2770 | |
| 2771 | ocount = bcount = acount = osize = bsize = asize = 0L; |
| 2772 | for (mptr = svm.mapseenchn; mptr; mptr = mptr->next) { |
| 2773 | ++ocount; |
| 2774 | osize += (long) sizeof *mptr; |
| 2775 | for (ce = mptr->final_resting_place; ce; ce = ce->next) { |
| 2776 | ++bcount; |
| 2777 | bsize += (long) sizeof *ce; |
| 2778 | } |
| 2779 | if (mptr->custom_lth) { |
| 2780 | ++acount; |
| 2781 | asize += (long) (mptr->custom_lth + 1); |
| 2782 | } |
| 2783 | } |
| 2784 | |
| 2785 | Sprintf(hdrbuf, "general, size %ld", (long) sizeof (mapseen)); |
| 2786 | Sprintf(buf, statsfmt, hdrbuf, ocount, osize); |
| 2787 | putstr(win, 0, buf); |
| 2788 | if (bcount) { |
| 2789 | Sprintf(hdrbuf, "cemetery, size %ld", |
| 2790 | (long) sizeof (struct cemetery)); |
| 2791 | Sprintf(buf, statsfmt, hdrbuf, bcount, bsize); |
| 2792 | putstr(win, 0, buf); |
| 2793 | } |
| 2794 | if (acount) { |
| 2795 | Sprintf(hdrbuf, "annotations, text"); |
| 2796 | Sprintf(buf, statsfmt, hdrbuf, acount, asize); |
| 2797 | putstr(win, 0, buf); |
| 2798 | } |
| 2799 | *total_count += ocount + bcount + acount; |
| 2800 | *total_size += osize + bsize + asize; |
| 2801 | } |
| 2802 | |
| 2803 | RESTORE_WARNING_FORMAT_NONLITERAL |
| 2804 | |