]> arthur.barton.de Git - netdata.git/commitdiff
commented mountinfo optional_fields code
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Fri, 29 Apr 2016 01:27:22 +0000 (04:27 +0300)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Fri, 29 Apr 2016 01:27:22 +0000 (04:27 +0300)
src/proc_self_mountinfo.c
src/proc_self_mountinfo.h

index eb87d433224f143aba4e27b950f1c66b2503b159..ee29e20a26c9ee08bc272d2b3d90cf127f41d9e1 100644 (file)
@@ -48,16 +48,18 @@ void mountinfo_free(struct mountinfo *mi) {
        if(likely(mi->next))
                mountinfo_free(mi->next);
 
-       free(mi->root);
-       free(mi->mount_point);
-       free(mi->mount_options);
+       if(mi->root) free(mi->root);
+       if(mi->mount_point) free(mi->mount_point);
+       if(mi->mount_options) free(mi->mount_options);
 
+/*
        if(mi->optional_fields_count) {
                int i;
                for(i = 0; i < mi->optional_fields_count ; i++)
                        free(mi->optional_fields[i]);
        }
        free(mi->optional_fields);
+*/
 
        free(mi->filesystem);
        free(mi->mount_source);
@@ -123,7 +125,9 @@ struct mountinfo *mountinfo_read() {
                if(unlikely(!mi->mount_options)) fatal("Cannot allocate memory");
 
                // count the optional fields
+/*
                unsigned long wo = w;
+*/
                mi->optional_fields_count = 0;
                char *s = procfile_lineword(ff, l, w);
                while(*s && *s != '-') {
@@ -132,6 +136,7 @@ struct mountinfo *mountinfo_read() {
                        mi->optional_fields_count++;
                }
 
+/*
                if(unlikely(mi->optional_fields_count)) {
                        // we have some optional fields
                        // read them into a new array of pointers;
@@ -149,6 +154,7 @@ struct mountinfo *mountinfo_read() {
                }
                else
                        mi->optional_fields = NULL;
+*/
 
                if(likely(*s == '-')) {
                        w++;
index 1e83a357ee1b27cbecb689d58880e1ab6fc9e05d..d1056095ace365d111572de003e46f6c63f2711e 100644 (file)
@@ -18,7 +18,9 @@ struct mountinfo {
        char *mount_options;    // mount options: per-mount options.
 
        int optional_fields_count;
-       char **optional_fields; // optional fields: zero or more fields of the form "tag[:value]".
+/*
+       char *(*optional_fields); // optional fields: zero or more fields of the form "tag[:value]".
+*/
 
        char *filesystem;       // filesystem type: name of filesystem in the form "type[.subtype]".
        uint32_t filesystem_hash;