summaryrefslogtreecommitdiffstats
path: root/str.c
diff options
context:
space:
mode:
Diffstat (limited to 'str.c')
-rw-r--r--str.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/str.c b/str.c
index 684f73a..53d02e9 100644
--- a/str.c
+++ b/str.c
@@ -24,8 +24,10 @@
* Review all the REQUIRE() macros.
*/
+#include <isc/buffer.h>
#include <isc/mem.h>
#include <isc/mutex.h>
+#include <isc/region.h>
#include <isc/util.h>
#include <dns/result.h>
@@ -342,6 +344,30 @@ cleanup:
return result;
}
+isc_result_t
+str_cat_isc_region(ld_string_t *dest, const isc_region_t *region)
+{
+ REQUIRE(dest != NULL);
+ REQUIRE(region != NULL);
+
+ return str_cat_char_len(dest, (char *)region->base, region->length);
+}
+
+isc_result_t
+str_cat_isc_buffer(ld_string_t *dest, const isc_buffer_t *buffer)
+{
+ isc_region_t region;
+ isc_buffer_t *deconst_buffer;
+
+ REQUIRE(dest != NULL);
+ REQUIRE(ISC_BUFFER_VALID(buffer));
+
+ DE_CONST(buffer, deconst_buffer);
+ isc_buffer_usedregion(deconst_buffer, &region);
+
+ return str_cat_isc_region(dest, &region);
+}
+
/*
* Concatenate string src to string dest.
*/
@@ -412,6 +438,20 @@ str_toupper(ld_string_t *str)
*ptr = toupper((unsigned char)*ptr);
}
+void
+str_to_isc_buffer(const ld_string_t *src, isc_buffer_t *dest)
+{
+ size_t len;
+
+ REQUIRE(src != NULL);
+ REQUIRE(dest != NULL);
+
+ len = str_len_internal(src) - 1;
+
+ isc_buffer_init(dest, src->data, len);
+ isc_buffer_add(dest, len);
+}
+
int
str_casecmp_char(const ld_string_t *s1, const char *s2)
{