Changeset d76a329 in mainline


Ignore:
Timestamp:
2012-04-16T20:08:30Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b1213b0
Parents:
f76696f
Message:

Fix cstyle.

Location:
uspace/app/top
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/top/screen.c

    rf76696f rd76a329  
    400400
    401401                switch (field->type) {
    402                         case FIELD_EMPTY:
    403                                 printf("%*s", width, "");
    404                                 break;
    405                         case FIELD_UINT:
    406                                 printf("%*" PRIu64, width, field->uint);
    407                                 break;
    408                         case FIELD_UINT_SUFFIX_BIN: {
    409                                 uint64_t val = field->uint;
    410                                 const char *suffix;
    411                                 width -= 3;
    412                                 bin_order_suffix(val, &val, &suffix, true);
    413                                 printf("%*" PRIu64 "%s", width, val, suffix);
    414                                 break;
    415                                 }
    416                         case FIELD_UINT_SUFFIX_DEC: {
    417                                 uint64_t val = field->uint;
    418                                 char suffix;
    419                                 width -= 1;
    420                                 order_suffix(val, &val, &suffix);
    421                                 printf("%*" PRIu64 "%c", width, val, suffix);
    422                                 break;
    423                                 }
    424                         case FIELD_PERCENT:
    425                                 width -= 5; /* nnn.% */
    426                                 if (width > 2) {
    427                                         printf("%*s", width - 2, "");
    428                                         width = 2;
    429                                 }
    430                                 print_percent(field->fixed, width);
    431                                 break;
    432                         case FIELD_STRING:
    433                                 printf("%-*.*s", width, width, field->string);
    434                                 break;
     402                case FIELD_EMPTY:
     403                        printf("%*s", width, "");
     404                        break;
     405                case FIELD_UINT:
     406                        printf("%*" PRIu64, width, field->uint);
     407                        break;
     408                case FIELD_UINT_SUFFIX_BIN: {
     409                        uint64_t val = field->uint;
     410                        const char *suffix;
     411                        width -= 3;
     412                        bin_order_suffix(val, &val, &suffix, true);
     413                        printf("%*" PRIu64 "%s", width, val, suffix);
     414                        break;
     415                }
     416                case FIELD_UINT_SUFFIX_DEC: {
     417                        uint64_t val = field->uint;
     418                        char suffix;
     419                        width -= 1;
     420                        order_suffix(val, &val, &suffix);
     421                        printf("%*" PRIu64 "%c", width, val, suffix);
     422                        break;
     423                }
     424                case FIELD_PERCENT:
     425                        width -= 5; /* nnn.% */
     426                        if (width > 2) {
     427                                printf("%*s", width - 2, "");
     428                                width = 2;
     429                        }
     430                        print_percent(field->fixed, width);
     431                        break;
     432                case FIELD_STRING:
     433                        printf("%-*.*s", width, width, field->string);
     434                        break;
    435435                }
    436436
  • uspace/app/top/top.c

    rf76696f rd76a329  
    371371
    372372        switch (fa->type) {
    373                 case FIELD_EMPTY:
    374                         return 0;
    375                 case FIELD_UINT_SUFFIX_BIN: /* fallthrough */
    376                 case FIELD_UINT_SUFFIX_DEC: /* fallthrough */
    377                 case FIELD_UINT:
    378                         if (fa->uint > fb->uint)
    379                                 return 1 * sort_reverse;
    380                         if (fa->uint < fb->uint)
    381                                 return -1 * sort_reverse;
    382                         return 0;
    383                 case FIELD_PERCENT:
    384                         if (fa->fixed.upper * fb->fixed.lower
    385                             > fb->fixed.upper * fa->fixed.lower)
    386                                 return 1 * sort_reverse;
    387                         if (fa->fixed.upper * fb->fixed.lower
    388                             < fb->fixed.upper * fa->fixed.lower)
    389                                 return -1 * sort_reverse;
    390                         return 0;
    391                 case FIELD_STRING:
    392                         return str_cmp(fa->string, fb->string) * sort_reverse;
     373        case FIELD_EMPTY:
     374                return 0;
     375        case FIELD_UINT_SUFFIX_BIN: /* fallthrough */
     376        case FIELD_UINT_SUFFIX_DEC: /* fallthrough */
     377        case FIELD_UINT:
     378                if (fa->uint > fb->uint)
     379                        return 1 * sort_reverse;
     380                if (fa->uint < fb->uint)
     381                        return -1 * sort_reverse;
     382                return 0;
     383        case FIELD_PERCENT:
     384                if (fa->fixed.upper * fb->fixed.lower
     385                    > fb->fixed.upper * fa->fixed.lower)
     386                        return 1 * sort_reverse;
     387                if (fa->fixed.upper * fb->fixed.lower
     388                    < fb->fixed.upper * fa->fixed.lower)
     389                        return -1 * sort_reverse;
     390                return 0;
     391        case FIELD_STRING:
     392                return str_cmp(fa->string, fb->string) * sort_reverse;
    393393        }
    394394
     
    521521
    522522        switch (op_mode) {
    523                 case OP_TASKS:
    524                         return fill_task_table(data);
    525                 case OP_IPC:
    526                         return fill_ipc_table(data);
    527                 case OP_EXCS:
    528                         return fill_exception_table(data);
     523        case OP_TASKS:
     524                return fill_task_table(data);
     525        case OP_IPC:
     526                return fill_ipc_table(data);
     527        case OP_EXCS:
     528                return fill_exception_table(data);
    529529        }
    530530        return NULL;
     
    627627
    628628                switch (c) {
    629                         case -1: /* do nothing */
     629                case -1: /* do nothing */
     630                        break;
     631                case 't':
     632                        op_mode = OP_TASKS;
     633                        break;
     634                case 'i':
     635                        op_mode = OP_IPC;
     636                        break;
     637                case 'e':
     638                        op_mode = OP_EXCS;
     639                        break;
     640                case 's':
     641                        screen_mode = SCREEN_SORT;
     642                        break;
     643                case 'r':
     644                        sort_reverse = -sort_reverse;
     645                        break;
     646                case 'h':
     647                case '?':
     648                        screen_mode = SCREEN_HELP;
     649                        break;
     650                case 'q':
     651                        goto out;
     652                case 'a':
     653                        if (op_mode == OP_EXCS) {
     654                                excs_all = !excs_all;
     655                                if (excs_all)
     656                                        show_warning("Showing all exceptions");
     657                                else
     658                                        show_warning("Showing only hot exceptions");
    630659                                break;
    631                         case 't':
    632                                 op_mode = OP_TASKS;
    633                                 break;
    634                         case 'i':
    635                                 op_mode = OP_IPC;
    636                                 break;
    637                         case 'e':
    638                                 op_mode = OP_EXCS;
    639                                 break;
    640                         case 's':
    641                                 screen_mode = SCREEN_SORT;
    642                                 break;
    643                         case 'r':
    644                                 sort_reverse = -sort_reverse;
    645                                 break;
    646                         case 'h':
    647                         case '?':
    648                                 screen_mode = SCREEN_HELP;
    649                                 break;
    650                         case 'q':
    651                                 goto out;
    652                         case 'a':
    653                                 if (op_mode == OP_EXCS) {
    654                                         excs_all = !excs_all;
    655                                         if (excs_all)
    656                                                 show_warning("Showing all exceptions");
    657                                         else
    658                                                 show_warning("Showing only hot exceptions");
    659                                         break;
    660                                 }
    661                                 /* fallthrough */
    662                         default:
    663                                 show_warning("Unknown command \"%c\", use \"h\" for help", c);
    664                                 continue; /* don't redraw */
     660                        }
     661                        /* fallthrough */
     662                default:
     663                        show_warning("Unknown command \"%c\", use \"h\" for help", c);
     664                        continue; /* don't redraw */
    665665                }
    666666
Note: See TracChangeset for help on using the changeset viewer.