From 92ee49279421e12ffd593c4a779e9eb4768ec98a Mon Sep 17 00:00:00 2001 From: gdr-ftp Date: Sat, 28 Mar 1998 16:46:59 +0000 Subject: [PATCH] added the _reportStack(3) routine --- include/gno/gno.h | 3 ++- lib/libc/gno/stack2.c | 14 +++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/include/gno/gno.h b/include/gno/gno.h index a02b39c..6c00b5d 100644 --- a/include/gno/gno.h +++ b/include/gno/gno.h @@ -2,7 +2,7 @@ * gno/gno.h This collection of declarations are for routines that * reside in libc, but are Apple IIgs or GNO specific. * - * $Id: gno.h,v 1.2 1997/12/21 19:58:15 gdr Exp $ + * $Id: gno.h,v 1.3 1998/03/28 16:46:59 gdr-ftp Exp $ */ #ifndef _GNO_GNO_H_ @@ -59,6 +59,7 @@ void _assertStack __P((unsigned int, int, const char *)); void _beginStackCheck __P((void)); int _endStackCheck __P((void)); unsigned int _getStackBottom __P((void)); +void _reportStack __P((void)); /* String Conversions */ #define GIfree(a) free(a) diff --git a/lib/libc/gno/stack2.c b/lib/libc/gno/stack2.c index c56ba49..84c8b6d 100644 --- a/lib/libc/gno/stack2.c +++ b/lib/libc/gno/stack2.c @@ -4,7 +4,7 @@ * * This file is formatted for tab stops every eight columns. * - * $Id: stack2.c,v 1.1 1997/12/21 20:11:17 gdr Exp $ + * $Id: stack2.c,v 1.2 1998/03/28 16:46:56 gdr-ftp Exp $ */ #ifdef __ORCAC__ @@ -14,9 +14,21 @@ segment "libc_gno__"; #endif +#include #include #include +static void +_printStack (void) { + warnx("stack usage: %d bytes", _endStackCheck()); +} + +void +_reportStack (void) { + _beginStackCheck(); + atexit(_printStack); +} + void _assertStack (unsigned int bytes, int line, const char *file) { static const char *fname = "_assertStack";