Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Code cleanup and trivial fix

1) Keep 8-char-indent coding style
2) Remove unnecessary empty lines
3) Add missing header file

Signed-off-by: Jiaju Zhang <jjzhang@suse.de>
  • Loading branch information...
commit 1be2b6b2c594d8e833d1496b15a89c515b00acd0 1 parent a2bbdbd
Jiaju Zhang authored

Showing 1 changed file with 22 additions and 24 deletions. Show diff stats Hide diff stats

  1. +22 24 src/main.c
46 src/main.c
@@ -37,6 +37,7 @@
37 37 #include <error.h>
38 38 #include <sys/ioctl.h>
39 39 #include <termios.h>
  40 +#include <signal.h>
40 41 #include "log.h"
41 42 #include "booth.h"
42 43 #include "config.h"
@@ -334,7 +335,6 @@ void process_connection(int ci)
334 335 h.result = BOOTHC_RLT_OVERGRANT;
335 336 goto reply;
336 337 }
337   -
338 338 } else {
339 339 log_error("can not get ticket %s's info", ticket);
340 340 h.result = BOOTHC_RLT_INVALID_ARG;
@@ -575,29 +575,29 @@ static int do_list(void)
575 575
576 576 static inline void load_bar(int x, int n, int r, int w)
577 577 {
578   - int i;
579   - float ratio;
580   - int c;
  578 + int i;
  579 + float ratio;
  580 + int c;
581 581
582   - /* Only update r times.*/
583   - if ( x % (n / r) != 0 ) return;
584   -
585   - /* Calculuate the ratio of complete-to-incomplete.*/
586   - ratio = x / (float)n;
587   - c = ratio * w;
  582 + /* Only update r times.*/
  583 + if ( x % (n / r) != 0 ) return;
  584 +
  585 + /* Calculuate the ratio of complete-to-incomplete.*/
  586 + ratio = x / (float)n;
  587 + c = ratio * w;
588 588
589   - /* Show the percentage complete.*/
590   - printf("%3d%% [", (int)(ratio * 100) );
  589 + /* Show the percentage complete.*/
  590 + printf("%3d%% [", (int)(ratio * 100));
591 591
592   - /* Show the load bar.*/
593   - for (i = 0; i < c; i++)
594   - printf("=");
595   - for (i = c; i < w; i++)
596   - printf(" ");
597   -
598   - printf("]");
599   - printf("\r");
600   - fflush(stdout);
  592 + /* Show the load bar.*/
  593 + for (i = 0; i < c; i++)
  594 + printf("=");
  595 + for (i = c; i < w; i++)
  596 + printf(" ");
  597 +
  598 + printf("]");
  599 + printf("\r");
  600 + fflush(stdout);
601 601 }
602 602
603 603 static void counting_down(int total_time)
@@ -607,7 +607,7 @@ static void counting_down(int total_time)
607 607 int i;
608 608
609 609 ioctl(STDIN_FILENO, TIOCGWINSZ, (char*)&size);
610   - screen_width = size.ws_col/(float)2;
  610 + screen_width = size.ws_col / (float)2;
611 611
612 612 /* ignore signals */
613 613 signal(SIGTERM, SIG_IGN);
@@ -630,10 +630,8 @@ static int do_command(cmd_request_t cmd)
630 630 int buflen;
631 631 uint32_t force = 0;
632 632 int fd, rv;
633   -
634 633 int expire_time;
635 634 int i;
636   -
637 635
638 636 buflen = sizeof(struct boothc_header) +
639 637 sizeof(cl.site) + sizeof(cl.ticket);

0 comments on commit 1be2b6b

Please sign in to comment.
Something went wrong with that request. Please try again.