With the introduction of the `generate_unique_id()` helper, the actual
complicated logic is sitting in a different file. Allow inlining of
`stream_generate_unique_id()`, so that callers can benefit from an abstraction
without hiding away the access of `strm->unique_id` behind a function call.
---
include/haproxy/log.h | 9 +++++++++
include/haproxy/stream.h | 2 --
src/stream.c | 17 -----------------
3 files changed, 9 insertions(+), 19 deletions(-)
diff --git a/include/haproxy/log.h b/include/haproxy/log.h
index 98483eee0..f1610a297 100644
--- a/include/haproxy/log.h
+++ b/include/haproxy/log.h
@@ -198,6 +198,15 @@ char * get_format_pid_sep2(int format, size_t *len);
void generate_unique_id(struct ist *dst, struct session *sess, struct stream
*strm, struct lf_expr *format);
+static inline struct ist stream_generate_unique_id(struct stream *strm, struct
lf_expr *format)
+{
+ if (!isttest(strm->unique_id)) {
+ generate_unique_id(&strm->unique_id, strm_sess(strm), strm,
format);
+ }
+
+ return strm->unique_id;
+}
+
/*
* Builds a log line for the stream (must be valid).
*/
diff --git a/include/haproxy/stream.h b/include/haproxy/stream.h
index 09732bcf2..fe66d6cb4 100644
--- a/include/haproxy/stream.h
+++ b/include/haproxy/stream.h
@@ -69,8 +69,6 @@ void stream_shutdown_self(struct stream *stream, int why);
void stream_dump_and_crash(enum obj_type *obj, int rate);
void strm_dump_to_buffer(struct buffer *buf, const struct stream *strm, const
char *pfx, uint32_t anon_key);
-struct ist stream_generate_unique_id(struct stream *strm, struct lf_expr
*format);
-
void stream_process_counters(struct stream *s);
void sess_change_server(struct stream *strm, struct server *newsrv);
struct task *process_stream(struct task *t, void *context, unsigned int state);
diff --git a/src/stream.c b/src/stream.c
index 9e026c23d..ac9fc42d1 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -3083,23 +3083,6 @@ static void init_stream()
}
INITCALL0(STG_INIT, init_stream);
-/* Generates a unique ID based on the given <format>, stores it in the given
<strm> and
- * returns the unique ID.
- *
- * If this function fails to allocate memory IST_NULL is returned.
- *
- * If an ID is already stored within the stream nothing happens existing
unique ID is
- * returned.
- */
-struct ist stream_generate_unique_id(struct stream *strm, struct lf_expr
*format)
-{
- if (!isttest(strm->unique_id)) {
- generate_unique_id(&strm->unique_id, strm_sess(strm), strm,
format);
- }
-
- return strm->unique_id;
-}
-
/************************************************************************/
/* All supported ACL keywords must be declared here. */
/************************************************************************/
--
2.53.0