sprinkle more const around

This commit is contained in:
Joris Vink 2018-07-25 09:54:34 +02:00
parent cf1f624367
commit f126ba5a86
3 changed files with 7 additions and 5 deletions

View File

@ -643,7 +643,7 @@ long long kore_strtonum(const char *, int, long long, long long, int *);
double kore_strtodouble(const char *, long double, long double, int *);
int kore_base64_encode(const void *, size_t, char **);
int kore_base64_decode(const char *, u_int8_t **, size_t *);
void *kore_mem_find(void *, size_t, void *, size_t);
void *kore_mem_find(void *, size_t, const void *, size_t);
char *kore_text_trim(char *, size_t);
char *kore_read_line(FILE *, char *, size_t);
@ -778,7 +778,8 @@ void kore_buf_cleanup(struct kore_buf *);
char *kore_buf_stringify(struct kore_buf *, size_t *);
void kore_buf_appendf(struct kore_buf *, const char *, ...);
void kore_buf_appendv(struct kore_buf *, const char *, va_list);
void kore_buf_replace_string(struct kore_buf *, char *, void *, size_t);
void kore_buf_replace_string(struct kore_buf *,
const char *, const void *, size_t);
void kore_keymgr_run(void);
void kore_keymgr_cleanup(int);

View File

@ -145,7 +145,8 @@ kore_buf_release(struct kore_buf *buf, size_t *len)
}
void
kore_buf_replace_string(struct kore_buf *b, char *src, void *dst, size_t len)
kore_buf_replace_string(struct kore_buf *b, const char *src,
const void *dst, size_t len)
{
char *key, *end, *tmp, *p;
size_t blen, off, off2, nlen, klen;

View File

@ -541,12 +541,12 @@ kore_base64_decode(const char *in, u_int8_t **out, size_t *olen)
}
void *
kore_mem_find(void *src, size_t slen, void *needle, size_t len)
kore_mem_find(void *src, size_t slen, const void *needle, size_t len)
{
size_t pos;
for (pos = 0; pos < slen; pos++) {
if ( *((u_int8_t *)src + pos) != *(u_int8_t *)needle)
if ( *((u_int8_t *)src + pos) != *(const u_int8_t *)needle)
continue;
if ((slen - pos) < len)