kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit f126ba5a86da918668ee6c551ba99b4aa9675711
parent cf1f624367f8b64bc0262bf9c5b7092cf29b357e
Author: Joris Vink <joris@coders.se>
Date:   Wed, 25 Jul 2018 09:54:34 +0200

sprinkle more const around

Diffstat:
include/kore/kore.h | 5+++--
src/buf.c | 3++-
src/utils.c | 4++--
3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/include/kore/kore.h b/include/kore/kore.h @@ -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); diff --git a/src/buf.c b/src/buf.c @@ -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; diff --git a/src/utils.c b/src/utils.c @@ -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)