Changeset 46577995 in mainline for uspace/app/edit/edit.c


Ignore:
Timestamp:
2018-01-04T20:50:52Z (8 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Children:
e211ea04
Parents:
facacc71
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-04 20:47:53)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-04 20:50:52)
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.

After this commit, HelenOS is free of code that mixes error codes with non-error
values on the assumption that error codes are negative.

File:
1 edited

Legend:

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

    rfacacc71 r46577995  
    132132static void pos_handle(pos_event_t *ev);
    133133
    134 static int file_save(char const *fname);
     134static errno_t file_save(char const *fname);
    135135static void file_save_as(void);
    136 static int file_insert(char *fname);
    137 static int file_save_range(char const *fname, spt_t const *spos,
     136static errno_t file_insert(char *fname);
     137static errno_t file_save_range(char const *fname, spt_t const *spos,
    138138    spt_t const *epos);
    139139static char *range_get_str(spt_t const *spos, spt_t const *epos);
     
    191191        cons_event_t ev;
    192192        bool new_file;
    193         int rc;
     193        errno_t rc;
    194194
    195195        con = console_init(stdin, stdout);
     
    578578
    579579/** Save the document. */
    580 static int file_save(char const *fname)
     580static errno_t file_save(char const *fname)
    581581{
    582582        spt_t sp, ep;
    583         int rc;
     583        errno_t rc;
    584584
    585585        status_display("Saving...");
     
    589589        rc = file_save_range(fname, &sp, &ep);
    590590
    591         switch (rc) {
    592         case EINVAL:
     591        switch ((case_errno_t) rc) {
     592        case (case_errno_t) EINVAL:
    593593                status_display("Error opening file!");
    594594                break;
    595         case EIO:
     595        case (case_errno_t) EIO:
    596596                status_display("Error writing data!");
    597597                break;
     
    616616        }
    617617
    618         int rc = file_save(fname);
     618        errno_t rc = file_save(fname);
    619619        if (rc != EOK)
    620620                return;
     
    697697 * of the caret.
    698698 */
    699 static int file_insert(char *fname)
     699static errno_t file_insert(char *fname)
    700700{
    701701        FILE *f;
     
    735735
    736736/** Save a range of text into a file. */
    737 static int file_save_range(char const *fname, spt_t const *spos,
     737static errno_t file_save_range(char const *fname, spt_t const *spos,
    738738    spt_t const *epos)
    739739{
     
    12831283
    12841284/* Search operations */
    1285 static int search_spt_producer(void *data, wchar_t *ret)
     1285static errno_t search_spt_producer(void *data, wchar_t *ret)
    12861286{
    12871287        assert(data != NULL);
     
    12921292}
    12931293
    1294 static int search_spt_reverse_producer(void *data, wchar_t *ret)
     1294static errno_t search_spt_reverse_producer(void *data, wchar_t *ret)
    12951295{
    12961296        assert(data != NULL);
     
    13011301}
    13021302
    1303 static int search_spt_mark(void *data, void **mark)
     1303static errno_t search_spt_mark(void *data, void **mark)
    13041304{
    13051305        assert(data != NULL);
     
    13971397       
    13981398        match_t match;
    1399         int rc = search_next_match(search, &match);
     1399        errno_t rc = search_next_match(search, &match);
    14001400        if (rc != EOK) {
    14011401                status_display("Failed searching.");
     
    15151515        size_t off;
    15161516        wchar_t c;
    1517         int rc;
     1517        errno_t rc;
    15181518
    15191519        rc = clipboard_get_str(&str);
Note: See TracChangeset for help on using the changeset viewer.