X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gprof%2Fcg_arcs.c;h=7ea048b069467a80594a2c17479112537ac84b9b;hb=949f8813f94f3d046d62c93f17736557dfbf42dd;hp=b63102948b036f5cf9534ad16f958458d78b3e84;hpb=df928c8f28aab3867ae2283c7425d1a9480c20a1;p=deliverable%2Fbinutils-gdb.git diff --git a/gprof/cg_arcs.c b/gprof/cg_arcs.c index b63102948b..7ea048b069 100644 --- a/gprof/cg_arcs.c +++ b/gprof/cg_arcs.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1983 Regents of the University of California. + * Copyright (c) 1983, 2001 Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms are permitted @@ -26,9 +26,9 @@ #include "sym_ids.h" Sym *cycle_header; -int num_cycles; +unsigned int num_cycles; Arc **arcs; -int numarcs; +unsigned int numarcs; /* * Return TRUE iff PARENT has an arc to covers the address @@ -65,12 +65,12 @@ DEFUN (arc_lookup, (parent, child), Sym * parent AND Sym * child) */ void DEFUN (arc_add, (parent, child, count), - Sym * parent AND Sym * child AND int count) + Sym * parent AND Sym * child AND unsigned long count) { - static int maxarcs = 0; + static unsigned int maxarcs = 0; Arc *arc, **newarcs; - DBG (TALLYDEBUG, printf ("[arc_add] %d arcs from %s to %s\n", + DBG (TALLYDEBUG, printf ("[arc_add] %lu arcs from %s to %s\n", count, parent->name, child->name)); arc = arc_lookup (parent, child); if (arc) @@ -78,12 +78,13 @@ DEFUN (arc_add, (parent, child, count), /* * A hit: just increment the count. */ - DBG (TALLYDEBUG, printf ("[tally] hit %d += %d\n", + DBG (TALLYDEBUG, printf ("[tally] hit %lu += %lu\n", arc->count, count)); arc->count += count; return; } arc = (Arc *) xmalloc (sizeof (*arc)); + memset (arc, 0, sizeof (*arc)); arc->parent = parent; arc->child = child; arc->count = count; @@ -101,7 +102,7 @@ DEFUN (arc_add, (parent, child, count), if (maxarcs == 0) maxarcs = 1; maxarcs *= 2; - + /* Allocate the new array. */ newarcs = (Arc **)xmalloc(sizeof (Arc *) * maxarcs); @@ -210,7 +211,7 @@ DEFUN (propagate_time, (parent), Sym * parent) DBG (PROPDEBUG, printf ("[prop_time] child \t"); print_name (child); - printf (" with %f %f %d/%d\n", child->hist.time, + printf (" with %f %f %lu/%lu\n", child->hist.time, child->cg.child_time, arc->count, child->ncalls); printf ("[prop_time] parent\t"); print_name (parent); @@ -360,7 +361,7 @@ DEFUN (inherit_flags, (child), Sym * child) * is static (and all others are, too)) no time propagates * along this arc. */ - if (child->ncalls) + if (child->ncalls != 0) { child->cg.prop.fract += parent->cg.prop.fract * (((double) arc->count) / ((double) child->ncalls)); @@ -390,7 +391,7 @@ DEFUN (inherit_flags, (child), Sym * child) * arc is static (and all others are, too)) no time * propagates along this arc. */ - if (head->ncalls) + if (head->ncalls != 0) { head->cg.prop.fract += parent->cg.prop.fract * (((double) arc->count) / ((double) head->ncalls)); @@ -574,10 +575,9 @@ Sym ** DEFUN_VOID (cg_assemble) { Sym *parent, **time_sorted_syms, **top_sorted_syms; - long index; + unsigned int index; Arc *arc; - extern void find_call PARAMS ((Sym * parent, - bfd_vma p_lowpc, bfd_vma p_highpc)); + /* * initialize various things: * zero out child times.