* some reasonably low value to keep dlogutil responsive. */
#define DEFAULT_EPOLL_TIMEOUT 100
+bool is_limited_dumping(struct sort_vector *logs)
+{
+ return logs->dump != DLOGUTIL_MODE_CONTINUOUS
+ && logs->dump != DLOGUTIL_MAX_DUMP_SIZE;
+}
+
int create_initial_fdis(struct fd_info ***fdis, int enabled_buffers, bool is_pipe, const struct log_config *conf)
{
assert(fdis);
}
if (*out) {
- if (state->logs.dump == DLOGUTIL_MODE_CONTINUOUS
- || state->logs.dump == DLOGUTIL_MAX_DUMP_SIZE)
+ if (!is_limited_dumping(&state->logs))
return 0;
free(*out);
*out = NULL;
if (!*out)
break;
- if (state->logs.dump == DLOGUTIL_MODE_CONTINUOUS
- || state->logs.dump == DLOGUTIL_MAX_DUMP_SIZE)
+ if (!is_limited_dumping(&state->logs))
return 0;
free(*out);
*out = NULL;
}
- if (state->logs.dump != DLOGUTIL_MODE_CONTINUOUS && state->logs.dump != DLOGUTIL_MAX_DUMP_SIZE)
+ if (is_limited_dumping(&state->logs))
while (sort_vector_used_size(&state->logs) > state->logs.dump)
sort_vector_pop(&state->logs);