Changeset a35b458 in mainline for uspace/lib/posix/src/stdlib.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/lib/posix/src/stdlib.c

    r3061bc1 ra35b458  
    165165                }
    166166        }
    167        
     167
    168168        return NULL;
    169169}
     
    225225                assert(resolved == NULL);
    226226        #endif
    227        
     227
    228228        if (name == NULL) {
    229229                errno = EINVAL;
    230230                return NULL;
    231231        }
    232        
     232
    233233        // TODO: symlink resolution
    234        
     234
    235235        /* Function absolutize is implemented in libc and declared in vfs.h.
    236236         * No more processing is required as HelenOS doesn't have symlinks
     
    239239         */
    240240        char* absolute = vfs_absolutize(name, NULL);
    241        
     241
    242242        if (absolute == NULL) {
    243243                /* POSIX requires some specific errnos to be set
     
    248248                return NULL;
    249249        }
    250        
     250
    251251        if (resolved == NULL) {
    252252                return absolute;
     
    309309{
    310310        int fd = -1;
    311        
     311
    312312        char *tptr = tmpl + strlen(tmpl) - 6;
    313        
     313
    314314        while (fd < 0) {
    315315                if (*mktemp(tmpl) == '\0') {
     
    317317                        return -1;
    318318                }
    319                
     319
    320320                fd = open(tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
    321                
     321
    322322                if (fd == -1) {
    323323                        /* Restore template to it's original state. */
     
    325325                }
    326326        }
    327        
     327
    328328        return fd;
    329329}
     
    345345                return tmpl;
    346346        }
    347        
     347
    348348        char *tptr = tmpl + tmpl_len - 6;
    349349        if (strcmp(tptr, "XXXXXX") != 0) {
     
    352352                return tmpl;
    353353        }
    354        
     354
    355355        static int seq = 0;
    356        
     356
    357357        for (; seq < 1000000; ++seq) {
    358358                snprintf(tptr, 7, "%06d", seq);
    359                
     359
    360360                int orig_errno = errno;
    361361                errno = 0;
     
    372372                }
    373373        }
    374        
     374
    375375        if (seq == 10000000) {
    376376                errno = EEXIST;
     
    378378                return tmpl;
    379379        }
    380        
     380
    381381        return tmpl;
    382382}
     
    392392{
    393393        assert(nelem > 0);
    394        
     394
    395395        size_t count;
    396396        load_t *loads = stats_get_load(&count);
    397        
     397
    398398        if (loads == NULL) {
    399399                return -1;
    400400        }
    401        
     401
    402402        if (((size_t) nelem) < count) {
    403403                count = nelem;
    404404        }
    405        
     405
    406406        for (size_t i = 0; i < count; ++i) {
    407407                loadavg[i] = (double) loads[i];
    408408        }
    409        
     409
    410410        free(loads);
    411411        return count;
Note: See TracChangeset for help on using the changeset viewer.