X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fsw_limits.c;h=55ca79dafbb58ef53235e67254fd4670c9cd03f8;hb=2622b4297fd4cc4bed5c06bb6ae0aaa8b40e0ece;hp=37c28667987df4f643e584466ae0b3e3eb15453f;hpb=82b9f3d116ce0c982291a2dfdd15cd8a1c4cc16e;p=libsigrok.git diff --git a/src/sw_limits.c b/src/sw_limits.c index 37c28667..55ca79da 100644 --- a/src/sw_limits.c +++ b/src/sw_limits.c @@ -43,9 +43,7 @@ */ SR_PRIV void sr_sw_limits_init(struct sr_sw_limits *limits) { - limits->limit_samples = 0; - limits->limit_frames = 0; - limits->limit_msec = 0; + memset(limits, 0, sizeof(*limits)); } /** @@ -59,7 +57,7 @@ SR_PRIV void sr_sw_limits_init(struct sr_sw_limits *limits) * @param data config item data * @return SR_ERR_NA if @p key is not a supported limit, SR_OK otherwise */ -SR_PRIV int sr_sw_limits_config_get(struct sr_sw_limits *limits, uint32_t key, +SR_PRIV int sr_sw_limits_config_get(const struct sr_sw_limits *limits, uint32_t key, GVariant **data) { switch (key) { @@ -153,7 +151,7 @@ SR_PRIV gboolean sr_sw_limits_check(struct sr_sw_limits *limits) } } - if (limits->limit_msec) { + if (limits->limit_msec && limits->start_time) { guint64 now; now = g_get_monotonic_time(); if (now > limits->start_time &&