Lines Matching defs:msgs
116 static void free_msgs(struct expected_msgs *msgs)
120 for (i = 0; i < msgs->cnt; i++)
121 if (msgs->patterns[i].is_regex)
122 regfree(&msgs->patterns[i].regex);
123 free(msgs->patterns);
124 msgs->patterns = NULL;
125 msgs->cnt = 0;
209 struct expected_msgs *msgs)
215 tmp = realloc(msgs->patterns,
216 (1 + msgs->cnt) * sizeof(struct expect_msg));
221 msgs->patterns = tmp;
222 msg = &msgs->patterns[msgs->cnt];
233 msgs->cnt += 1;
251 static int push_msg(const char *substr, bool negative, struct expected_msgs *msgs)
253 return __push_msg(substr, false, negative, msgs);
256 static int push_disasm_msg(const char *regex_str, bool *on_next_line, struct expected_msgs *msgs)
264 err = __push_msg(regex_str, *on_next_line, false, msgs);
809 static void match_positive_msgs(const char *log, struct expected_msgs *msgs, struct match *matches)
816 for (i = 0; i < msgs->cnt; i++) {
817 struct expect_msg *msg = &msgs->patterns[i];
839 static void match_negative_msgs(const char *log, struct expected_msgs *msgs, struct match *matches)
845 for (i = 0; i < msgs->cnt; i++) {
846 struct expect_msg *msg = &msgs->patterns[i];
856 for (next_positive = i + 1; next_positive < msgs->cnt; next_positive++) {
857 if (!msgs->patterns[next_positive].negative) {
878 void validate_msgs(const char *log_buf, struct expected_msgs *msgs,
881 struct match matches[msgs->cnt];
885 memset(matches, 0, sizeof(*matches) * msgs->cnt);
886 match_positive_msgs(log_buf, msgs, matches);
887 match_negative_msgs(log_buf, msgs, matches);
889 for (i = 0; i < msgs->cnt; i++) {
890 struct expect_msg *msg = &msgs->patterns[i];
907 msg = &msgs->patterns[j];
916 msg = &msgs->patterns[j];