Branch Coverage

procore.c
Criterion Covered Total %
branch 155 232 66.8


line true false branch
120 61915 8528 while (*pattern && cur_pos
61915 0 while (*pattern && cur_pos
121 37842 24073 if (*pattern == *cur_pos || *PATTERN == *cur_pos) {
13261 24581 if (*pattern == *cur_pos || *PATTERN == *cur_pos) {
129 0 8528 if (cur_pos>=next_to_end) return 0;
140 6151 26246 while (isspace(*(state->cur_pos)) && state->cur_poscur_pos++;};
6151 0 while (isspace(*(state->cur_pos)) && state->cur_poscur_pos++;};
164 935 1476 if (('"'==cur_char) || ('\''==cur_char)) {
42 893 if (('"'==cur_char) || ('\''==cur_char)) {
170 1518 893 if (quote_char) {
171 12782 1516 while (quote_char!=cur_char
176 12780 2 && cur_pos
181 4319 813 while ('>'!=cur_char && ! isspace(cur_char) && cur_pos
4239 80 while ('>'!=cur_char && ! isspace(cur_char) && cur_pos
4239 0 while ('>'!=cur_char && ! isspace(cur_char) && cur_pos
186 2 2409 if (cur_pos>=next_to_end) {
194 1516 893 if (quote_char) {
195 1516 0 if (quote_char==*cur_pos) {
214 1738 16166 if (is_string(state, modifier, MODIFIER)) {
216 1736 2 if ('='==*(state->cur_pos)) {
233 4476 2866 while (opt_found) {
235 17904 4476 for (i=MIN_TAG_OPT; i<=MAX_TAG_OPT; i++) {
236 1736 16168 if (
242 4 1732 if (debuglevel) log_state(state,TMPL_LOG_DEBUG,"in tag %s: found option %s=%.*s\n", TAGNAME[tag_type], TAGOPT[i],(int)(TagOptVal[i].endnext-TagOptVal[i].begin),TagOptVal[i].begin);
245 2866 1610 if (!found_in_loop) opt_found = 0;
259 13580 3395 for (i=MIN_TAG_OPT; i<=MAX_TAG_OPT; i++) {
264 9398 0 for (i=HTML_TEMPLATE_FIRST_TAG_USED; i<=HTML_TEMPLATE_LAST_TAG_USED; i++) {
265 3395 6003 if (is_string(state, tagname[i], TAGNAME[i])) {
268 5 3390 if (debuglevel) {
269 1 4 if (is_tag_closed) {
278 0 3395 if (HTML_TEMPLATE_BAD_TAG==tag_type) {
286 798 2597 if (is_tag_closed && !tag_can_be_closed[tag_type]) {
0 798 if (is_tag_closed && !tag_can_be_closed[tag_type]) {
292 2597 798 if (is_tag_closed || ! tag_has_opt[tag_type][TAG_OPT_NAME]) {
2191 406 if (is_tag_closed || ! tag_has_opt[tag_type][TAG_OPT_NAME]) {
304 1234 957 if (TagOptVal[TAG_OPT_NAME].begin == NULL &&
1234 0 if (TagOptVal[TAG_OPT_NAME].begin == NULL &&
305 1201 33 tag_has_opt[tag_type][TAG_OPT_NAME] &&
306 642 559 (!tag_has_opt[tag_type][TAG_OPT_EXPR] || TagOptVal[TAG_OPT_EXPR].begin == NULL )) {
311 559 1632 if (TagOptVal[TAG_OPT_NAME].begin == NULL &&
559 0 if (TagOptVal[TAG_OPT_NAME].begin == NULL &&
312 559 0 tag_has_opt[tag_type][TAG_OPT_NAME] &&
313 0 559 (!tag_has_opt[tag_type][TAG_OPT_EXPR] || TagOptVal[TAG_OPT_EXPR].begin == NULL )) {
317 8764 2191 for (i=MIN_TAG_OPT; i<=MAX_TAG_OPT; i++) {
318 2411 6353 if (TagOptVal[i].begin!=NULL && ! tag_has_opt[tag_type][i]) {
0 2411 if (TagOptVal[i].begin!=NULL && ! tag_has_opt[tag_type][i]) {
325 18 3377 if (state->is_tag_commented) {
329 18 0 if (state->cur_posnext_to_end-2 && '-'==*(state->cur_pos) && '-'==*(state->cur_pos+1)) {
18 0 if (state->cur_posnext_to_end-2 && '-'==*(state->cur_pos) && '-'==*(state->cur_pos+1)) {
18 0 if (state->cur_posnext_to_end-2 && '-'==*(state->cur_pos) && '-'==*(state->cur_pos+1)) {
334 2597 798 if (!is_tag_closed && '/'==*(state->cur_pos)) state->cur_pos++;
4 2593 if (!is_tag_closed && '/'==*(state->cur_pos)) state->cur_pos++;
336 3392 3 if ('>'==*(state->cur_pos)) {
344 2486 909 if (state->is_visible) {
348 798 2597 if (is_tag_closed) {
373 3 519 if (debuglevel) tmpl_log(TMPL_LOG_DEBUG,"process_state:initiated at scope stack depth = %d\n",
376 5985 344 while (state->cur_pos < last_safe_pos) {
378 55056 5807 while ('<'!=*(cur_pos++)) {
379 178 54878 if (cur_pos >= last_safe_pos) {
387 33 5774 if (('!'==*(cur_pos)) && ('-'==*(cur_pos+1)) && ('-'==*(cur_pos+2))) {
28 5 if (('!'==*(cur_pos)) && ('-'==*(cur_pos+1)) && ('-'==*(cur_pos+2))) {
28 0 if (('!'==*(cur_pos)) && ('-'==*(cur_pos+1)) && ('-'==*(cur_pos+2))) {
392 1921 3886 if ('/'==*(state->cur_pos)) {
396 3395 2412 if (is_string(state,metatag,METATAG)) {
409 3 519 if (debuglevel) tmpl_log(TMPL_LOG_DEBUG,"process_state:finished\n");
440 0 310 if (NULL==filepath) return ERR_PRO_FILE_NOT_FOUND;
443 0 310 if (NULL==filepath) return ERR_PRO_NOT_ENOUGH_MEMORY;
446 9 301 if (param->filters) memarea=(param->LoadFileFuncPtr)(param->ext_filter_state,filepath);
448 0 310 if (memarea.begin == NULL) {
454 306 4 if (memarea.begin < memarea.endnext) {
457 2 304 if (debuglevel) log_state(&state,TMPL_LOG_DEBUG, "exec_tmpl: loading %s\n",filename);
461 9 301 if (param->filters) mmapstatus=(param->UnloadFileFuncPtr)(param->ext_filter_state,memarea);
463 4 306 if (mmapstatus && debuglevel) log_state(&state,TMPL_LOG_DEBUG, "exec_tmpl: unloading %s caused munmap error\n",filename);
0 4 if (mmapstatus && debuglevel) log_state(&state,TMPL_LOG_DEBUG, "exec_tmpl: unloading %s caused munmap error\n",filename);
465 310 0 if (filepath!=NULL) free((void*) filepath);
479 216 0 if (memarea.begin != memarea.endnext) {
498 449 0 if (param->GetAbstractValFuncPtr==NULL ||
449 0 if (param->GetAbstractValFuncPtr==NULL ||
499 449 0 param->AbstractVal2pstringFuncPtr==NULL ||
500 449 0 param->AbstractVal2abstractArrayFuncPtr==NULL ||
502 449 0 param->GetAbstractMapFuncPtr==NULL ||
503 449 0 (param->IsExprUserfncFuncPtr!=NULL && param->IsExprUserfncFuncPtr != stub_is_expr_userfnc_func &&
449 0 (param->IsExprUserfncFuncPtr!=NULL && param->IsExprUserfncFuncPtr != stub_is_expr_userfnc_func &&
504 449 0 (param->InitExprArglistFuncPtr==NULL ||
505 449 0 param->PushExprArglistFuncPtr==NULL ||
506 0 449 param->FreeExprArglistFuncPtr==NULL ||
511 0 0 if (param->GetAbstractValFuncPtr==NULL) tmpl_log(TMPL_LOG_ERROR," GetAbstractValFuncPtr");
512 0 0 if (param->AbstractVal2pstringFuncPtr==NULL) tmpl_log(TMPL_LOG_ERROR," AbstractVal2pstringFuncPtr");
513 0 0 if (param->AbstractVal2abstractArrayFuncPtr==NULL) tmpl_log(TMPL_LOG_ERROR," AbstractVal2abstractArrayFuncPtr");
514 0 0 if (param->GetAbstractMapFuncPtr==NULL) tmpl_log(TMPL_LOG_ERROR," GetAbstractMapFuncPtr");
515 0 0 if ((param->IsExprUserfncFuncPtr!=NULL &&
0 0 if ((param->IsExprUserfncFuncPtr!=NULL &&
516 0 0 (param->InitExprArglistFuncPtr==NULL ||
517 0 0 param->PushExprArglistFuncPtr==NULL ||
518 0 0 param->FreeExprArglistFuncPtr==NULL ||
524 5 444 if (param->filters &&
5 0 if (param->filters &&
525 0 5 (param->LoadFileFuncPtr==NULL ||
530 0 449 if (NULL==param->WriterFuncPtr) param->WriterFuncPtr = stub_write_chars_to_stdout;
531 0 449 if (NULL==param->ext_findfile_state) param->ext_findfile_state = param;
532 449 0 if (NULL==param->FindFileFuncPtr) {
537 0 449 if (NULL==param->IsExprUserfncFuncPtr) param->IsExprUserfncFuncPtr = stub_is_expr_userfnc_func;
538 0 449 if (NULL==param->LoadFileFuncPtr) param->LoadFileFuncPtr = stub_load_file_func;
539 0 449 if (NULL==param->UnloadFileFuncPtr) param->UnloadFileFuncPtr = stub_unload_file_func;
540 0 449 if (NULL==param->GetAbstractArrayLengthFuncPtr) param->GetAbstractArrayLengthFuncPtr = stub_get_ABSTRACT_ARRAY_length_func;
553 216 233 if (param->scalarref.begin) exitcode = tmplpro_exec_tmpl_scalarref(param, param->scalarref);
554 233 0 else if (param->filename) exitcode = tmplpro_exec_tmpl_filename(param, param->filename);
559 0 449 if (param->strict && param->found_syntax_error && 0==exitcode) exitcode = ERR_PRO_TEMPLATE_SYNTAX_ERROR;
0 0 if (param->strict && param->found_syntax_error && 0==exitcode) exitcode = ERR_PRO_TEMPLATE_SYNTAX_ERROR;
0 0 if (param->strict && param->found_syntax_error && 0==exitcode) exitcode = ERR_PRO_TEMPLATE_SYNTAX_ERROR;
582 0 0 if (NULL!=retvalptr) *retvalptr=exitcode;
637 0 449 if (param==NULL) return param;
697 0 0 if (NULL==logfilename) {
698 0 0 if (tmpl_log_stream!=NULL) {
706 0 0 if (!file_p) {
710 0 0 if (tmpl_log_stream!=NULL) fclose(tmpl_log_stream);