From 8cb31e18f69baddf3698d8e34b89c896b1988038 Mon Sep 17 00:00:00 2001 From: "Costa Tsaousis (ktsaou)" Date: Fri, 29 Apr 2016 04:27:22 +0300 Subject: [PATCH] commented mountinfo optional_fields code --- src/proc_self_mountinfo.c | 12 +++++++++--- src/proc_self_mountinfo.h | 4 +++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/proc_self_mountinfo.c b/src/proc_self_mountinfo.c index eb87d433..ee29e20a 100644 --- a/src/proc_self_mountinfo.c +++ b/src/proc_self_mountinfo.c @@ -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++; diff --git a/src/proc_self_mountinfo.h b/src/proc_self_mountinfo.h index 1e83a357..d1056095 100644 --- a/src/proc_self_mountinfo.h +++ b/src/proc_self_mountinfo.h @@ -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; -- 2.39.2