summaryrefslogtreecommitdiffstats
path: root/usr.bin/gprof/dfn.c
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>2002-10-16 13:50:09 +0000
committercharnier <charnier@FreeBSD.org>2002-10-16 13:50:09 +0000
commit064bebe6d3d4f05ecc20524571d6bc4519997bd5 (patch)
treed111768d17cfb105c6bbb279f69b9a271d1a9c41 /usr.bin/gprof/dfn.c
parent6dec6a19baa7759402451fa076be28cc26359333 (diff)
downloadFreeBSD-src-064bebe6d3d4f05ecc20524571d6bc4519997bd5.zip
FreeBSD-src-064bebe6d3d4f05ecc20524571d6bc4519997bd5.tar.gz
Remove done() which was just exit() so use of warn()/err() can be made. Abort
on allocation failure instead of displaying a warning and deferencing NULL pointer after. Spelling. Add prototypes. Add list of option in synopsis section of man page, -d is not referenced because available as a compile option. It should be made a runtime option btw.
Diffstat (limited to 'usr.bin/gprof/dfn.c')
-rw-r--r--usr.bin/gprof/dfn.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/usr.bin/gprof/dfn.c b/usr.bin/gprof/dfn.c
index 9d2a08a..0e23a87 100644
--- a/usr.bin/gprof/dfn.c
+++ b/usr.bin/gprof/dfn.c
@@ -31,17 +31,16 @@
* SUCH DAMAGE.
*/
-#ifndef lint
#if 0
+#ifndef lint
static char sccsid[] = "@(#)dfn.c 8.1 (Berkeley) 6/6/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
#endif /* not lint */
+#endif
+
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <stdio.h>
+#include <err.h>
#include "gprof.h"
#define DFN_DEPTH 100
@@ -56,6 +55,7 @@ int dfn_depth;
int dfn_counter;
+void
dfn_init()
{
@@ -66,6 +66,7 @@ dfn_init()
/*
* given this parent, depth first number its children.
*/
+void
dfn( parentp )
nltype *parentp;
{
@@ -79,7 +80,7 @@ dfn( parentp )
}
# endif /* DEBUG */
/*
- * if we're already numbered, no need to look any furthur.
+ * if we're already numbered, no need to look any further.
*/
if ( dfn_numbered( parentp ) ) {
return;
@@ -112,15 +113,14 @@ dfn( parentp )
/*
* push a parent onto the stack and mark it busy
*/
+void
dfn_pre_visit( parentp )
nltype *parentp;
{
dfn_depth += 1;
- if ( dfn_depth >= DFN_DEPTH ) {
- fprintf( stderr , "[dfn] out of my depth (dfn_stack overflow)\n" );
- exit( 1 );
- }
+ if ( dfn_depth >= DFN_DEPTH )
+ errx( 1 , "[dfn] out of my depth (dfn_stack overflow)" );
dfn_stack[ dfn_depth ].nlentryp = parentp;
dfn_stack[ dfn_depth ].cycletop = dfn_depth;
parentp -> toporder = DFN_BUSY;
@@ -161,6 +161,7 @@ dfn_busy( childp )
/*
* MISSING: an explanation
*/
+void
dfn_findcycle( childp )
nltype *childp;
{
@@ -179,10 +180,8 @@ dfn_findcycle( childp )
break;
}
}
- if ( cycletop <= 0 ) {
- fprintf( stderr , "[dfn_findcycle] couldn't find head of cycle\n" );
- exit( 1 );
- }
+ if ( cycletop <= 0 )
+ errx( 1 , "[dfn_findcycle] couldn't find head of cycle" );
# ifdef DEBUG
if ( debug & DFNDEBUG ) {
printf( "[dfn_findcycle] dfn_depth %d cycletop %d " ,
@@ -271,6 +270,7 @@ dfn_findcycle( childp )
* deal with self-cycles
* for lint: ARGSUSED
*/
+void
dfn_self_cycle( parentp )
nltype *parentp;
{
@@ -292,6 +292,7 @@ dfn_self_cycle( parentp )
* [MISSING: an explanation]
* and pop it off the stack
*/
+void
dfn_post_visit( parentp )
nltype *parentp;
{
OpenPOWER on IntegriCloud