aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/c-ares/src/lib/include
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2024-12-16 00:09:49 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2024-12-16 00:36:07 +0300
commitd61a51d665801f854d4f2d85ea7c9f0edb6f1608 (patch)
tree032098529c4b4b8fdfbf5389aa9e6affbaf75638 /contrib/libs/c-ares/src/lib/include
parent0f6fa8ccc1193ad9320c894c564e4915f48501e2 (diff)
downloadydb-d61a51d665801f854d4f2d85ea7c9f0edb6f1608.tar.gz
Update contrib/libs/c-ares to 1.34.4
commit_hash:0ba9edead9220ea805233d858e42e63ba30c021f
Diffstat (limited to 'contrib/libs/c-ares/src/lib/include')
-rw-r--r--contrib/libs/c-ares/src/lib/include/ares_buf.h20
-rw-r--r--contrib/libs/c-ares/src/lib/include/ares_str.h14
2 files changed, 34 insertions, 0 deletions
diff --git a/contrib/libs/c-ares/src/lib/include/ares_buf.h b/contrib/libs/c-ares/src/lib/include/ares_buf.h
index 7836a313e0..10d29eaf83 100644
--- a/contrib/libs/c-ares/src/lib/include/ares_buf.h
+++ b/contrib/libs/c-ares/src/lib/include/ares_buf.h
@@ -219,6 +219,26 @@ CARES_EXTERN unsigned char *ares_buf_finish_bin(ares_buf_t *buf, size_t *len);
*/
CARES_EXTERN char *ares_buf_finish_str(ares_buf_t *buf, size_t *len);
+/*! Replace the given search byte sequence with the replacement byte sequence.
+ * This is only valid for allocated buffers, not const buffers. Will replace
+ * all byte sequences starting at the current offset to the end of the buffer.
+ *
+ * \param[in] buf Initialized buffer object. Can not be a "const" buffer.
+ * \param[in] srch Search byte sequence, must not be NULL.
+ * \param[in] srch_size Size of byte sequence, must not be zero.
+ * \param[in] rplc Byte sequence to use as replacement. May be NULL if
+ * rplc_size is zero.
+ * \param[in] rplc_size Size of replacement byte sequence, may be 0.
+ * \return ARES_SUCCESS on success, otherwise on may return failure only on
+ * memory allocation failure or misuse. Will not return indication
+ * if any replacements occurred
+ */
+CARES_EXTERN ares_status_t ares_buf_replace(ares_buf_t *buf,
+ const unsigned char *srch,
+ size_t srch_size,
+ const unsigned char *rplc,
+ size_t rplc_size);
+
/*! Tag a position to save in the buffer in case parsing needs to rollback,
* such as if insufficient data is available, but more data may be added in
* the future. Only a single tag can be set per buffer object. Setting a
diff --git a/contrib/libs/c-ares/src/lib/include/ares_str.h b/contrib/libs/c-ares/src/lib/include/ares_str.h
index ea75b3b3e7..4ee339510b 100644
--- a/contrib/libs/c-ares/src/lib/include/ares_str.h
+++ b/contrib/libs/c-ares/src/lib/include/ares_str.h
@@ -29,6 +29,20 @@
CARES_EXTERN char *ares_strdup(const char *s1);
+/*! Scan up to maxlen bytes for the first NULL character and return
+ * its index, or maxlen if not found. The function only returns
+ * maxlen if the first maxlen bytes were not NULL characters; it
+ * makes no guarantee for what \c str[maxlen] (if defined) is, and
+ * does not access it. It is behaving like the POSIX \c strnlen()
+ * function, except that it returns 0 if the \p str pointer is \c
+ * NULL.
+ *
+ * \param[in] str The string to scan for the NULL character
+ * \param[in] maxlen The maximum number of bytes to scan
+ * \return Index of first NULL byte. Between 0 and maxlen (inclusive).
+ */
+CARES_EXTERN size_t ares_strnlen(const char *str, size_t maxlen);
+
CARES_EXTERN size_t ares_strlen(const char *str);
/*! Copy string from source to destination with destination buffer size