Changeset b7fd2a0 in mainline for uspace/app/date/date.c


Ignore:
Timestamp:
2018-01-13T03:10:29Z (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:
a53ed3a
Parents:
36f0738
Message:

Use errno_t in all uspace and kernel code.

Change type of every variable, parameter and return value that holds an
<errno.h> constant to either errno_t (the usual case), or sys_errno_t
(some places in kernel). This is for the purpose of self-documentation,
as well as for type-checking with a bit of type definition hackery.

Although this is a massive commit, it is a simple text replacement, and thus
is very easy to verify. Simply do the following:

`
git checkout <this commit's hash>
git reset HEAD
git add .
tools/srepl '\berrno_t\b' int
git add .
tools/srepl '\bsys_errno_t\b' sysarg_t
git reset
git diff
`

While this doesn't ensure that the replacements are correct, it does ensure
that the commit doesn't do anything except those replacements. Since errno_t
is typedef'd to int in the usual case (and sys_errno_t to sysarg_t), even if
incorrect, this commit cannot change behavior.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/date/date.c

    r36f0738 rb7fd2a0  
    3939#define NAME   "date"
    4040
    41 static int read_date_from_arg(char *wdate, struct tm *t);
    42 static int read_time_from_arg(char *wdate, struct tm *t);
    43 static int tm_sanity_check(struct tm *t);
     41static errno_t read_date_from_arg(char *wdate, struct tm *t);
     42static errno_t read_time_from_arg(char *wdate, struct tm *t);
     43static errno_t tm_sanity_check(struct tm *t);
    4444static bool is_leap_year(int year);
    4545
     
    5151main(int argc, char **argv)
    5252{
    53         int rc;
     53        errno_t rc;
    5454        int c;
    5555        category_id_t cat_id;
     
    197197 *  with the following format: DD/MM/YYYY
    198198 */
    199 static int
     199static errno_t
    200200read_date_from_arg(char *wdate, struct tm *t)
    201201{
    202         int rc;
     202        errno_t rc;
    203203        uint32_t tmp;
    204204
     
    232232 *  with the following format: HH:MM:SS or HH:MM
    233233 */
    234 static int
     234static errno_t
    235235read_time_from_arg(char *wtime, struct tm *t)
    236236{
    237         int rc;
     237        errno_t rc;
    238238        size_t len = str_size(wtime);
    239239        bool sec_present = len == 8;
     
    278278 * @return      EOK on success or EINVAL
    279279 */
    280 static int
     280static errno_t
    281281tm_sanity_check(struct tm *t)
    282282{
Note: See TracChangeset for help on using the changeset viewer.