diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-06-10 14:15:53 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-06-10 14:15:53 +0100 |
commit | d8be3b59d1e33e9fe037b31ac16af016133ec0af (patch) | |
tree | 7ffb48bee82549e94d33acc397571e5322671a43 /tools/xenstat/xentop | |
parent | f4692e35f1d6f7b5ed623debf58d205f0749efd5 (diff) | |
download | xen-d8be3b59d1e33e9fe037b31ac16af016133ec0af.tar.gz xen-d8be3b59d1e33e9fe037b31ac16af016133ec0af.tar.bz2 xen-d8be3b59d1e33e9fe037b31ac16af016133ec0af.zip |
xenstat: some cleanups
sprintf -> snprintf
malloc(n * m) -> calloc(n, m)
get rid of a cast
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Diffstat (limited to 'tools/xenstat/xentop')
-rw-r--r-- | tools/xenstat/xentop/xentop.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/xenstat/xentop/xentop.c b/tools/xenstat/xentop/xentop.c index 52fb343376..4d85e64ff8 100644 --- a/tools/xenstat/xentop/xentop.c +++ b/tools/xenstat/xentop/xentop.c @@ -755,10 +755,11 @@ void do_summary(void) unsigned i, num_domains = 0; unsigned long long used = 0; xenstat_domain *domain; + time_t curt; /* Print program name, current time, and number of domains */ - strftime(time_str, TIME_STR_LEN, TIME_STR_FORMAT, - localtime((const time_t *)&curtime.tv_sec)); + curt = curtime.tv_sec; + strftime(time_str, TIME_STR_LEN, TIME_STR_FORMAT, localtime(&curt)); num_domains = xenstat_node_num_domains(cur_node); ver_str = xenstat_node_xen_version(cur_node); print("xentop - %s Xen %s\n", time_str, ver_str); @@ -978,7 +979,7 @@ static void top(void) /* Count the number of domains for which to report data */ num_domains = xenstat_node_num_domains(cur_node); - domains = malloc(num_domains*sizeof(xenstat_domain *)); + domains = calloc(num_domains, sizeof(xenstat_domain *)); if(domains == NULL) fail("Failed to allocate memory\n"); |