aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2017-02-21 15:16:59 +0100
committerSverker Eriksson <[email protected]>2017-02-21 15:26:34 +0100
commitd4e2691d35fc7e1964e58be524d826752001f2a5 (patch)
treee3bfaef2c29158f9dd4d82eeea97e9e7d22c8fed
parentfaaf8ffe2902de80c91fbed1e74b062b94edd792 (diff)
downloadotp-d4e2691d35fc7e1964e58be524d826752001f2a5.tar.gz
otp-d4e2691d35fc7e1964e58be524d826752001f2a5.tar.bz2
otp-d4e2691d35fc7e1964e58be524d826752001f2a5.zip
erts: Beautify loaded()
by removing some unnecessary conditions and remove unused and faulty summation for 'cur' and 'old'.
-rw-r--r--erts/emulator/beam/break.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/erts/emulator/beam/break.c b/erts/emulator/beam/break.c
index 71934e1376..2efdd1ab89 100644
--- a/erts/emulator/beam/break.c
+++ b/erts/emulator/beam/break.c
@@ -408,13 +408,9 @@ loaded(fmtfn_t to, void *to_arg)
* Calculate and print totals.
*/
for (i = 0; i < module_code_size(code_ix); i++) {
- if ((modp = module_code(i, code_ix)) != NULL &&
- ((modp->curr.code_length != 0) ||
- (modp->old.code_length != 0))) {
+ if ((modp = module_code(i, code_ix)) != NULL) {
cur += code_size(&modp->curr);
- if (modp->old.code_length != 0) {
- old += code_size(&modp->old);
- }
+ old += code_size(&modp->old);
}
}
erts_print(to, to_arg, "Current code: %d\n", cur);
@@ -430,26 +426,20 @@ loaded(fmtfn_t to, void *to_arg)
/*
* Interactive dump; keep it brief.
*/
- if (modp != NULL &&
- ((modp->curr.code_length != 0) ||
- (modp->old.code_length != 0))) {
- erts_print(to, to_arg, "%T", make_atom(modp->module));
- cur += code_size(&modp->curr);
- erts_print(to, to_arg, " %d", code_size(&modp->curr));
- if (modp->old.code_length != 0) {
- erts_print(to, to_arg, " (%d old)",
- code_size(&modp->old));
- old += code_size(&modp->old);
- }
+ if (modp != NULL && ((modp->curr.code_length != 0) ||
+ (modp->old.code_length != 0))) {
+ erts_print(to, to_arg, "%T %d", make_atom(modp->module),
+ code_size(&modp->curr));
+ if (modp->old.code_length != 0)
+ erts_print(to, to_arg, " (%d old)", code_size(&modp->old));
erts_print(to, to_arg, "\n");
}
} else {
/*
* To crash dump; make it parseable.
*/
- if (modp != NULL &&
- ((modp->curr.code_length != 0) ||
- (modp->old.code_length != 0))) {
+ if (modp != NULL && ((modp->curr.code_length != 0) ||
+ (modp->old.code_length != 0))) {
erts_print(to, to_arg, "=mod:");
erts_print(to, to_arg, "%T", make_atom(modp->module));
erts_print(to, to_arg, "\n");