Beautifies the code.

This commit is contained in:
Andrea Mazzoleni 2014-09-27 00:32:39 +02:00
parent 0583799ad0
commit 876bddcf4c
30 changed files with 649 additions and 630 deletions

View file

@ -40,7 +40,7 @@ void state_list(struct snapraid_state* state)
printf("Listing...\n");
/* for each disk */
for(i=state->disklist;i!=0;i=i->next) {
for (i = state->disklist; i != 0; i = i->next) {
tommy_node* j;
struct snapraid_disk* disk = i->data;
@ -48,7 +48,7 @@ void state_list(struct snapraid_state* state)
tommy_list_sort(&disk->filelist, file_path_compare);
/* for each file */
for(j=disk->filelist;j!=0;j=j->next) {
for (j = disk->filelist; j != 0; j = j->next) {
struct snapraid_file* file = j->data;
#if HAVE_LOCALTIME_R
struct tm tm_res;
@ -59,7 +59,7 @@ void state_list(struct snapraid_state* state)
++file_count;
file_size += file->size;
fprintf(stdlog, "file:%s:%s:%"PRIu64":%"PRIi64":%u:%"PRIi64"\n", disk->name, file->sub, file->size, file->mtime_sec, file->mtime_nsec, file->inode);
fprintf(stdlog, "file:%s:%s:%" PRIu64 ":%" PRIi64 ":%u:%" PRIi64 "\n", disk->name, file->sub, file->size, file->mtime_sec, file->mtime_nsec, file->inode);
t = file->mtime_sec;
#if HAVE_LOCALTIME_R
@ -68,7 +68,7 @@ void state_list(struct snapraid_state* state)
tm = localtime(&t);
#endif
printf("%12"PRIu64" ", file->size);
printf("%12" PRIu64 " ", file->size);
if (tm) {
printf("%04u/%02u/%02u %02u:%02u", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min);
if (state->opt.verbose) {
@ -83,7 +83,7 @@ void state_list(struct snapraid_state* state)
tommy_list_sort(&disk->linklist, link_alpha_compare);
/* for each link */
for(j=disk->linklist;j!=0;j=j->next) {
for (j = disk->linklist; j != 0; j = j->next) {
struct snapraid_link* link = j->data;
const char* type;
@ -93,8 +93,8 @@ void state_list(struct snapraid_state* state)
case FILE_IS_SYMDIR : type = "symdir"; break;
case FILE_IS_JUNCTION : type = "junction"; break;
/* LCOV_EXCL_START */
default: type = "unknown"; break;
/* LCOV_EXCL_STOP */
default : type = "unknown"; break;
/* LCOV_EXCL_STOP */
}
++link_count;
@ -110,11 +110,11 @@ void state_list(struct snapraid_state* state)
}
}
printf("\n");
printf("%8u files, for %"PRIu64" GiB\n", file_count, file_size / (1024*1024*1024));
printf("%8u files, for %" PRIu64 " GiB\n", file_count, file_size / (1024 * 1024 * 1024));
printf("%8u links\n", link_count);
fprintf(stdlog, "summary:file_count:%u\n", file_count);
fprintf(stdlog, "summary:file_size:%"PRIu64"\n", file_size);
fprintf(stdlog, "summary:file_size:%" PRIu64 "\n", file_size);
fprintf(stdlog, "summary:link_count:%u\n", link_count);
fprintf(stdlog, "summary:exit:ok\n");
fflush(stdlog);