Skip to content

Commit 52c302d

Browse files
committed
ols: use memset instead of for-loop
More efficient but as readable.
1 parent b31d2ae commit 52c302d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/hardware/openbench-logic-sniffer/protocol.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,11 @@ static int ols_convert_basic_trigger(const struct sr_dev_inst *sdi, struct ols_b
122122
struct sr_trigger_stage *stage;
123123
struct sr_trigger_match *match;
124124
const GSList *l, *m;
125-
int i, requested_num_stages;
125+
int requested_num_stages;
126126

127127
ols_trigger->num_stages = 0;
128-
for (i = 0; i < NUM_BASIC_TRIGGER_STAGES; i++) {
129-
ols_trigger->trigger_mask[i] = 0;
130-
ols_trigger->trigger_value[i] = 0;
131-
}
128+
memset(ols_trigger->trigger_mask, 0, NUM_BASIC_TRIGGER_STAGES * sizeof(uint32_t));
129+
memset(ols_trigger->trigger_value, 0, NUM_BASIC_TRIGGER_STAGES * sizeof(uint32_t));
132130

133131
if (!(trigger = sr_session_trigger_get(sdi->session)))
134132
return SR_OK;

0 commit comments

Comments
 (0)