diff options
author | Ian Lance Taylor <ian@airs.com> | 1998-08-12 19:06:24 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1998-08-12 19:06:24 +0000 |
commit | 8c73afb3537b7271772a31466ec614a4d0634436 (patch) | |
tree | 639323c1b8888bf5fe9abcccb505211b1d56383b /gprof/hist.c | |
parent | 15ec5eb33b983e2900205cffd919cca52f8e1394 (diff) | |
download | gdb-8c73afb3537b7271772a31466ec614a4d0634436.zip gdb-8c73afb3537b7271772a31466ec614a4d0634436.tar.gz gdb-8c73afb3537b7271772a31466ec614a4d0634436.tar.bz2 |
Avoid some overflow cases:
* basic_blocks.h (bb_min_calls): Change to unsigned long.
* call_graph.h (cg_tally): Change count parameter to unsigned
long.
* cg_arcs.h (Arc): Change count field to unsigned long.
(arc_add): Change count parameter to unsigned long.
* source.h (Source_File): Change ncalls field to unsigned long.
* symtab.h (Sym): Change fields ncalls, bb_calls, and
cg.self_calls to unsigned long.
* Many files: Update accordingly.
Diffstat (limited to 'gprof/hist.c')
-rw-r--r-- | gprof/hist.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/gprof/hist.c b/gprof/hist.c index e027d9a..5cdbbbb 100644 --- a/gprof/hist.c +++ b/gprof/hist.c @@ -427,9 +427,9 @@ DEFUN (print_line, (sym, scale), Sym * sym AND double scale) total_time > 0.0 ? 100 * sym->hist.time / total_time : 0.0, accum_time / hz, sym->hist.time / hz); } - if (sym->ncalls) + if (sym->ncalls != 0) { - printf (" %8d %8.2f %8.2f ", + printf (" %8lu %8.2f %8.2f ", sym->ncalls, scale * sym->hist.time / hz / sym->ncalls, scale * (sym->hist.time + sym->cg.child_time) / hz / sym->ncalls); } @@ -460,7 +460,6 @@ DEFUN (cmp_time, (lp, rp), const PTR lp AND const PTR rp) const Sym *left = *(const Sym **) lp; const Sym *right = *(const Sym **) rp; double time_diff; - long call_diff; time_diff = right->hist.time - left->hist.time; if (time_diff > 0.0) @@ -472,12 +471,11 @@ DEFUN (cmp_time, (lp, rp), const PTR lp AND const PTR rp) return -1; } - call_diff = right->ncalls - left->ncalls; - if (call_diff > 0) + if (right->ncalls > left->ncalls) { return 1; } - if (call_diff < 0) + if (right->ncalls < left->ncalls) { return -1; } @@ -547,7 +545,7 @@ DEFUN_VOID (hist_print) for (index = 0; index < symtab.len; ++index) { sym = time_sorted_syms[index]; - if (sym->ncalls) + if (sym->ncalls != 0) { time = (sym->hist.time + sym->cg.child_time) / sym->ncalls; if (time > top_time) @@ -557,7 +555,7 @@ DEFUN_VOID (hist_print) } } } - if (top_dog && top_dog->ncalls && top_time > 0.0) + if (top_dog && top_dog->ncalls != 0 && top_time > 0.0) { top_time /= hz; while (SItab[log_scale].scale * top_time < 1000.0 |