Coverage Report

Created: 2025-12-11 06:15

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
159k
{
38
284k
  for(;(p<pend)&&(*p==' ' || *p=='\t') ;p++);
39
159k
  return (char *)p;
40
159k
}
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
79.0k
{
38
121k
  for(;(p<pend)&&(*p==' ' || *p=='\t') ;p++);
39
79.0k
  return (char *)p;
40
79.0k
}
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
80.2k
{
38
162k
  for(;(p<pend)&&(*p==' ' || *p=='\t') ;p++);
39
80.2k
  return (char *)p;
40
80.2k
}
Unexecuted instantiation: parser_f.c:eat_space_end
Unexecuted instantiation: parse_nameaddr.c:eat_space_end
41
2.51M
#define SP(_c) ((_c)=='\t' || (_c)==' ')
42
inline static char* eat_lws_end(const char* p, const char* pend)
43
1.63M
{
44
1.69M
  while(p<pend) {
45
1.69M
    if (SP(*p)) p++;
46
    /* BTW--I really dislike line folding; -jiri */
47
1.64M
    else if (*p=='\n' && p+1<pend && SP(*(p+1))) p+=2;
48
1.63M
    else if (*p=='\r' && p+2<pend && *(p+1)=='\n'
49
4.34k
          && SP(*(p+2))) p+=3;
50
1.63M
    else break; /* no whitespace encountered */
51
1.69M
  }
52
1.63M
  return (char *)p;
53
1.63M
}
Unexecuted instantiation: dset.c:eat_lws_end
msg_parser.c:eat_lws_end
Line
Count
Source
43
1.55M
{
44
1.60M
  while(p<pend) {
45
1.60M
    if (SP(*p)) p++;
46
    /* BTW--I really dislike line folding; -jiri */
47
1.56M
    else if (*p=='\n' && p+1<pend && SP(*(p+1))) p+=2;
48
1.55M
    else if (*p=='\r' && p+2<pend && *(p+1)=='\n'
49
2.42k
          && SP(*(p+2))) p+=3;
50
1.55M
    else break; /* no whitespace encountered */
51
1.60M
  }
52
1.55M
  return (char *)p;
53
1.55M
}
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
79.8k
{
44
85.0k
  while(p<pend) {
45
84.6k
    if (SP(*p)) p++;
46
    /* BTW--I really dislike line folding; -jiri */
47
81.6k
    else if (*p=='\n' && p+1<pend && SP(*(p+1))) p+=2;
48
80.4k
    else if (*p=='\r' && p+2<pend && *(p+1)=='\n'
49
1.92k
          && SP(*(p+2))) p+=3;
50
79.4k
    else break; /* no whitespace encountered */
51
84.6k
  }
52
79.8k
  return (char *)p;
53
79.8k
}
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
280k
{
59
13.8M
  for (;(p<pend)&&(*p!=' ')&&(*p!='\t')&&(*p!='\n')&&(*p!='\r'); p++);
60
280k
  return (char *)p;
61
280k
}
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
119k
{
59
10.0M
  for (;(p<pend)&&(*p!=' ')&&(*p!='\t')&&(*p!='\n')&&(*p!='\r'); p++);
60
119k
  return (char *)p;
61
119k
}
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
160k
{
59
3.82M
  for (;(p<pend)&&(*p!=' ')&&(*p!='\t')&&(*p!='\n')&&(*p!='\r'); p++);
60
160k
  return (char *)p;
61
160k
}
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.31k
{
67
2.70k
  for (;(p<pend)&&(*p!=(delim))&&(*p!='\n')&&(*p!='\r'); p++);
68
1.31k
  return (char *)p;
69
1.31k
}
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.31k
{
67
2.70k
  for (;(p<pend)&&(*p!=(delim))&&(*p!='\n')&&(*p!='\r'); p++);
68
1.31k
  return (char *)p;
69
1.31k
}
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
38.7k
{
75
38.7k
  p=eat_space_end(p, pend );
76
38.7k
  return ((p<(pend )) && (*p=='\r' || *p=='\n'));
77
38.7k
}
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
38.7k
{
75
38.7k
  p=eat_space_end(p, pend );
76
38.7k
  return ((p<(pend )) && (*p=='\r' || *p=='\n'));
77
38.7k
}
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 */