Changeset 84a1a54 in mainline for uspace/srv/hid


Ignore:
Timestamp:
2018-01-04T20:47:53Z (8 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Children:
facacc71
Parents:
cde999a
Message:

Wrap returns of errno from main() with EXIT_RC().

Returns of error code from main() prevent type checking when errno_t
and int are considered incompatible. In order to avoid the philosophical
discussion of what should and shouldn't be returned for main(), we simply
wrap the error values and leave the answer to the question for future
generations to decide.

Location:
uspace/srv/hid
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/compositor/compositor.c

    rcde999a r84a1a54  
    22542254        if (rc != EOK) {
    22552255                printf("%s: Unable to register server (%s)\n", NAME, str_error(rc));
    2256                 return -1;
     2256                return rc;
    22572257        }
    22582258       
     
    22722272        char winreg[LOC_NAME_MAXLEN + 1];
    22732273        snprintf(winreg, LOC_NAME_MAXLEN, "%s%s/winreg", NAMESPACE, server_name);
    2274         if (loc_service_register(winreg, &winreg_id) != EOK) {
     2274        rc = loc_service_register(winreg, &winreg_id);
     2275        if (rc != EOK) {
    22752276                printf("%s: Unable to register service %s\n", NAME, winreg);
    2276                 return -1;
     2277                return rc;
    22772278        }
    22782279       
     
    23152316        int rc = compositor_srv_init(argv[1], argv[2]);
    23162317        if (rc != EOK)
    2317                 return rc;
     2318                return EXIT_RC(rc);
    23182319       
    23192320        printf("%s: Accepting connections\n", NAME);
  • uspace/srv/hid/input/input.c

    rcde999a r84a1a54  
    869869        if (rc != EOK) {
    870870                printf("%s: Unable to register server\n", NAME);
    871                 return rc;
     871                return EXIT_RC(rc);
    872872        }
    873873       
     
    876876        if (rc != EOK) {
    877877                printf("%s: Unable to register service %s\n", NAME, argv[1]);
    878                 return rc;
     878                return EXIT_RC(rc);
    879879        }
    880880       
  • uspace/srv/hid/isdv4_tablet/main.c

    rcde999a r84a1a54  
    315315        if (rc != EOK) {
    316316                printf("%s: Unable to register driver.\n", NAME);
    317                 return rc;
     317                return EXIT_RC(rc);
    318318        }
    319319
    320320        service_id_t service_id;
    321321        char *service_name;
    322         rc = asprintf(&service_name, "mouse/isdv4-%" PRIun, svc_id);
    323         if (rc < 0) {
     322        if (asprintf(&service_name, "mouse/isdv4-%" PRIun, svc_id) < 0) {
    324323                printf(NAME ": Unable to create service name\n");
    325                 return rc;
     324                return EXIT_RC(ENOMEM);
    326325        }
    327326
     
    329328        if (rc != EOK) {
    330329                printf(NAME ": Unable to register service %s.\n", service_name);
    331                 return rc;
     330                return EXIT_RC(rc);
    332331        }
    333332
  • uspace/srv/hid/output/output.c

    rcde999a r84a1a54  
    470470        if (rc != EOK) {
    471471                printf("%s: Unable to register driver\n", NAME);
    472                 return rc;
     472                return EXIT_RC(rc);
    473473        }
    474474       
     
    477477        if (rc != EOK) {
    478478                printf("%s: Unable to register service %s\n", NAME, argv[1]);
    479                 return rc;
     479                return EXIT_RC(rc);
    480480        }
    481481       
  • uspace/srv/hid/remcons/remcons.c

    rcde999a r84a1a54  
    353353        if (rc != EOK) {
    354354                fprintf(stderr, "%s: Unable to register server\n", NAME);
    355                 return rc;
     355                return EXIT_RC(rc);
    356356        }
    357357
     
    359359        if (rc != EOK) {
    360360                fprintf(stderr, "%s: Error initializing TCP.\n", NAME);
    361                 return rc;
     361                return EXIT_RC(rc);
    362362        }
    363363
     
    369369        if (rc != EOK) {
    370370                fprintf(stderr, "%s: Error creating listener.\n", NAME);
    371                 return rc;
     371                return EXIT_RC(rc);
    372372        }
    373373
  • uspace/srv/hid/rfb/main.c

    rcde999a r84a1a54  
    220220        if (rc != EOK) {
    221221                printf("%s: Unable to register server.\n", NAME);
    222                 return rc;
     222                return EXIT_RC(rc);
    223223        }
    224224
    225225        char *service_name;
    226         rc = asprintf(&service_name, "rfb/%s", rfb_name);
    227         if (rc < 0) {
     226        if (asprintf(&service_name, "rfb/%s", rfb_name) < 0) {
    228227                printf(NAME ": Unable to create service name\n");
    229                 return rc;
     228                return EXIT_RC(ENOMEM);
    230229        }
    231230
     
    235234        if (rc != EOK) {
    236235                printf(NAME ": Unable to register service %s.\n", service_name);
    237                 return rc;
     236                return EXIT_RC(rc);
    238237        }
    239238       
  • uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.c

    rcde999a r84a1a54  
    8888        if (rc != EOK) {
    8989                printf("%s: Unable to register driver.\n", NAME);
    90                 return rc;
     90                return EXIT_RC(rc);
    9191        }
    9292
     
    9595                return -1;
    9696
    97         if (s3c24xx_ts_init(ts) != EOK)
     97        if (s3c24xx_ts_init(ts) != 0)
    9898                return -1;
    9999
     
    141141        s3c24xx_ts_wait_for_int_mode(ts, updn_down);
    142142
    143         return EOK;
     143        return 0;
    144144}
    145145
Note: See TracChangeset for help on using the changeset viewer.