Changeset a35b458 in mainline for uspace/app/bdsh/cmds/modules/ls/ls.c


Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/modules/ls/ls.c

    r3061bc1 ra35b458  
    111111        struct dir_elem_t const *da = a;
    112112        struct dir_elem_t const *db = b;
    113        
     113
    114114        if ((da->s.is_directory && db->s.is_file) ||
    115115            ((da->s.is_directory == db->s.is_directory) &&
     
    141141        struct dir_elem_t *tosort;
    142142        struct dirent *dp;
    143        
     143
    144144        if (!dirp)
    145145                return -1;
     
    150150                return -1;
    151151        }
    152        
     152
    153153        tosort = (struct dir_elem_t *) malloc(alloc_blocks * sizeof(*tosort));
    154154        if (!tosort) {
     
    157157                return -1;
    158158        }
    159        
     159
    160160        while ((dp = readdir(dirp))) {
    161161                if (nbdirs + 1 > alloc_blocks) {
    162162                        alloc_blocks += alloc_blocks;
    163                        
     163
    164164                        tmp = (struct dir_elem_t *) realloc(tosort,
    165165                            alloc_blocks * sizeof(struct dir_elem_t));
     
    170170                        tosort = tmp;
    171171                }
    172                
     172
    173173                /* fill the name field */
    174174                tosort[nbdirs].name = (char *) malloc(str_size(dp->d_name) + 1);
     
    189189                }
    190190        }
    191        
     191
    192192        if (ls.sort)
    193193                qsort(&tosort[0], nbdirs, sizeof(struct dir_elem_t), ls_cmp);
    194        
     194
    195195        for (i = 0; i < nbdirs; i++)
    196196                ls_print(&tosort[i]);
     
    214214                }
    215215        }
    216        
     216
    217217out:
    218218        for(i = 0; i < nbdirs; i++)
     
    239239        DIR *subdirp;
    240240        struct dir_elem_t *dir_list;
    241        
     241
    242242        const char * const trailing_slash = "/";
    243243
     
    294294                }
    295295        }
    296    
     296
    297297        ret = CMD_SUCCESS;
    298298
     
    355355
    356356        argc = cli_count_args(argv);
    357        
     357
    358358        for (c = 0, optreset = 1, optind = 0, opt_ind = 0; c != -1;) {
    359359                c = getopt_long(argc, argv, "hur", long_options, &opt_ind);
Note: See TracChangeset for help on using the changeset viewer.