From f5bcda150445549b25afc7e56c68af78f93284aa Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Sat, 16 Sep 2017 16:13:06 +0200 Subject: [PATCH] sa_common.c: Simplify a bit read_stat_bunch() function Signed-off-by: Sebastien GODARD --- sa_common.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sa_common.c b/sa_common.c index 07bff87..82c0f41 100644 --- a/sa_common.c +++ b/sa_common.c @@ -1134,7 +1134,7 @@ void copy_structures(struct activity *act[], unsigned int id_seq[], void read_file_stat_bunch(struct activity *act[], int curr, int ifd, int act_nr, struct file_activity *file_actlst) { - int i, j, k, p; + int i, j, p; struct file_activity *fal = file_actlst; off_t offset; @@ -1152,16 +1152,16 @@ void read_file_stat_bunch(struct activity *act[], int curr, int ifd, int act_nr, perror("lseek"); exit(2); } + continue; } - else if ((act[p]->nr > 0) && + + if ((act[p]->nr > 0) && ((act[p]->nr > 1) || (act[p]->nr2 > 1)) && (act[p]->msize > act[p]->fsize)) { - for (j = 0; j < act[p]->nr; j++) { - for (k = 0; k < act[p]->nr2; k++) { - sa_fread(ifd, - (char *) act[p]->buf[curr] + (j * act[p]->nr2 + k) * act[p]->msize, - act[p]->fsize, HARD_SIZE); - } + + for (j = 0; j < (act[p]->nr * act[p]->nr2); j++) { + sa_fread(ifd, (char *) act[p]->buf[curr] + j * act[p]->msize, + act[p]->fsize, HARD_SIZE); } } else if (act[p]->nr > 0) { -- 2.40.0