diff options
author | snermolaev <snermolaev@yandex-team.ru> | 2022-02-10 16:45:53 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:53 +0300 |
commit | 7353a3fdea9c67c256980c00a2b3b67f09b23a27 (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /contrib/libs/c-ares/ares_parse_txt_reply.c | |
parent | 2015790ac9fcc04caab83fccc23ab2460310a797 (diff) | |
download | ydb-7353a3fdea9c67c256980c00a2b3b67f09b23a27.tar.gz |
Restoring authorship annotation for <snermolaev@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/c-ares/ares_parse_txt_reply.c')
-rw-r--r-- | contrib/libs/c-ares/ares_parse_txt_reply.c | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/contrib/libs/c-ares/ares_parse_txt_reply.c b/contrib/libs/c-ares/ares_parse_txt_reply.c index 76ebbe19aa..c685dfd052 100644 --- a/contrib/libs/c-ares/ares_parse_txt_reply.c +++ b/contrib/libs/c-ares/ares_parse_txt_reply.c @@ -44,20 +44,20 @@ #include "ares_data.h" #include "ares_private.h" -static int -ares__parse_txt_reply (const unsigned char *abuf, int alen, - int ex, void **txt_out) +static int +ares__parse_txt_reply (const unsigned char *abuf, int alen, + int ex, void **txt_out) { size_t substr_len; unsigned int qdcount, ancount, i; const unsigned char *aptr; const unsigned char *strptr; - int status, rr_type, rr_class, rr_len, rr_ttl; + int status, rr_type, rr_class, rr_len, rr_ttl; long len; char *hostname = NULL, *rr_name = NULL; - struct ares_txt_ext *txt_head = NULL; - struct ares_txt_ext *txt_last = NULL; - struct ares_txt_ext *txt_curr; + struct ares_txt_ext *txt_head = NULL; + struct ares_txt_ext *txt_last = NULL; + struct ares_txt_ext *txt_curr; /* Set *txt_out to NULL for all failure cases. */ *txt_out = NULL; @@ -82,7 +82,7 @@ ares__parse_txt_reply (const unsigned char *abuf, int alen, if (aptr + len + QFIXEDSZ > abuf + alen) { - ares_free (hostname); + ares_free (hostname); return ARES_EBADRESP; } aptr += len + QFIXEDSZ; @@ -105,7 +105,7 @@ ares__parse_txt_reply (const unsigned char *abuf, int alen, rr_type = DNS_RR_TYPE (aptr); rr_class = DNS_RR_CLASS (aptr); rr_len = DNS_RR_LEN (aptr); - rr_ttl = DNS_RR_TTL (aptr); + rr_ttl = DNS_RR_TTL (aptr); aptr += RRFIXEDSZ; if (aptr + rr_len > abuf + alen) { @@ -135,8 +135,8 @@ ares__parse_txt_reply (const unsigned char *abuf, int alen, } /* Allocate storage for this TXT answer appending it to the list */ - txt_curr = ares_malloc_data(ex ? ARES_DATATYPE_TXT_EXT : - ARES_DATATYPE_TXT_REPLY); + txt_curr = ares_malloc_data(ex ? ARES_DATATYPE_TXT_EXT : + ARES_DATATYPE_TXT_REPLY); if (!txt_curr) { status = ARES_ENOMEM; @@ -152,35 +152,35 @@ ares__parse_txt_reply (const unsigned char *abuf, int alen, } txt_last = txt_curr; - if (ex) - txt_curr->record_start = (strptr == aptr); + if (ex) + txt_curr->record_start = (strptr == aptr); txt_curr->length = substr_len; - txt_curr->txt = ares_malloc (substr_len + 1/* Including null byte */); + txt_curr->txt = ares_malloc (substr_len + 1/* Including null byte */); if (txt_curr->txt == NULL) { status = ARES_ENOMEM; break; } - - ++strptr; + + ++strptr; memcpy ((char *) txt_curr->txt, strptr, substr_len); /* Make sure we NULL-terminate */ txt_curr->txt[substr_len] = 0; - txt_curr->ttl = rr_ttl; + txt_curr->ttl = rr_ttl; strptr += substr_len; } } - /* Propagate any failures */ - if (status != ARES_SUCCESS) - { - break; - } - + /* Propagate any failures */ + if (status != ARES_SUCCESS) + { + break; + } + /* Don't lose memory in the next iteration */ - ares_free (rr_name); + ares_free (rr_name); rr_name = NULL; /* Move on to the next record */ @@ -188,9 +188,9 @@ ares__parse_txt_reply (const unsigned char *abuf, int alen, } if (hostname) - ares_free (hostname); + ares_free (hostname); if (rr_name) - ares_free (rr_name); + ares_free (rr_name); /* clean up on error */ if (status != ARES_SUCCESS) @@ -205,18 +205,18 @@ ares__parse_txt_reply (const unsigned char *abuf, int alen, return ARES_SUCCESS; } - -int -ares_parse_txt_reply (const unsigned char *abuf, int alen, - struct ares_txt_reply **txt_out) -{ - return ares__parse_txt_reply(abuf, alen, 0, (void **) txt_out); -} - - -int -ares_parse_txt_reply_ext (const unsigned char *abuf, int alen, - struct ares_txt_ext **txt_out) -{ - return ares__parse_txt_reply(abuf, alen, 1, (void **) txt_out); -} + +int +ares_parse_txt_reply (const unsigned char *abuf, int alen, + struct ares_txt_reply **txt_out) +{ + return ares__parse_txt_reply(abuf, alen, 0, (void **) txt_out); +} + + +int +ares_parse_txt_reply_ext (const unsigned char *abuf, int alen, + struct ares_txt_ext **txt_out) +{ + return ares__parse_txt_reply(abuf, alen, 1, (void **) txt_out); +} |