Coverage Report

Created: 2026-12-01 06:30

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/opensips/parser/parser_f.h
Line
Count
Source
1
/*
2
 * Copyright (C) 2001-2003 FhG Fokus
3
 *
4
 * This file is part of opensips, a free SIP server.
5
 *
6
 * opensips is free software; you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation; either version 2 of the License, or
9
 * (at your option) any later version
10
 *
11
 * opensips is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
19
 *
20
 * History
21
 * --------
22
 * 2003-02-28 scratchpad compatibility abandoned (jiri)
23
 * 2003-03-24 find_not_quoted function added (janakj)
24
 */
25
26
27
#ifndef parser_f_h
28
#define parser_f_h
29
30
#include "../str.h"
31
32
char* eat_line(char* buffer, unsigned int len);
33
34
/* turn the most frequently called functions into inline functions */
35
36
inline static char* eat_space_end(const char* p, const char* pend)
37
154k
{
38
277k
  for(;(p<pend)&&(*p==' ' || *p=='\t') ;p++);
39
154k
  return (char *)p;
40
154k
}
Unexecuted instantiation: dset.c:eat_space_end
Unexecuted instantiation: msg_parser.c:eat_space_end
parse_fline.c:eat_space_end
Line
Count
Source
37
81.9k
{
38
126k
  for(;(p<pend)&&(*p==' ' || *p=='\t') ;p++);
39
81.9k
  return (char *)p;
40
81.9k
}
Unexecuted instantiation: sdp.c:eat_space_end
Unexecuted instantiation: sdp_helpr_funcs.c:eat_space_end
Unexecuted instantiation: parse_body.c:eat_space_end
parse_cseq.c:eat_space_end
Line
Count
Source
37
72.6k
{
38
151k
  for(;(p<pend)&&(*p==' ' || *p=='\t') ;p++);
39
72.6k
  return (char *)p;
40
72.6k
}
Unexecuted instantiation: parser_f.c:eat_space_end
Unexecuted instantiation: parse_nameaddr.c:eat_space_end
41
2.37M
#define SP(_c) ((_c)=='\t' || (_c)==' ')
42
inline static char* eat_lws_end(const char* p, const char* pend)
43
1.52M
{
44
1.57M
  while(p<pend) {
45
1.56M
    if (SP(*p)) p++;
46
    /* BTW--I really dislike line folding; -jiri */
47
1.53M
    else if (*p=='\n' && p+1<pend && SP(*(p+1))) p+=2;
48
1.52M
    else if (*p=='\r' && p+2<pend && *(p+1)=='\n'
49
33.5k
          && SP(*(p+2))) p+=3;
50
1.52M
    else break; /* no whitespace encountered */
51
1.56M
  }
52
1.52M
  return (char *)p;
53
1.52M
}
Unexecuted instantiation: dset.c:eat_lws_end
msg_parser.c:eat_lws_end
Line
Count
Source
43
1.45M
{
44
1.49M
  while(p<pend) {
45
1.49M
    if (SP(*p)) p++;
46
    /* BTW--I really dislike line folding; -jiri */
47
1.45M
    else if (*p=='\n' && p+1<pend && SP(*(p+1))) p+=2;
48
1.45M
    else if (*p=='\r' && p+2<pend && *(p+1)=='\n'
49
32.0k
          && SP(*(p+2))) p+=3;
50
1.45M
    else break; /* no whitespace encountered */
51
1.49M
  }
52
1.45M
  return (char *)p;
53
1.45M
}
Unexecuted instantiation: parse_fline.c:eat_lws_end
Unexecuted instantiation: sdp.c:eat_lws_end
Unexecuted instantiation: sdp_helpr_funcs.c:eat_lws_end
Unexecuted instantiation: parse_body.c:eat_lws_end
parse_cseq.c:eat_lws_end
Line
Count
Source
43
72.2k
{
44
77.4k
  while(p<pend) {
45
76.9k
    if (SP(*p)) p++;
46
    /* BTW--I really dislike line folding; -jiri */
47
73.6k
    else if (*p=='\n' && p+1<pend && SP(*(p+1))) p+=2;
48
72.6k
    else if (*p=='\r' && p+2<pend && *(p+1)=='\n'
49
1.44k
          && SP(*(p+2))) p+=3;
50
71.8k
    else break; /* no whitespace encountered */
51
76.9k
  }
52
72.2k
  return (char *)p;
53
72.2k
}
Unexecuted instantiation: parser_f.c:eat_lws_end
Unexecuted instantiation: parse_nameaddr.c:eat_lws_end
54
55
56
57
inline static char* eat_token_end(const char* p, const char* pend)
58
269k
{
59
20.8M
  for (;(p<pend)&&(*p!=' ')&&(*p!='\t')&&(*p!='\n')&&(*p!='\r'); p++);
60
269k
  return (char *)p;
61
269k
}
Unexecuted instantiation: dset.c:eat_token_end
Unexecuted instantiation: msg_parser.c:eat_token_end
parse_fline.c:eat_token_end
Line
Count
Source
58
124k
{
59
19.0M
  for (;(p<pend)&&(*p!=' ')&&(*p!='\t')&&(*p!='\n')&&(*p!='\r'); p++);
60
124k
  return (char *)p;
61
124k
}
Unexecuted instantiation: sdp.c:eat_token_end
Unexecuted instantiation: sdp_helpr_funcs.c:eat_token_end
Unexecuted instantiation: parse_body.c:eat_token_end
parse_cseq.c:eat_token_end
Line
Count
Source
58
145k
{
59
1.80M
  for (;(p<pend)&&(*p!=' ')&&(*p!='\t')&&(*p!='\n')&&(*p!='\r'); p++);
60
145k
  return (char *)p;
61
145k
}
Unexecuted instantiation: parser_f.c:eat_token_end
Unexecuted instantiation: parse_nameaddr.c:eat_token_end
62
63
64
65
inline static char* eat_token2_end(const char* p, const char* pend, char delim)
66
1.44k
{
67
2.37k
  for (;(p<pend)&&(*p!=(delim))&&(*p!='\n')&&(*p!='\r'); p++);
68
1.44k
  return (char *)p;
69
1.44k
}
Unexecuted instantiation: dset.c:eat_token2_end
Unexecuted instantiation: msg_parser.c:eat_token2_end
parse_fline.c:eat_token2_end
Line
Count
Source
66
1.44k
{
67
2.37k
  for (;(p<pend)&&(*p!=(delim))&&(*p!='\n')&&(*p!='\r'); p++);
68
1.44k
  return (char *)p;
69
1.44k
}
Unexecuted instantiation: sdp.c:eat_token2_end
Unexecuted instantiation: sdp_helpr_funcs.c:eat_token2_end
Unexecuted instantiation: parse_body.c:eat_token2_end
Unexecuted instantiation: parse_cseq.c:eat_token2_end
Unexecuted instantiation: parser_f.c:eat_token2_end
Unexecuted instantiation: parse_nameaddr.c:eat_token2_end
70
71
72
73
inline static int is_empty_end(const char* p, const char* pend )
74
40.0k
{
75
40.0k
  p=eat_space_end(p, pend );
76
40.0k
  return ((p<(pend )) && (*p=='\r' || *p=='\n'));
77
40.0k
}
Unexecuted instantiation: dset.c:is_empty_end
Unexecuted instantiation: msg_parser.c:is_empty_end
parse_fline.c:is_empty_end
Line
Count
Source
74
40.0k
{
75
40.0k
  p=eat_space_end(p, pend );
76
40.0k
  return ((p<(pend )) && (*p=='\r' || *p=='\n'));
77
40.0k
}
Unexecuted instantiation: sdp.c:is_empty_end
Unexecuted instantiation: sdp_helpr_funcs.c:is_empty_end
Unexecuted instantiation: parse_body.c:is_empty_end
Unexecuted instantiation: parse_cseq.c:is_empty_end
Unexecuted instantiation: parser_f.c:is_empty_end
Unexecuted instantiation: parse_nameaddr.c:is_empty_end
78
79
80
/*
81
 * Find a character occurrence that is not quoted
82
 */
83
inline static char* find_not_quoted(str* _s, char _c)
84
0
{
85
0
  int quoted = 0, i;
86
87
0
  for(i = 0; i < _s->len; i++) {
88
0
    if (!quoted) {
89
0
      if (_s->s[i] == '\"') quoted = 1;
90
0
      else if (_s->s[i] == _c) return _s->s + i;
91
0
    } else {
92
0
      if ((_s->s[i] == '\"') && (_s->s[i - 1] != '\\')) quoted = 0;
93
0
    }
94
0
  }
95
0
  return 0;
96
0
}
Unexecuted instantiation: dset.c:find_not_quoted
Unexecuted instantiation: msg_parser.c:find_not_quoted
Unexecuted instantiation: parse_fline.c:find_not_quoted
Unexecuted instantiation: sdp.c:find_not_quoted
Unexecuted instantiation: sdp_helpr_funcs.c:find_not_quoted
Unexecuted instantiation: parse_body.c:find_not_quoted
Unexecuted instantiation: parse_cseq.c:find_not_quoted
Unexecuted instantiation: parser_f.c:find_not_quoted
Unexecuted instantiation: parse_nameaddr.c:find_not_quoted
97
98
99
#endif /* parser_f_h */