Branch Coverage

builtin_findfile.inc
Criterion Covered Total %
branch 97 146 66.4


line true false branch
35 310 33 if (file_p) {
37 0 310 if (debuglevel>=TMPL_LOG_DEBUG2) tmpl_log(TMPL_LOG_DEBUG2,"_ff_exists: found [%s]\n",path);
40 0 33 if (debuglevel>=TMPL_LOG_DEBUG2) tmpl_log(TMPL_LOG_ERROR,"_ff_exists: not found [%s]\n",path);
48 68 0 if (path!=NULL) retval.endnext += strlen(path);
50 957 36 while (retval.endnext > retval.begin && (c=*(--retval.endnext)) && ! IS_FILE_SEP(c));
957 0 while (retval.endnext > retval.begin && (c=*(--retval.endnext)) && ! IS_FILE_SEP(c));
925 32 while (retval.endnext > retval.begin && (c=*(--retval.endnext)) && ! IS_FILE_SEP(c));
74 0 310 if ('\0' == c0) return 0;
76 0 310 if (IS_FILE_SEP(c0)) return 1;
105 6 0 if (pos >= buf.begin && (pos+shift) <=buf.endnext) {
6 0 if (pos >= buf.begin && (pos+shift) <=buf.endnext) {
107 170 6 while (pos
126 4940 230 while (pos
127 218 4722 if (IS_FILE_SEP(*pos) && IS_FILE_SEP(*(pos+1))) buf=_shift_back_pstring_at(buf, pos, 1);
0 218 if (IS_FILE_SEP(*pos) && IS_FILE_SEP(*(pos+1))) buf=_shift_back_pstring_at(buf, pos, 1);
139 2363 115 while (pos
140 110 2253 if (IS_FILE_SEP(*pos) && ('.'==*(pos+1)) && IS_FILE_SEP(*(pos+2))) buf=_shift_back_pstring_at(buf, pos, 2);
1 109 if (IS_FILE_SEP(*pos) && ('.'==*(pos+1)) && IS_FILE_SEP(*(pos+2))) buf=_shift_back_pstring_at(buf, pos, 2);
0 1 if (IS_FILE_SEP(*pos) && ('.'==*(pos+1)) && IS_FILE_SEP(*(pos+2))) buf=_shift_back_pstring_at(buf, pos, 2);
158 2246 115 while (pos
160 110 2136 if (IS_FILE_SEP(*pos)) {
161 1 109 if (('.'==*(pos+1)) && ('.'==*(pos+2)) && IS_FILE_SEP(*(pos+3))) {
1 0 if (('.'==*(pos+1)) && ('.'==*(pos+2)) && IS_FILE_SEP(*(pos+3))) {
1 0 if (('.'==*(pos+1)) && ('.'==*(pos+2)) && IS_FILE_SEP(*(pos+3))) {
163 0 1 if (pos == prev_slash_next && prev_slash_next==slash_begin) {
0 0 if (pos == prev_slash_next && prev_slash_next==slash_begin) {
171 1 0 if (prev_slash_next>slash_begin) prev_slash_next--;
172 1 0 if (prev_slash_next>slash_begin) prev_slash_next--;
176 9 1 while (prev_slash_next>=slash_begin && !IS_FILE_SEP(*prev_slash_next)) prev_slash_next--;
9 0 while (prev_slash_next>=slash_begin && !IS_FILE_SEP(*prev_slash_next)) prev_slash_next--;
177 0 1 if (prev_slash_next>slash_begin) prev_slash_next++;/* step next to slash */
189 0 115 if ((buf.endnext-buf.begin)<2) return buf.begin;
191 5 110 if (('.'==*pos) && IS_FILE_SEP(*(pos+1))) buf=_shift_back_pstring_at(buf, pos, 2);
5 0 if (('.'==*pos) && IS_FILE_SEP(*(pos+1))) buf=_shift_back_pstring_at(buf, pos, 2);
199 355 68 for (s=pstr.begin;s
207 2783 227 while ('\0'!=*s) {*(ret.endnext++)=*s++;}
213 112 0 if (ret.endnext>ret.begin && IS_FILE_SEP(*(ret.endnext-1))) return ret;
7 105 if (ret.endnext>ret.begin && IS_FILE_SEP(*(ret.endnext-1))) return ret;
227 310 0 if (NULL==retval) retval = getenv("HTML_TEMPLATE_ROOT");
239 0 310 if (param->debug >= TMPL_LOG_DEBUG2) {
241 0 0 if (HTML_TEMPLATE_ROOT) tmpl_log(TMPL_LOG_DEBUG2,"built-in _find_file: HTML_TEMPLATE_ROOT = %s\n",HTML_TEMPLATE_ROOT);
245 0 310 if (_ff_is_absolute(filename) && _ff_exists(filename)) return _ff_canonical_path(filename);
0 0 if (_ff_is_absolute(filename) && _ff_exists(filename)) return _ff_canonical_path(filename);
255 1 309 if (HTML_TEMPLATE_ROOT!=NULL) HTML_TEMPLATE_ROOT_length=strlen(HTML_TEMPLATE_ROOT);
256 80 230 if (pathlist!=NULL) {
257 99 80 while (NULL!=*pathlist) {
259 88 11 if (buffsize
273 68 242 if (extra_dir.begin!=NULL) {
275 32 36 if (extra_dir.endnext-extra_dir.begin >0)
279 52 16 if (_ff_exists(filepath.begin)) return _ff_canonical_path_from_buf(filepath);
283 1 257 if (HTML_TEMPLATE_ROOT!=NULL) {
285 1 0 if (HTML_TEMPLATE_ROOT_length >0)
289 0 1 if (_ff_exists(filepath.begin)) return _ff_canonical_path_from_buf(filepath);
294 67 191 if (pathlist!=NULL) {
295 77 5 while (NULL!=*pathlist) {
299 77 0 if (0!=**pathlist) filepath=_ff_add_sep_to_buffer(filepath);
302 62 15 if (_ff_exists(filepath.begin)) return _ff_canonical_path_from_buf(filepath);
308 195 1 if (_ff_exists(filename)) return _ff_canonical_path(filename);
311 1 0 if (HTML_TEMPLATE_ROOT!=NULL) {
313 1 0 if (pathlist!=NULL) {
314 1 0 while (NULL!=*pathlist) {
316 1 0 if (HTML_TEMPLATE_ROOT_length >0)
320 1 0 if (0!=**pathlist) filepath=_ff_add_sep_to_buffer(filepath);
323 1 0 if (_ff_exists(filepath.begin)) return _ff_canonical_path_from_buf(filepath);
336 0 310 if (filename == last_visited_file) tmpl_log(TMPL_LOG_ERROR,"built-in find_file: internal error: buffer clash for %s\n",filename);
338 0 310 if (((struct tmplpro_param*)param)->debug>= TMPL_LOG_DEBUG)
342 76 234 if (last_visited_file!=NULL && ! ((struct tmplpro_param*) param)->search_path_on_include) {
68 8 if (last_visited_file!=NULL && ! ((struct tmplpro_param*) param)->search_path_on_include) {
346 0 310 if (filepath==NULL) {
350 0 0 if (NULL!=last_visited_file) tmpl_log(TMPL_LOG_ERROR," (included from %s)", last_visited_file);
351 0 0 if(HTML_TEMPLATE_ROOT!=NULL) {
354 0 0 if (NULL!=path) {
356 0 0 while (NULL!=*path) {