Commit 1502b121 authored by Geoff Simmons's avatar Geoff Simmons

add const qualifiers to some of the interfaces in format.c

parent 59b54d08
...@@ -79,7 +79,7 @@ static int read_rx_hdr = 0, read_tx_hdr = 0, read_vcl_log = 0, ...@@ -79,7 +79,7 @@ static int read_rx_hdr = 0, read_tx_hdr = 0, read_vcl_log = 0,
#endif #endif
char * char *
get_payload(logline_t *rec) get_payload(const logline_t *rec)
{ {
CHECK_OBJ_NOTNULL(rec, LOGLINE_MAGIC); CHECK_OBJ_NOTNULL(rec, LOGLINE_MAGIC);
...@@ -111,7 +111,7 @@ get_payload(logline_t *rec) ...@@ -111,7 +111,7 @@ get_payload(logline_t *rec)
* Return the *last* record in tx that matches the tag * Return the *last* record in tx that matches the tag
*/ */
logline_t * logline_t *
get_tag(tx_t *tx, enum VSL_tag_e tag) get_tag(const tx_t *tx, enum VSL_tag_e tag)
{ {
logline_t *rec, *tagrec = NULL; logline_t *rec, *tagrec = NULL;
...@@ -129,7 +129,7 @@ get_tag(tx_t *tx, enum VSL_tag_e tag) ...@@ -129,7 +129,7 @@ get_tag(tx_t *tx, enum VSL_tag_e tag)
* tag and the header name. * tag and the header name.
*/ */
char * char *
get_hdr(tx_t *tx, enum VSL_tag_e tag, const char *hdr) get_hdr(const tx_t *tx, enum VSL_tag_e tag, const char *hdr)
{ {
logline_t *rec; logline_t *rec;
char *hdr_payload = NULL; char *hdr_payload = NULL;
...@@ -183,7 +183,7 @@ get_fld(char *str, int n, size_t *len) ...@@ -183,7 +183,7 @@ get_fld(char *str, int n, size_t *len)
} }
char * char *
get_rec_fld(logline_t *rec, int n, size_t *len) get_rec_fld(const logline_t *rec, int n, size_t *len)
{ {
return get_fld(get_payload(rec), n, len); return get_fld(get_payload(rec), n, len);
} }
...@@ -225,7 +225,7 @@ format_b_backend(tx_t *tx, char *name, enum VSL_tag_e tag, char **s, ...@@ -225,7 +225,7 @@ format_b_backend(tx_t *tx, char *name, enum VSL_tag_e tag, char **s,
static inline void static inline void
format_DT(tx_t *tx, const char *ts, int m, char **s, size_t *len) format_DT(tx_t *tx, const char *ts, int m, char **s, size_t *len)
{ {
char *t; const char *t;
double d; double d;
char *f = get_hdr(tx, SLT_Timestamp, ts); char *f = get_hdr(tx, SLT_Timestamp, ts);
......
...@@ -37,11 +37,11 @@ struct vsb *payload; ...@@ -37,11 +37,11 @@ struct vsb *payload;
typedef void formatter_f(tx_t *tx, char *name, enum VSL_tag_e tag, typedef void formatter_f(tx_t *tx, char *name, enum VSL_tag_e tag,
char **s, size_t *len); char **s, size_t *len);
char *get_payload(logline_t *rec); char *get_payload(const logline_t *rec);
logline_t *get_tag(tx_t *tx, enum VSL_tag_e tag); logline_t *get_tag(const tx_t *tx, enum VSL_tag_e tag);
char *get_hdr(tx_t *tx, enum VSL_tag_e tag, const char *hdr); char *get_hdr(const tx_t *tx, enum VSL_tag_e tag, const char *hdr);
char *get_fld(char *str, int n, size_t *len); char *get_fld(char *str, int n, size_t *len);
char *get_rec_fld(logline_t *rec, int n, size_t *len); char *get_rec_fld(const logline_t *rec, int n, size_t *len);
formatter_f format_b_client; formatter_f format_b_client;
formatter_f format_b_backend; formatter_f format_b_backend;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment