nostrdb: make more things const
rust is happier this way Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
Daniel D’Aquino
parent
7d6814a481
commit
b5c57dc935
@@ -589,7 +589,7 @@ int ndb_filter_end(struct ndb_filter *filter)
|
||||
}
|
||||
|
||||
static inline struct ndb_filter_elements *
|
||||
ndb_filter_get_elements_by_offset(struct ndb_filter *filter, int offset)
|
||||
ndb_filter_get_elements_by_offset(const struct ndb_filter *filter, int offset)
|
||||
{
|
||||
struct ndb_filter_elements *els;
|
||||
|
||||
@@ -605,13 +605,13 @@ ndb_filter_get_elements_by_offset(struct ndb_filter *filter, int offset)
|
||||
}
|
||||
|
||||
struct ndb_filter_elements *
|
||||
ndb_filter_current_element(struct ndb_filter *filter)
|
||||
ndb_filter_current_element(const struct ndb_filter *filter)
|
||||
{
|
||||
return ndb_filter_get_elements_by_offset(filter, filter->current);
|
||||
}
|
||||
|
||||
static inline struct ndb_filter_elements *
|
||||
ndb_filter_get_elements(struct ndb_filter *filter, int index)
|
||||
ndb_filter_get_elements(const struct ndb_filter *filter, int index)
|
||||
{
|
||||
if (filter->num_elements <= 0)
|
||||
return NULL;
|
||||
@@ -623,7 +623,7 @@ ndb_filter_get_elements(struct ndb_filter *filter, int index)
|
||||
}
|
||||
|
||||
static inline unsigned char *
|
||||
ndb_filter_elements_data(struct ndb_filter *filter, int offset)
|
||||
ndb_filter_elements_data(const struct ndb_filter *filter, int offset)
|
||||
{
|
||||
unsigned char *data;
|
||||
|
||||
@@ -638,13 +638,13 @@ ndb_filter_elements_data(struct ndb_filter *filter, int offset)
|
||||
}
|
||||
|
||||
static inline unsigned char *
|
||||
ndb_filter_get_id_element(struct ndb_filter *filter, struct ndb_filter_elements *els, int index)
|
||||
ndb_filter_get_id_element(const struct ndb_filter *filter, struct ndb_filter_elements *els, int index)
|
||||
{
|
||||
return ndb_filter_elements_data(filter, els->elements[index]);
|
||||
}
|
||||
|
||||
static inline const char *
|
||||
ndb_filter_get_string_element(struct ndb_filter *filter, struct ndb_filter_elements *els, int index)
|
||||
ndb_filter_get_string_element(const struct ndb_filter *filter, struct ndb_filter_elements *els, int index)
|
||||
{
|
||||
return (const char *)ndb_filter_elements_data(filter, els->elements[index]);
|
||||
}
|
||||
@@ -4803,7 +4803,7 @@ int ndb_note_json(struct ndb_note *note, char *buf, int buflen)
|
||||
}
|
||||
|
||||
static int cursor_push_json_elem_array(struct cursor *cur,
|
||||
struct ndb_filter *filter,
|
||||
const struct ndb_filter *filter,
|
||||
struct ndb_filter_elements *elems)
|
||||
{
|
||||
int i;
|
||||
@@ -4849,7 +4849,7 @@ static int cursor_push_json_elem_array(struct cursor *cur,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ndb_filter_json(struct ndb_filter *filter, char *buf, int buflen)
|
||||
int ndb_filter_json(const struct ndb_filter *filter, char *buf, int buflen)
|
||||
{
|
||||
struct cursor cur, *c = &cur;
|
||||
struct ndb_filter_elements *elems;
|
||||
|
||||
@@ -491,7 +491,7 @@ int ndb_filter_add_id_element(struct ndb_filter *, const unsigned char *id);
|
||||
int ndb_filter_add_int_element(struct ndb_filter *, uint64_t integer);
|
||||
int ndb_filter_add_str_element(struct ndb_filter *, const char *str);
|
||||
|
||||
struct ndb_filter_elements *ndb_filter_current_element(struct ndb_filter *);
|
||||
struct ndb_filter_elements *ndb_filter_current_element(const struct ndb_filter *);
|
||||
int ndb_filter_start_field(struct ndb_filter *, enum ndb_filter_fieldtype);
|
||||
int ndb_filter_start_tag_field(struct ndb_filter *, char tag);
|
||||
int ndb_filter_matches(struct ndb_filter *, struct ndb_note *);
|
||||
@@ -499,7 +499,7 @@ int ndb_filter_clone(struct ndb_filter *dst, struct ndb_filter *src);
|
||||
int ndb_filter_end(struct ndb_filter *);
|
||||
void ndb_filter_end_field(struct ndb_filter *);
|
||||
void ndb_filter_destroy(struct ndb_filter *);
|
||||
int ndb_filter_json(struct ndb_filter *, char *buf, int buflen);
|
||||
int ndb_filter_json(const struct ndb_filter *, char *buf, int buflen);
|
||||
|
||||
// SUBSCRIPTIONS
|
||||
uint64_t ndb_subscribe(struct ndb *, struct ndb_filter *, int num_filters);
|
||||
|
||||
Reference in New Issue
Block a user