chiark / gitweb /
move _cleanup_ attribute in front of the type
[elogind.git] / src / bootchart / svg.c
index a4086c52278d77250ccfa2caff1677c9a34486b1..1e87fb57391af96aecea39d364506c19f5c8bd1a 100644 (file)
@@ -389,7 +389,7 @@ static void svg_pss_graph(void) {
         svg("\n\n<!-- PSS map - csv format -->\n");
         ps = ps_first;
         while (ps->next_ps) {
-                char _cleanup_free_ *enc_name = NULL;
+                _cleanup_free_ char *enc_name = NULL;
                 ps = ps->next_ps;
                 if (!ps)
                         continue;
@@ -711,7 +711,7 @@ static int ps_filter(struct ps_struct *ps) {
 }
 
 static void svg_do_initcall(int count_only) {
-        FILE _cleanup_pclose_ *f = NULL;
+        _cleanup_pclose_ FILE *f = NULL;
         double t;
         char func[256];
         int ret;
@@ -815,7 +815,7 @@ static void svg_ps_bars(void) {
         /* pass 2 - ps boxes */
         ps = ps_first;
         while ((ps = get_next_ps(ps))) {
-                char _cleanup_free_ *enc_name = NULL;
+                _cleanup_free_ char *enc_name = NULL;
 
                 double starttime;
                 int t;
@@ -978,12 +978,11 @@ static void svg_ps_bars(void) {
 
 static void svg_top_ten_cpu(void) {
         struct ps_struct *top[10];
-        struct ps_struct emptyps;
+        struct ps_struct emptyps = {};
         struct ps_struct *ps;
         int n, m;
 
-        memset(&emptyps, 0, sizeof(struct ps_struct));
-        for (n=0; n < 10; n++)
+        for (n = 0; n < (int) ELEMENTSOF(top); n++)
                 top[n] = &emptyps;
 
         /* walk all ps's and setup ptrs */
@@ -1011,12 +1010,11 @@ static void svg_top_ten_cpu(void) {
 
 static void svg_top_ten_pss(void) {
         struct ps_struct *top[10];
-        struct ps_struct emptyps;
+        struct ps_struct emptyps = {};
         struct ps_struct *ps;
         int n, m;
 
-        memset(&emptyps, 0, sizeof(struct ps_struct));
-        for (n=0; n < 10; n++)
+        for (n = 0; n < (int) ELEMENTSOF(top); n++)
                 top[n] = &emptyps;
 
         /* walk all ps's and setup ptrs */