static
int _reserve_ev_space(void * const vctx, const uint32_t ev_size)
{
+ int ret;
struct {{ ctx_struct_name }} * const ctx = _FROM_VOID_PTR(struct {{ ctx_struct_name }}, vctx);
/* Event _cannot_ fit? */
if (ev_size > (ctx->packet_size - ctx->off_content)) {
- ctx->events_discarded++;
- return 0;
+ goto no_space;
}
/* Packet is full? */
/* Yes: is the back-end full? */
if (ctx->cbs.is_backend_full(ctx->data)) {
/* Yes: discard event */
- ctx->events_discarded++;
- return 0;
+ goto no_space;
}
/* Back-end is _not_ full: open new packet */
/* Is the back-end full? */
if (ctx->cbs.is_backend_full(ctx->data)) {
/* Yes: discard event */
- ctx->events_discarded++;
- return 0;
+ goto no_space;
}
/* Back-end is _not_ full: open new packet */
assert(ev_size <= (ctx->packet_size - ctx->at));
}
- return 1;
+ ret = 1;
+ goto end;
+
+no_space:
+ ctx->events_discarded++;
+ ret = 0;
+
+end:
+ return ret;
}
static
*/
if (!ctx->is_tracing_enabled && !saved_in_tracing_section) {
ctx->in_tracing_section = 0;
- return;
+ goto end;
}
/* We can alter the packet */
/* Do not open a packet that is already open */
if (ctx->packet_is_open) {
ctx->in_tracing_section = saved_in_tracing_section;
- return;
+ goto end;
}
ctx->at = 0;
/* Not tracing anymore */
ctx->in_tracing_section = saved_in_tracing_section;
+
+end:
+ return;
}
{% include 'c/close-func-proto.j2' %}
*/
if (!ctx->is_tracing_enabled && !saved_in_tracing_section) {
ctx->in_tracing_section = 0;
- return;
+ goto end;
}
/* We can alter the packet */
/* Do not close a packet that is not open */
if (!ctx->packet_is_open) {
ctx->in_tracing_section = saved_in_tracing_section;
- return;
+ goto end;
}
/* Save content size */
/* Not tracing anymore */
ctx->in_tracing_section = saved_in_tracing_section;
+
+end:
+ return;
}
{% if stream_type._ev_header_ft %}
{% endif %}
if (!ctx->is_tracing_enabled) {
- return;
+ goto end;
}
/* We can alter the packet */
if (!_reserve_ev_space(_TO_VOID_PTR(ctx), ev_size)) {
/* no: forget this */
ctx->in_tracing_section = 0;
- return;
+ goto end;
}
/* Serialize event */
/* Not tracing anymore */
ctx->in_tracing_section = 0;
+
+end:
+ return;
}
{% endfor %}
{% endfor %}