summaryrefslogtreecommitdiffhomepage
path: root/ir/stat
diff options
context:
space:
mode:
authorChristoph Mallon <mallon@cs.uni-saarland.de>2014-10-19 16:30:23 +0200
committerChristoph Mallon <mallon@cs.uni-saarland.de>2014-10-19 19:19:34 +0200
commit144773f1311ed65779a386f9bc4bc52d4cc0b08c (patch)
tree668661054165dbcd35d26288259e68d25db9411d /ir/stat
parent08b65b11e4777867b9c7c037a5166ef4fa8a3260 (diff)
stat: Cleanup.
Diffstat (limited to 'ir/stat')
-rw-r--r--ir/stat/firmstat.c32
1 files changed, 6 insertions, 26 deletions
diff --git a/ir/stat/firmstat.c b/ir/stat/firmstat.c
index 2a577f6..2c6b050 100644
--- a/ir/stat/firmstat.c
+++ b/ir/stat/firmstat.c
@@ -1964,11 +1964,7 @@ void stat_be_block_stat_permcycle(const char *class_name, ir_node *perm, ir_node
/* Dumps a statistics snapshot. */
void stat_dump_snapshot(const char *name, const char *phase)
{
- char fname[2048];
- const char *p;
- size_t l;
-
- if (! status->stat_options)
+ if (!status->stat_options)
return;
STAT_ENTER;
@@ -1984,35 +1980,19 @@ void stat_dump_snapshot(const char *name, const char *phase)
stat_const_clear(status);
/* build the name */
- p = strrchr(name, '/');
+ char const *p = strrchr(name, '/');
#ifdef _WIN32
{
- const char *q;
-
- q = strrchr(name, '\\');
-
+ char const *const q = strrchr(name, '\\');
/* NULL might be not the smallest pointer */
if (q && (!p || q > p))
p = q;
}
#endif /* _WIN32 */
- if (p) {
- ++p;
- l = p - name;
+ p = p ? p + 1 : name;
- if (l > (int) (sizeof(fname) - 1))
- l = sizeof(fname) - 1;
-
- memcpy(fname, name, l);
- fname[l] = '\0';
- } else {
- fname[0] = '\0';
- p = name;
- }
- strncat(fname, "firmstat-", sizeof(fname)-strlen(fname)-1);
- strncat(fname, phase, sizeof(fname)-strlen(fname)-1);
- strncat(fname, "-", sizeof(fname)-strlen(fname)-1);
- strncat(fname, p, sizeof(fname)-strlen(fname)-1);
+ char fname[2048];
+ snprintf(fname, sizeof(fname), "%.*sfirmstat-%s-%s", (int)(p - name), name, phase, p);
stat_dump_init(fname);