sds: new flb_sds_cmp() function
#include <fluent-bit/flb_info.h>
#include <stdlib.h>
+#include <string.h>
#include <inttypes.h>
#define FLB_SDS_HEADER_SIZE (sizeof(uint64_t) + sizeof(uint64_t))
@@ -60,10 +61,21 @@ static inline size_t flb_sds_avail(flb_sds_t s)
return (h->alloc - h->len);
}
+static inline int flb_sds_cmp(flb_sds_t s, char *str, int len)
+{
+ if (flb_sds_len(s) != len) {
+ return -1;
+ }
+
+ return strncmp(s, str, len);
+}
+
flb_sds_t flb_sds_create(char *str);
flb_sds_t flb_sds_create_len(char *str, int len);
flb_sds_t flb_sds_create_size(size_t size);
flb_sds_t flb_sds_cat(flb_sds_t s, char *str, int len);
+flb_sds_t flb_sds_increase(flb_sds_t s, size_t len);
+
int flb_sds_destroy(flb_sds_t s);
#endif
