Coverage Report

Created: 2025-11-28 06:23

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
161k
{
38
289k
  for(;(p<pend)&&(*p==' ' || *p=='\t') ;p++);
39
161k
  return (char *)p;
40
161k
}
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.5k
{
38
123k
  for(;(p<pend)&&(*p==' ' || *p=='\t') ;p++);
39
79.5k
  return (char *)p;
40
79.5k
}
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
82.3k
{
38
166k
  for(;(p<pend)&&(*p==' ' || *p=='\t') ;p++);
39
82.3k
  return (char *)p;
40
82.3k
}
Unexecuted instantiation: parser_f.c:eat_space_end
Unexecuted instantiation: parse_nameaddr.c:eat_space_end
41
2.44M
#define SP(_c) ((_c)=='\t' || (_c)==' ')
42
inline static char* eat_lws_end(const char* p, const char* pend)
43
1.59M
{
44
1.65M
  while(p<pend) {
45
1.65M
    if (SP(*p)) p++;
46
    /* BTW--I really dislike line folding; -jiri */
47
1.60M
    else if (*p=='\n' && p+1<pend && SP(*(p+1))) p+=2;
48
1.59M
    else if (*p=='\r' && p+2<pend && *(p+1)=='\n'
49
6.14k
          && SP(*(p+2))) p+=3;
50
1.59M
    else break; /* no whitespace encountered */
51
1.65M
  }
52
1.59M
  return (char *)p;
53
1.59M
}
Unexecuted instantiation: dset.c:eat_lws_end
msg_parser.c:eat_lws_end
Line
Count
Source
43
1.51M
{
44
1.56M
  while(p<pend) {
45
1.56M
    if (SP(*p)) p++;
46
    /* BTW--I really dislike line folding; -jiri */
47
1.52M
    else if (*p=='\n' && p+1<pend && SP(*(p+1))) p+=2;
48
1.51M
    else if (*p=='\r' && p+2<pend && *(p+1)=='\n'
49
3.96k
          && SP(*(p+2))) p+=3;
50
1.51M
    else break; /* no whitespace encountered */
51
1.56M
  }
52
1.51M
  return (char *)p;
53
1.51M
}
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
81.8k
{
44
87.6k
  while(p<pend) {
45
87.3k
    if (SP(*p)) p++;
46
    /* BTW--I really dislike line folding; -jiri */
47
83.8k
    else if (*p=='\n' && p+1<pend && SP(*(p+1))) p+=2;
48
82.5k
    else if (*p=='\r' && p+2<pend && *(p+1)=='\n'
49
2.18k
          && SP(*(p+2))) p+=3;
50
81.5k
    else break; /* no whitespace encountered */
51
87.3k
  }
52
81.8k
  return (char *)p;
53
81.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
285k
{
59
15.4M
  for (;(p<pend)&&(*p!=' ')&&(*p!='\t')&&(*p!='\n')&&(*p!='\r'); p++);
60
285k
  return (char *)p;
61
285k
}
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
120k
{
59
11.3M
  for (;(p<pend)&&(*p!=' ')&&(*p!='\t')&&(*p!='\n')&&(*p!='\r'); p++);
60
120k
  return (char *)p;
61
120k
}
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
164k
{
59
4.01M
  for (;(p<pend)&&(*p!=' ')&&(*p!='\t')&&(*p!='\n')&&(*p!='\r'); p++);
60
164k
  return (char *)p;
61
164k
}
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.35k
{
67
3.17k
  for (;(p<pend)&&(*p!=(delim))&&(*p!='\n')&&(*p!='\r'); p++);
68
1.35k
  return (char *)p;
69
1.35k
}
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.35k
{
67
3.17k
  for (;(p<pend)&&(*p!=(delim))&&(*p!='\n')&&(*p!='\r'); p++);
68
1.35k
  return (char *)p;
69
1.35k
}
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.9k
{
75
38.9k
  p=eat_space_end(p, pend );
76
38.9k
  return ((p<(pend )) && (*p=='\r' || *p=='\n'));
77
38.9k
}
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.9k
{
75
38.9k
  p=eat_space_end(p, pend );
76
38.9k
  return ((p<(pend )) && (*p=='\r' || *p=='\n'));
77
38.9k
}
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 */