Changeset b7fd2a0 in mainline for uspace/srv/net/dnsrsrv/dns_msg.c


Ignore:
Timestamp:
2018-01-13T03:10:29Z (8 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/srv/net/dnsrsrv/dns_msg.c

    r36f0738 rb7fd2a0  
    5656 * fit in and append @a suff.
    5757 */
    58 static int dns_dstr_ext(char **dstr, const char *suff)
     58static errno_t dns_dstr_ext(char **dstr, const char *suff)
    5959{
    6060        size_t s1, s2;
     
    9393 * @param act_size      Place to store actual encoded size
    9494 */
    95 static int dns_name_encode(char *name, uint8_t *buf, size_t buf_size,
     95static errno_t dns_name_encode(char *name, uint8_t *buf, size_t buf_size,
    9696    size_t *act_size)
    9797{
     
    158158 * @param eoff  Place to store end offset (offset after last decoded byte)
    159159 */
    160 int dns_name_decode(dns_pdu_t *pdu, size_t boff, char **rname,
     160errno_t dns_name_decode(dns_pdu_t *pdu, size_t boff, char **rname,
    161161    size_t *eoff)
    162162{
     
    169169        char *name;
    170170        char dbuf[2];
    171         int rc;
     171        errno_t rc;
    172172        bool first;
    173173
     
    325325 * @param act_size      Place to store actual encoded size
    326326 */
    327 static int dns_question_encode(dns_question_t *question, uint8_t *buf,
     327static errno_t dns_question_encode(dns_question_t *question, uint8_t *buf,
    328328    size_t buf_size, size_t *act_size)
    329329{
    330330        size_t name_size;
    331331        size_t di;
    332         int rc;
     332        errno_t rc;
    333333
    334334        rc = dns_name_encode(question->qname, buf, buf_size, &name_size);
     
    358358 * @param eoff          Place to store end offset (offset after last decoded byte)
    359359 */
    360 static int dns_question_decode(dns_pdu_t *pdu, size_t boff,
     360static errno_t dns_question_decode(dns_pdu_t *pdu, size_t boff,
    361361    dns_question_t **rquestion, size_t *eoff)
    362362{
    363363        dns_question_t *question;
    364364        size_t name_eoff;
    365         int rc;
     365        errno_t rc;
    366366
    367367        question = calloc(1, sizeof (dns_question_t));
     
    398398 * @param eoff          Place to store end offset (offset after last decoded byte)
    399399 */
    400 static int dns_rr_decode(dns_pdu_t *pdu, size_t boff, dns_rr_t **retrr,
     400static errno_t dns_rr_decode(dns_pdu_t *pdu, size_t boff, dns_rr_t **retrr,
    401401    size_t *eoff)
    402402{
     
    406406        size_t bsz;
    407407        size_t rdlength;
    408         int rc;
     408        errno_t rc;
    409409
    410410        rr = calloc(1, sizeof(dns_rr_t));
     
    492492 *              ENOMEM if out of memory
    493493 */
    494 int dns_message_encode(dns_message_t *msg, void **rdata, size_t *rsize)
     494errno_t dns_message_encode(dns_message_t *msg, void **rdata, size_t *rsize)
    495495{
    496496        uint8_t *data;
     
    499499        size_t q_size = 0;
    500500        size_t di;
    501         int rc;
     501        errno_t rc;
    502502
    503503        hdr.id = host2uint16_t_be(msg->id);
     
    564564 *              ENOMEM if out of memory
    565565 */
    566 int dns_message_decode(void *data, size_t size, dns_message_t **rmsg)
     566errno_t dns_message_decode(void *data, size_t size, dns_message_t **rmsg)
    567567{
    568568        dns_message_t *msg;
     
    575575        size_t an_count;
    576576        size_t i;
    577         int rc;
     577        errno_t rc;
    578578
    579579        msg = dns_message_new();
Note: See TracChangeset for help on using the changeset viewer.