aboutsummaryrefslogtreecommitdiffstats
path: root/reftable/basics.h
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-10-17 06:53:56 +0200
committerTaylor Blau <me@ttaylorr.com>2024-10-17 16:59:56 -0400
commitbe4c070a3c9e7c9d6836c724929ff8a365361e1a (patch)
tree03cec9016c899456a020c06e98239963a2958238 /reftable/basics.h
parent81eddda540eae43ef481b629d7f4d8023ea40c57 (diff)
downloadgit-be4c070a3c9e7c9d6836c724929ff8a365361e1a.tar.gz
reftable: convert from `strbuf` to `reftable_buf`
Convert the reftable library to use the `reftable_buf` interface instead of the `strbuf` interface. This is mostly a mechanical change via sed(1) with some manual fixes where functions for `strbuf` and `reftable_buf` differ. The converted code does not yet handle allocation failures. This will be handled in subsequent commits. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 'reftable/basics.h')
-rw-r--r--reftable/basics.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/reftable/basics.h b/reftable/basics.h
index bd33c34dea..7aa46d7c30 100644
--- a/reftable/basics.h
+++ b/reftable/basics.h
@@ -57,7 +57,9 @@ int reftable_buf_setlen(struct reftable_buf *buf, size_t len);
int reftable_buf_cmp(const struct reftable_buf *a, const struct reftable_buf *b);
/*
- * Add the given bytes to the buffer. Returns 0 on success,
+ * Append `len` bytes from `data` to the buffer. This function works with
+ * arbitrary byte sequences, including ones that contain embedded NUL
+ * characters. As such, we use `void *` as input type. Returns 0 on success,
* REFTABLE_OUT_OF_MEMORY_ERROR on allocation failure.
*/
int reftable_buf_add(struct reftable_buf *buf, const void *data, size_t len);
@@ -144,8 +146,7 @@ char *reftable_strdup(const char *str);
#endif
/* Find the longest shared prefix size of `a` and `b` */
-struct strbuf;
-int common_prefix_size(struct strbuf *a, struct strbuf *b);
+int common_prefix_size(struct reftable_buf *a, struct reftable_buf *b);
int hash_size(uint32_t id);