};
struct index_mm_node {
- struct index_mm *idx;
+ const struct index_mm *idx;
const char *prefix; /* mmap'ed value */
unsigned char first;
unsigned char last;
}
/* reads node into given node struct and returns its address on success or NULL on error. */
-static struct index_mm_node *index_mm_read_node(struct index_mm *idx, uint32_t offset,
+static struct index_mm_node *index_mm_read_node(const struct index_mm *idx,
+ uint32_t offset,
struct index_mm_node *node)
{
const void *p;
free(idx);
}
-static struct index_mm_node *index_mm_readroot(struct index_mm *idx,
+static struct index_mm_node *index_mm_readroot(const struct index_mm *idx,
struct index_mm_node *root)
{
return index_mm_read_node(idx, idx->root_offset, root);
strbuf_popchars(buf, pushed);
}
-void index_mm_dump(struct index_mm *idx, int fd, bool alias_prefix)
+void index_mm_dump(const struct index_mm *idx, int fd, bool alias_prefix)
{
struct index_mm_node nbuf, *root;
struct strbuf buf;
*
* Returns the value of the first match
*/
-char *index_mm_search(struct index_mm *idx, const char *key)
+char *index_mm_search(const struct index_mm *idx, const char *key)
{
// FIXME: return value by reference instead of strdup
struct index_mm_node nbuf, *root;
*
* Returns a list of all the values of matching keys.
*/
-struct index_value *index_mm_searchwild(struct index_mm *idx, const char *key)
+struct index_value *index_mm_searchwild(const struct index_mm *idx, const char *key)
{
struct index_mm_node nbuf, *root;
struct strbuf buf;
int index_mm_open(const struct kmod_ctx *ctx, const char *filename,
unsigned long long *stamp, struct index_mm **pidx);
void index_mm_close(struct index_mm *index);
-char *index_mm_search(struct index_mm *idx, const char *key);
-struct index_value *index_mm_searchwild(struct index_mm *idx, const char *key);
-void index_mm_dump(struct index_mm *idx, int fd, bool alias_prefix);
+char *index_mm_search(const struct index_mm *idx, const char *key);
+struct index_value *index_mm_searchwild(const struct index_mm *idx, const char *key);
+void index_mm_dump(const struct index_mm *idx, int fd, bool alias_prefix);