sip_parser.c:pj_cis_match:
  151|  14.5k|{
  152|  14.5k|    return PJ_CIS_ISSET(cis, c);
  ------------------
  |  |   90|  14.5k|#define PJ_CIS_ISSET(cis,c) ((cis)->cis_buf[(int)c] & (1 << (cis)->cis_id))
  ------------------
  153|  14.5k|}
sip_parser.c:pj_scan_is_eof:
  253|   179k|{
  254|   179k|    return scanner->curptr >= scanner->end;
  255|   179k|}
sip_parser.c:pj_scan_get_col:
  541|  28.0k|{
  542|  28.0k|    return (int)(scanner->curptr - scanner->start_line);
  543|  28.0k|}
scanner.c:pj_scan_is_eof:
  253|   431k|{
  254|   431k|    return scanner->curptr >= scanner->end;
  255|   431k|}
scanner.c:pj_cis_match:
  151|  1.64M|{
  152|  1.64M|    return PJ_CIS_ISSET(cis, c);
  ------------------
  |  |   90|  1.64M|#define PJ_CIS_ISSET(cis,c) ((cis)->cis_buf[(int)c] & (1 << (cis)->cis_id))
  ------------------
  153|  1.64M|}

pjlib_util_init:
  178|  4.82k|{
  179|  4.82k|    pj_status_t status;
  180|       |    
  181|  4.82k|    status = pj_register_strerror(PJLIB_UTIL_ERRNO_START, 
  ------------------
  |  |   35|  4.82k|#define PJLIB_UTIL_ERRNO_START    (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*3)
  |  |  ------------------
  |  |  |  |  470|  4.82k|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  463|  4.82k|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  456|  4.82k|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  444|  4.82k|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  450|  4.82k|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  450|  4.82k|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|  4.82k|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PJLIB_UTIL_ERRNO_START    (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*3)
  |  |  ------------------
  |  |  |  |  450|  4.82k|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  ------------------
  ------------------
  182|  4.82k|                                  PJ_ERRNO_SPACE_SIZE, 
  ------------------
  |  |  450|  4.82k|#define PJ_ERRNO_SPACE_SIZE     50000
  ------------------
  183|  4.82k|                                  &pjlib_util_strerror);
  184|  4.82k|    pj_assert(status == PJ_SUCCESS);
  ------------------
  |  |   48|  4.82k|#   define pj_assert(expr)   assert(expr)
  ------------------
  185|       |
  186|  4.82k|    return status;
  187|  4.82k|}

pj_cis_add_range:
   51|  86.8k|{
   52|       |    /* Can not set zero. This is the requirement of the parser. */
   53|  86.8k|    pj_assert(cstart > 0);
  ------------------
  |  |   48|  86.8k|#   define pj_assert(expr)   assert(expr)
  ------------------
   54|       |
   55|  1.88M|    while (cstart != cend) {
  ------------------
  |  Branch (55:12): [True: 1.79M, False: 86.8k]
  ------------------
   56|  1.79M|        PJ_CIS_SET(cis, cstart);
  ------------------
  |  |   72|  1.79M|#define PJ_CIS_SET(cis,c)   ((cis)->cis_buf[(int)(c)] |= (1 << (cis)->cis_id))
  ------------------
   57|  1.79M|        ++cstart;
   58|  1.79M|    }
   59|  86.8k|}
pj_cis_add_alpha:
   62|  28.9k|{
   63|  28.9k|    pj_cis_add_range( cis, 'a', 'z'+1);
   64|  28.9k|    pj_cis_add_range( cis, 'A', 'Z'+1);
   65|  28.9k|}
pj_cis_add_num:
   68|  28.9k|{
   69|  28.9k|    pj_cis_add_range( cis, '0', '9'+1);
   70|  28.9k|}
pj_cis_add_str:
   73|   110k|{
   74|  1.39M|    while (*str) {
  ------------------
  |  Branch (74:12): [True: 1.28M, False: 110k]
  ------------------
   75|  1.28M|        PJ_CIS_SET(cis, *str);
  ------------------
  |  |   72|  1.28M|#define PJ_CIS_SET(cis,c)   ((cis)->cis_buf[(int)(c)] |= (1 << (cis)->cis_id))
  ------------------
   76|  1.28M|        ++str;
   77|  1.28M|    }
   78|   110k|}
pj_cis_add_cis:
   81|  4.82k|{
   82|  4.82k|    int i;
   83|  1.23M|    for (i=0; i<256; ++i) {
  ------------------
  |  Branch (83:15): [True: 1.23M, False: 4.82k]
  ------------------
   84|  1.23M|        if (PJ_CIS_ISSET(rhs, i))
  ------------------
  |  |   90|  1.23M|#define PJ_CIS_ISSET(cis,c) ((cis)->cis_buf[(int)c] & (1 << (cis)->cis_id))
  |  |  ------------------
  |  |  |  Branch (90:29): [True: 381k, False: 853k]
  |  |  ------------------
  ------------------
   85|   381k|            PJ_CIS_SET(cis, i);
  ------------------
  |  |   72|   381k|#define PJ_CIS_SET(cis,c)   ((cis)->cis_buf[(int)(c)] |= (1 << (cis)->cis_id))
  ------------------
   86|  1.23M|    }
   87|  4.82k|}
pj_cis_del_str:
   98|  28.9k|{
   99|  57.8k|    while (*str) {
  ------------------
  |  Branch (99:12): [True: 28.9k, False: 28.9k]
  ------------------
  100|  28.9k|        PJ_CIS_CLR(cis, *str);
  ------------------
  |  |   81|  28.9k|#define PJ_CIS_CLR(cis,c)   ((cis)->cis_buf[(int)c] &= ~(1 << (cis)->cis_id))
  ------------------
  101|  28.9k|        ++str;
  102|  28.9k|    }
  103|  28.9k|}
pj_cis_invert:
  106|  19.2k|{
  107|  19.2k|    unsigned i;
  108|       |    /* Can not set zero. This is the requirement of the parser. */
  109|  4.93M|    for (i=1; i<256; ++i) {
  ------------------
  |  Branch (109:15): [True: 4.92M, False: 19.2k]
  ------------------
  110|  4.92M|        if (PJ_CIS_ISSET(cis,i))
  ------------------
  |  |   90|  4.92M|#define PJ_CIS_ISSET(cis,c) ((cis)->cis_buf[(int)c] & (1 << (cis)->cis_id))
  |  |  ------------------
  |  |  |  Branch (90:29): [True: 62.7k, False: 4.85M]
  |  |  ------------------
  ------------------
  111|  62.7k|            PJ_CIS_CLR(cis,i);
  ------------------
  |  |   81|  62.7k|#define PJ_CIS_CLR(cis,c)   ((cis)->cis_buf[(int)c] &= ~(1 << (cis)->cis_id))
  ------------------
  112|  4.85M|        else
  113|  4.85M|            PJ_CIS_SET(cis,i);
  ------------------
  |  |   72|  4.85M|#define PJ_CIS_SET(cis,c)   ((cis)->cis_buf[(int)(c)] |= (1 << (cis)->cis_id))
  ------------------
  114|  4.92M|    }
  115|  19.2k|}
pj_scan_init:
  120|  8.57k|{
  121|  8.57k|    PJ_CHECK_STACK();
  122|       |
  123|  8.57k|    scanner->begin = scanner->curptr = bufstart;
  124|  8.57k|    scanner->end = bufstart + buflen;
  125|  8.57k|    scanner->line = 1;
  126|  8.57k|    scanner->start_line = scanner->begin;
  127|  8.57k|    scanner->callback = callback;
  128|  8.57k|    scanner->skip_ws = options;
  129|       |
  130|  8.57k|    if (scanner->skip_ws) 
  ------------------
  |  Branch (130:9): [True: 8.57k, False: 0]
  ------------------
  131|  8.57k|        pj_scan_skip_whitespace(scanner);
  132|  8.57k|}
pj_scan_fini:
  136|  4.82k|{
  137|  4.82k|    PJ_CHECK_STACK();
  138|  4.82k|    PJ_UNUSED_ARG(scanner);
  ------------------
  |  | 1433|  4.82k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  139|  4.82k|}
pj_scan_skip_whitespace:
  142|   120k|{
  143|   120k|    register char *s = scanner->curptr;
  144|       |
  145|   124k|    while (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_SPACE(*s)) {
  ------------------
  |  |   33|   248k|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 123k, False: 656]
  |  |  ------------------
  ------------------
                  while (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_SPACE(*s)) {
  ------------------
  |  |   30|   123k|#define PJ_SCAN_IS_SPACE(c)             ((c)==' ' || (c)=='\t')
  |  |  ------------------
  |  |  |  Branch (30:42): [True: 3.28k, False: 120k]
  |  |  |  Branch (30:54): [True: 210, False: 119k]
  |  |  ------------------
  ------------------
  146|  3.49k|        ++s;
  147|  3.49k|    }
  148|       |
  149|   120k|    if (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_NEWLINE(*s) &&
  ------------------
  |  |   33|   241k|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 119k, False: 656]
  |  |  ------------------
  ------------------
                  if (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_NEWLINE(*s) &&
  ------------------
  |  |   31|   240k|#define PJ_SCAN_IS_NEWLINE(c)           ((c)=='\r' || (c)=='\n')
  |  |  ------------------
  |  |  |  Branch (31:42): [True: 3.80k, False: 116k]
  |  |  |  Branch (31:55): [True: 81.6k, False: 34.4k]
  |  |  ------------------
  ------------------
  150|   120k|        (scanner->skip_ws & PJ_SCAN_AUTOSKIP_NEWLINE))
  ------------------
  |  Branch (150:9): [True: 0, False: 85.4k]
  ------------------
  151|      0|    {
  152|      0|        for (; PJ_SCAN_CHECK_EOF(s); ) {
  ------------------
  |  |   33|      0|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  153|      0|            if (*s == '\r') {
  ------------------
  |  Branch (153:17): [True: 0, False: 0]
  ------------------
  154|      0|                ++s;
  155|      0|                if (!PJ_SCAN_CHECK_EOF(s)) break;
  ------------------
  |  |   33|      0|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  ------------------
  |  Branch (155:21): [True: 0, False: 0]
  ------------------
  156|      0|                if (*s == '\n') ++s;
  ------------------
  |  Branch (156:21): [True: 0, False: 0]
  ------------------
  157|      0|                ++scanner->line;
  158|      0|                scanner->curptr = scanner->start_line = s;
  159|      0|            } else if (*s == '\n') {
  ------------------
  |  Branch (159:24): [True: 0, False: 0]
  ------------------
  160|      0|                ++s;
  161|      0|                ++scanner->line;
  162|      0|                scanner->curptr = scanner->start_line = s;
  163|      0|            } else if (PJ_SCAN_IS_SPACE(*s)) {
  ------------------
  |  |   30|      0|#define PJ_SCAN_IS_SPACE(c)             ((c)==' ' || (c)=='\t')
  |  |  ------------------
  |  |  |  Branch (30:42): [True: 0, False: 0]
  |  |  |  Branch (30:54): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  164|      0|                do {
  165|      0|                    ++s;
  166|      0|                } while (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_SPACE(*s));
  ------------------
  |  |   33|      0|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                              } while (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_SPACE(*s));
  ------------------
  |  |   30|      0|#define PJ_SCAN_IS_SPACE(c)             ((c)==' ' || (c)=='\t')
  |  |  ------------------
  |  |  |  Branch (30:42): [True: 0, False: 0]
  |  |  |  Branch (30:54): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  167|      0|            } else {
  168|      0|                break;
  169|      0|            }
  170|      0|        }
  171|      0|    }
  172|       |
  173|   120k|    if (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_NEWLINE(*s) &&
  ------------------
  |  |   33|   241k|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 119k, False: 656]
  |  |  ------------------
  ------------------
                  if (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_NEWLINE(*s) &&
  ------------------
  |  |   31|   240k|#define PJ_SCAN_IS_NEWLINE(c)           ((c)=='\r' || (c)=='\n')
  |  |  ------------------
  |  |  |  Branch (31:42): [True: 3.80k, False: 116k]
  |  |  |  Branch (31:55): [True: 81.6k, False: 34.4k]
  |  |  ------------------
  ------------------
  174|   120k|        (scanner->skip_ws & PJ_SCAN_AUTOSKIP_WS_HEADER)==
  ------------------
  |  Branch (174:9): [True: 85.4k, False: 0]
  ------------------
  175|  85.4k|         PJ_SCAN_AUTOSKIP_WS_HEADER)
  176|  85.4k|    {
  177|       |        /* Check for header continuation. */
  178|  85.4k|        scanner->curptr = s;
  179|       |
  180|  85.4k|        if (*s == '\r') {
  ------------------
  |  Branch (180:13): [True: 3.80k, False: 81.6k]
  ------------------
  181|  3.80k|            ++s;
  182|  3.80k|        }
  183|  85.4k|        if (PJ_SCAN_CHECK_EOF(s) && *s == '\n') {
  ------------------
  |  |   33|   170k|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 85.4k, False: 45]
  |  |  ------------------
  ------------------
  |  Branch (183:37): [True: 82.6k, False: 2.81k]
  ------------------
  184|  82.6k|            ++s;
  185|  82.6k|        }
  186|  85.4k|        scanner->start_line = s;
  187|       |
  188|  85.4k|        if (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_SPACE(*s)) {
  ------------------
  |  |   33|   170k|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 83.1k, False: 2.31k]
  |  |  ------------------
  ------------------
                      if (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_SPACE(*s)) {
  ------------------
  |  |   30|  83.1k|#define PJ_SCAN_IS_SPACE(c)             ((c)==' ' || (c)=='\t')
  |  |  ------------------
  |  |  |  Branch (30:42): [True: 696, False: 82.4k]
  |  |  |  Branch (30:54): [True: 670, False: 81.7k]
  |  |  ------------------
  ------------------
  189|  1.36k|            register char *t = s;
  190|  1.75k|            do {
  191|  1.75k|                ++t;
  192|  1.75k|            } while (PJ_SCAN_CHECK_EOF(t) && PJ_SCAN_IS_SPACE(*t));
  ------------------
  |  |   33|  3.51k|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 1.73k, False: 22]
  |  |  ------------------
  ------------------
                          } while (PJ_SCAN_CHECK_EOF(t) && PJ_SCAN_IS_SPACE(*t));
  ------------------
  |  |   30|  1.73k|#define PJ_SCAN_IS_SPACE(c)             ((c)==' ' || (c)=='\t')
  |  |  ------------------
  |  |  |  Branch (30:42): [True: 197, False: 1.54k]
  |  |  |  Branch (30:54): [True: 196, False: 1.34k]
  |  |  ------------------
  ------------------
  193|       |
  194|  1.36k|            ++scanner->line;
  195|  1.36k|            scanner->curptr = t;
  196|  1.36k|        }
  197|  85.4k|    } else {
  198|  35.1k|        scanner->curptr = s;
  199|  35.1k|    }
  200|   120k|}
pj_scan_skip_line:
  203|  30.6k|{
  204|  30.6k|    char *s;
  205|       |
  206|  30.6k|    if (pj_scan_is_eof(scanner)) {
  ------------------
  |  Branch (206:9): [True: 0, False: 30.6k]
  ------------------
  207|      0|        return;
  208|      0|    }
  209|       |
  210|  30.6k|    s = pj_memchr(scanner->curptr, '\n', scanner->end - scanner->curptr);
  211|  30.6k|    if (!s) {
  ------------------
  |  Branch (211:9): [True: 346, False: 30.2k]
  ------------------
  212|    346|        scanner->curptr = scanner->end;
  213|  30.2k|    } else {
  214|  30.2k|        scanner->curptr = scanner->start_line = s+1;
  215|  30.2k|        scanner->line++;
  216|  30.2k|   }
  217|  30.6k|}
pj_scan_peek:
  221|  64.4k|{
  222|  64.4k|    register char *s = scanner->curptr;
  223|       |
  224|  64.4k|    if (s >= scanner->end) {
  ------------------
  |  Branch (224:9): [True: 197, False: 64.2k]
  ------------------
  225|    197|        pj_scan_syntax_err(scanner);
  226|    197|        return -1;
  227|    197|    }
  228|       |
  229|   571k|    while (PJ_SCAN_CHECK_EOF(s) && pj_cis_match(spec, *s))
  ------------------
  |  |   33|  1.14M|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 569k, False: 1.83k]
  |  |  ------------------
  ------------------
  |  Branch (229:36): [True: 507k, False: 62.4k]
  ------------------
  230|   507k|        ++s;
  231|       |
  232|  64.2k|    pj_strset3(out, scanner->curptr, s);
  233|  64.2k|    return *s;
  234|  64.4k|}
pj_scan_get:
  273|   163k|{
  274|   163k|    register char *s = scanner->curptr;
  275|       |
  276|   163k|    pj_assert(pj_cis_match(spec,0)==0);
  ------------------
  |  |   48|   163k|#   define pj_assert(expr)   assert(expr)
  ------------------
  277|       |
  278|   163k|    if (pj_scan_is_eof(scanner) || !pj_cis_match(spec, *s)) {
  ------------------
  |  Branch (278:9): [True: 1.15k, False: 162k]
  |  Branch (278:36): [True: 8.45k, False: 153k]
  ------------------
  279|  9.61k|        pj_scan_syntax_err(scanner);
  280|  9.61k|        return;
  281|  9.61k|    }
  282|       |
  283|   747k|    do {
  284|   747k|        ++s;
  285|   747k|    } while (PJ_SCAN_CHECK_EOF(s) && pj_cis_match(spec, *s));
  ------------------
  |  |   33|  1.49M|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 745k, False: 2.05k]
  |  |  ------------------
  ------------------
  |  Branch (285:38): [True: 593k, False: 151k]
  ------------------
  286|       |
  287|   153k|    pj_strset3(out, scanner->curptr, s);
  288|       |
  289|   153k|    scanner->curptr = s;
  290|       |
  291|   153k|    if (!pj_scan_is_eof(scanner) &&
  ------------------
  |  Branch (291:9): [True: 151k, False: 2.05k]
  ------------------
  292|   153k|        PJ_SCAN_IS_PROBABLY_SPACE(*s) && scanner->skip_ws)
  ------------------
  |  |   32|   305k|#define PJ_SCAN_IS_PROBABLY_SPACE(c)    ((c) <= 32)
  |  |  ------------------
  |  |  |  Branch (32:41): [True: 20.5k, False: 131k]
  |  |  ------------------
  ------------------
  |  Branch (292:42): [True: 18.1k, False: 2.35k]
  ------------------
  293|  18.1k|    {
  294|  18.1k|        pj_scan_skip_whitespace(scanner);    
  295|  18.1k|    }
  296|   153k|}
pj_scan_get_quote:
  358|  2.02k|{
  359|  2.02k|    char beg = (char)begin_quote;
  360|  2.02k|    char end = (char)end_quote;
  361|  2.02k|    pj_scan_get_quotes(scanner, &beg, &end, 1, out);
  362|  2.02k|}
pj_scan_get_quotes:
  367|  2.02k|{
  368|  2.02k|    register char *s = scanner->curptr;
  369|  2.02k|    int qpair = -1;
  370|  2.02k|    int i;
  371|       |
  372|  2.02k|    pj_assert(qsize > 0);
  ------------------
  |  |   48|  2.02k|#   define pj_assert(expr)   assert(expr)
  ------------------
  373|       |
  374|       |    /* Check and eat the begin_quote. */
  375|  2.02k|    for (i = 0; i < qsize; ++i) {
  ------------------
  |  Branch (375:17): [True: 2.02k, False: 0]
  ------------------
  376|  2.02k|        if (*s == begin_quote[i]) {
  ------------------
  |  Branch (376:13): [True: 2.02k, False: 0]
  ------------------
  377|  2.02k|            qpair = i;
  378|  2.02k|            break;
  379|  2.02k|        }
  380|  2.02k|    }
  381|  2.02k|    if (qpair == -1) {
  ------------------
  |  Branch (381:9): [True: 0, False: 2.02k]
  ------------------
  382|      0|        pj_scan_syntax_err(scanner);
  383|      0|        return;
  384|      0|    }
  385|  2.02k|    ++s;
  386|       |
  387|       |    /* Loop until end_quote is found. 
  388|       |     */
  389|  2.23k|    do {
  390|       |        /* loop until end_quote is found. */
  391|  30.1k|        while (PJ_SCAN_CHECK_EOF(s) && *s != '\n' && *s != end_quote[qpair]) {
  ------------------
  |  |   33|  60.2k|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 30.0k, False: 61]
  |  |  ------------------
  ------------------
  |  Branch (391:40): [True: 29.8k, False: 210]
  |  Branch (391:54): [True: 27.9k, False: 1.96k]
  ------------------
  392|  27.9k|            ++s;
  393|  27.9k|        }
  394|       |
  395|       |        /* check that no backslash character precedes the end_quote. */
  396|  2.23k|        if (*s == end_quote[qpair]) {
  ------------------
  |  Branch (396:13): [True: 1.96k, False: 271]
  ------------------
  397|  1.96k|            if (*(s-1) == '\\') {
  ------------------
  |  Branch (397:17): [True: 409, False: 1.55k]
  ------------------
  398|    409|                char *q = s-2;
  399|    409|                char *r = s-2;
  400|       |
  401|    979|                while (r != scanner->begin && *r == '\\') {
  ------------------
  |  Branch (401:24): [True: 979, False: 0]
  |  Branch (401:47): [True: 570, False: 409]
  ------------------
  402|    570|                    --r;
  403|    570|                }
  404|       |                /* break from main loop if we have odd number of backslashes */
  405|    409|                if (((unsigned)(q-r) & 0x01) == 1) {
  ------------------
  |  Branch (405:21): [True: 200, False: 209]
  ------------------
  406|    200|                    break;
  407|    200|                }
  408|    209|                ++s;
  409|  1.55k|            } else {
  410|       |                /* end_quote is not preceeded by backslash. break now. */
  411|  1.55k|                break;
  412|  1.55k|            }
  413|  1.96k|        } else {
  414|       |            /* loop ended by non-end_quote character. break now. */
  415|    271|            break;
  416|    271|        }
  417|  2.23k|    } while (1);
  ------------------
  |  Branch (417:14): [Folded - Ignored]
  ------------------
  418|       |
  419|       |    /* Check and eat the end quote. */
  420|  2.02k|    if (*s != end_quote[qpair]) {
  ------------------
  |  Branch (420:9): [True: 271, False: 1.75k]
  ------------------
  421|    271|        pj_scan_syntax_err(scanner);
  422|    271|        return;
  423|    271|    }
  424|  1.75k|    ++s;
  425|       |
  426|  1.75k|    pj_strset3(out, scanner->curptr, s);
  427|       |
  428|  1.75k|    scanner->curptr = s;
  429|       |
  430|  1.75k|    if (!pj_scan_is_eof(scanner) &&
  ------------------
  |  Branch (430:9): [True: 1.70k, False: 50]
  ------------------
  431|  1.75k|        PJ_SCAN_IS_PROBABLY_SPACE(*s) && scanner->skip_ws)
  ------------------
  |  |   32|  3.45k|#define PJ_SCAN_IS_PROBABLY_SPACE(c)    ((c) <= 32)
  |  |  ------------------
  |  |  |  Branch (32:41): [True: 619, False: 1.08k]
  |  |  ------------------
  ------------------
  |  Branch (431:42): [True: 390, False: 229]
  ------------------
  432|    390|    {
  433|    390|        pj_scan_skip_whitespace(scanner);
  434|    390|    }
  435|  1.75k|}
pj_scan_get_n:
  440|  7.36k|{
  441|  7.36k|    if (scanner->curptr + N > scanner->end) {
  ------------------
  |  Branch (441:9): [True: 201, False: 7.16k]
  ------------------
  442|    201|        pj_scan_syntax_err(scanner);
  443|    201|        return;
  444|    201|    }
  445|       |
  446|  7.16k|    pj_strset(out, scanner->curptr, N);
  447|       |    
  448|  7.16k|    scanner->curptr += N;
  449|       |
  450|  7.16k|    if (!pj_scan_is_eof(scanner) &&
  ------------------
  |  Branch (450:9): [True: 6.89k, False: 274]
  ------------------
  451|  7.16k|        PJ_SCAN_IS_PROBABLY_SPACE(*scanner->curptr) && scanner->skip_ws)
  ------------------
  |  |   32|  14.0k|#define PJ_SCAN_IS_PROBABLY_SPACE(c)    ((c) <= 32)
  |  |  ------------------
  |  |  |  Branch (32:41): [True: 917, False: 5.97k]
  |  |  ------------------
  ------------------
  |  Branch (451:56): [True: 917, False: 0]
  ------------------
  452|    917|    {
  453|    917|        pj_scan_skip_whitespace(scanner);
  454|    917|    }
  455|  7.16k|}
pj_scan_get_char:
  459|   150k|{
  460|   150k|    register char *s = scanner->curptr;
  461|   150k|    int chr;
  462|       |
  463|   150k|    if (s >= scanner->end || !*s) {
  ------------------
  |  Branch (463:9): [True: 251, False: 150k]
  |  Branch (463:30): [True: 243, False: 150k]
  ------------------
  464|    494|        pj_scan_syntax_err(scanner);
  465|    494|        return 0;
  466|    494|    }
  467|       |
  468|   150k|    chr = *s;
  469|       |
  470|   150k|    ++s;
  471|   150k|    scanner->curptr = s;
  472|   150k|    if (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_PROBABLY_SPACE(*s) &&
  ------------------
  |  |   33|   300k|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 148k, False: 1.77k]
  |  |  ------------------
  ------------------
                  if (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_PROBABLY_SPACE(*s) &&
  ------------------
  |  |   32|   298k|#define PJ_SCAN_IS_PROBABLY_SPACE(c)    ((c) <= 32)
  |  |  ------------------
  |  |  |  Branch (32:41): [True: 46.3k, False: 102k]
  |  |  ------------------
  ------------------
  473|   150k|        scanner->skip_ws)
  ------------------
  |  Branch (473:9): [True: 44.9k, False: 1.37k]
  ------------------
  474|  44.9k|    {
  475|  44.9k|        pj_scan_skip_whitespace(scanner);
  476|  44.9k|    }
  477|   150k|    return chr;
  478|   150k|}
pj_scan_get_newline:
  482|  37.2k|{
  483|  37.2k|    if (pj_scan_is_eof(scanner) || !PJ_SCAN_IS_NEWLINE(*scanner->curptr)) {
  ------------------
  |  |   31|  37.2k|#define PJ_SCAN_IS_NEWLINE(c)           ((c)=='\r' || (c)=='\n')
  |  |  ------------------
  |  |  |  Branch (31:42): [True: 2.82k, False: 34.4k]
  |  |  |  Branch (31:55): [True: 33.8k, False: 602]
  |  |  ------------------
  ------------------
  |  Branch (483:9): [True: 8, False: 37.2k]
  ------------------
  484|    610|        pj_scan_syntax_err(scanner);
  485|    610|        return;
  486|    610|    }
  487|       |
  488|       |    /* We have checked scanner->curptr validity above */
  489|  36.6k|    if (*scanner->curptr == '\r') {
  ------------------
  |  Branch (489:9): [True: 2.82k, False: 33.8k]
  ------------------
  490|  2.82k|        ++scanner->curptr;
  491|  2.82k|    }
  492|  36.6k|    if (!pj_scan_is_eof(scanner) && *scanner->curptr == '\n') {
  ------------------
  |  Branch (492:9): [True: 36.5k, False: 40]
  |  Branch (492:37): [True: 33.9k, False: 2.59k]
  ------------------
  493|  33.9k|        ++scanner->curptr;
  494|  33.9k|    }
  495|       |
  496|  36.6k|    ++scanner->line;
  497|  36.6k|    scanner->start_line = scanner->curptr;
  498|       |
  499|       |    /**
  500|       |     * This probably is a bug, see PROTOS test #2480.
  501|       |     * This would cause scanner to incorrectly eat two new lines, e.g.
  502|       |     * when parsing:
  503|       |     *   
  504|       |     *  Content-Length: 120\r\n
  505|       |     *  \r\n
  506|       |     *  <space><space><space>...
  507|       |     *
  508|       |     * When pj_scan_get_newline() is called to parse the first newline
  509|       |     * in the Content-Length header, it will eat the second newline
  510|       |     * too because it thinks that it's a header continuation.
  511|       |     *
  512|       |     * if (PJ_SCAN_IS_PROBABLY_SPACE(*scanner->curptr) && scanner->skip_ws) {
  513|       |     *    pj_scan_skip_whitespace(scanner);
  514|       |     * }
  515|       |     */
  516|  36.6k|}
pj_scan_get_until_ch:
  547|  1.14k|{
  548|  1.14k|    register char *s = scanner->curptr;
  549|       |
  550|  1.14k|    if (s >= scanner->end) {
  ------------------
  |  Branch (550:9): [True: 24, False: 1.12k]
  ------------------
  551|     24|        pj_scan_syntax_err(scanner);
  552|     24|        return;
  553|     24|    }
  554|       |
  555|  11.0k|    while (PJ_SCAN_CHECK_EOF(s) && *s != until_char) {
  ------------------
  |  |   33|  22.0k|#define PJ_SCAN_CHECK_EOF(s)            (s != scanner->end)
  |  |  ------------------
  |  |  |  Branch (33:41): [True: 10.8k, False: 214]
  |  |  ------------------
  ------------------
  |  Branch (555:36): [True: 9.92k, False: 908]
  ------------------
  556|  9.92k|        ++s;
  557|  9.92k|    }
  558|       |
  559|  1.12k|    pj_strset3(out, scanner->curptr, s);
  560|       |
  561|  1.12k|    scanner->curptr = s;
  562|       |
  563|  1.12k|    if (!pj_scan_is_eof(scanner) && PJ_SCAN_IS_PROBABLY_SPACE(*s) &&
  ------------------
  |  |   32|  2.03k|#define PJ_SCAN_IS_PROBABLY_SPACE(c)    ((c) <= 32)
  |  |  ------------------
  |  |  |  Branch (32:41): [True: 0, False: 908]
  |  |  ------------------
  ------------------
  |  Branch (563:9): [True: 908, False: 214]
  ------------------
  564|  1.12k|        scanner->skip_ws)
  ------------------
  |  Branch (564:9): [True: 0, False: 0]
  ------------------
  565|      0|    {
  566|      0|        pj_scan_skip_whitespace(scanner);
  567|      0|    }
  568|  1.12k|}
scanner.c:pj_scan_syntax_err:
   45|  11.4k|{
   46|  11.4k|    (*scanner->callback)(scanner);
   47|  11.4k|}

pj_cis_buf_init:
   26|  9.64k|{
   27|  9.64k|    pj_bzero(cis_buf->cis_buf, sizeof(cis_buf->cis_buf));
   28|  9.64k|    cis_buf->use_mask = 0;
   29|  9.64k|}
pj_cis_init:
   32|   154k|{
   33|   154k|    unsigned i;
   34|       |
   35|   154k|    cis->cis_buf = cis_buf->cis_buf;
   36|       |
   37|  1.48M|    for (i=0; i<PJ_CIS_MAX_INDEX; ++i) {
  ------------------
  |  |   44|  1.48M|#define PJ_CIS_MAX_INDEX   (sizeof(pj_cis_elem_t) << 3)
  ------------------
  |  Branch (37:15): [True: 1.48M, False: 0]
  ------------------
   38|  1.48M|        if ((cis_buf->use_mask & (1 << i)) == 0) {
  ------------------
  |  Branch (38:13): [True: 154k, False: 1.33M]
  ------------------
   39|   154k|            cis->cis_id = i;
   40|   154k|            cis_buf->use_mask |= (1 << i);
   41|   154k|            return PJ_SUCCESS;
   42|   154k|        }
   43|  1.48M|    }
   44|       |
   45|      0|    cis->cis_id = PJ_CIS_MAX_INDEX;
  ------------------
  |  |   44|      0|#define PJ_CIS_MAX_INDEX   (sizeof(pj_cis_elem_t) << 3)
  ------------------
   46|      0|    return PJ_ETOOMANY;
  ------------------
  |  |  363|      0|#define PJ_ETOOMANY         (PJ_ERRNO_START_STATUS + 10)/* 70010 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   47|   154k|}
pj_cis_dup:
   50|  86.8k|{
   51|  86.8k|    pj_status_t status;
   52|  86.8k|    unsigned i;
   53|       |
   54|       |    /* Warning: typecasting here! */
   55|  86.8k|    status = pj_cis_init((pj_cis_buf_t*)existing->cis_buf, new_cis);
   56|  86.8k|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (56:9): [True: 0, False: 86.8k]
  ------------------
   57|      0|        return status;
   58|       |
   59|  22.3M|    for (i=0; i<256; ++i) {
  ------------------
  |  Branch (59:15): [True: 22.2M, False: 86.8k]
  ------------------
   60|  22.2M|        if (PJ_CIS_ISSET(existing, i))
  ------------------
  |  |   90|  22.2M|#define PJ_CIS_ISSET(cis,c) ((cis)->cis_buf[(int)c] & (1 << (cis)->cis_id))
  |  |  ------------------
  |  |  |  Branch (90:29): [True: 5.94M, False: 16.2M]
  |  |  ------------------
  ------------------
   61|  5.94M|            PJ_CIS_SET(new_cis, i);
  ------------------
  |  |   72|  5.94M|#define PJ_CIS_SET(cis,c)   ((cis)->cis_buf[(int)(c)] |= (1 << (cis)->cis_id))
  ------------------
   62|  16.2M|        else
   63|  16.2M|            PJ_CIS_CLR(new_cis, i);
  ------------------
  |  |   81|  16.2M|#define PJ_CIS_CLR(cis,c)   ((cis)->cis_buf[(int)c] &= ~(1 << (cis)->cis_id))
  ------------------
   64|  22.2M|    }
   65|       |
   66|  86.8k|    return PJ_SUCCESS;
   67|  86.8k|}

pj_str_unescape:
   25|  12.2k|{
   26|  12.2k|    char *src = src_str->ptr;
   27|  12.2k|    char *end = src + src_str->slen;
   28|  12.2k|    pj_str_t dst_str;
   29|  12.2k|    char *dst;
   30|       |    
   31|  12.2k|    if (pj_strchr(src_str, '%')==NULL)
  ------------------
  |  Branch (31:9): [True: 11.2k, False: 1.01k]
  ------------------
   32|  11.2k|        return *src_str;
   33|       |
   34|  1.01k|    dst = dst_str.ptr = (char*) pj_pool_alloc(pool, src_str->slen);
   35|       |
   36|   101k|    while (src != end) {
  ------------------
  |  Branch (36:12): [True: 100k, False: 1.01k]
  ------------------
   37|   100k|        if (*src == '%' && src < end-2 && pj_isxdigit(*(src+1)) && 
  ------------------
  |  Branch (37:13): [True: 3.78k, False: 96.8k]
  |  Branch (37:28): [True: 2.85k, False: 935]
  |  Branch (37:43): [True: 2.31k, False: 536]
  ------------------
   38|   100k|            pj_isxdigit(*(src+2))) 
  ------------------
  |  Branch (38:13): [True: 2.09k, False: 222]
  ------------------
   39|  2.09k|        {
   40|  2.09k|            *dst = (pj_uint8_t) ((pj_hex_digit_to_val(*(src+1)) << 4) + 
   41|  2.09k|                                 pj_hex_digit_to_val(*(src+2)));
   42|  2.09k|            ++dst;
   43|  2.09k|            src += 3;
   44|  98.5k|        } else {
   45|  98.5k|            *dst++ = *src++;
   46|  98.5k|        }
   47|   100k|    }
   48|  1.01k|    dst_str.slen = dst - dst_str.ptr;
   49|  1.01k|    return dst_str;
   50|  12.2k|}

sip_parser.c:pj_tolower:
  118|  1.03M|PJ_INLINE(int) pj_tolower(unsigned char c) { return tolower(c); }
sip_multipart.c:pj_isspace:
   83|  33.3k|PJ_INLINE(int) pj_isspace(unsigned char c) { return isspace(c); }
string.c:pj_isxdigit:
  134|  5.16k|PJ_INLINE(int) pj_isxdigit(unsigned char c){ return isxdigit(c); }
string.c:pj_hex_digit_to_val:
  160|  4.18k|{
  161|  4.18k|    if (c <= '9')
  ------------------
  |  Branch (161:9): [True: 1.93k, False: 2.25k]
  ------------------
  162|  1.93k|        return (c-'0') & 0x0F;
  163|  2.25k|    else if (c <= 'F')
  ------------------
  |  Branch (163:14): [True: 444, False: 1.81k]
  ------------------
  164|    444|        return  (c-'A'+10) & 0x0F;
  165|  1.81k|    else
  166|  1.81k|        return (c-'a'+10) & 0x0F;
  167|  4.18k|}
string.c:pj_isdigit:
   74|  4.51k|PJ_INLINE(int) pj_isdigit(unsigned char c) { return isdigit(c); }
string.c:pj_isspace:
   83|  23.4k|PJ_INLINE(int) pj_isspace(unsigned char c) { return isspace(c); }
hash.c:pj_tolower:
  118|  43.3k|PJ_INLINE(int) pj_tolower(unsigned char c) { return tolower(c); }

fuzz-sip.c:pj_list_init:
   88|  4.82k|{
   89|  4.82k|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|  4.82k|}
sip_parser.c:pj_list_push_back:
  125|  5.34k|{
  126|  5.34k|    pj_list_insert_before(list, node);
  127|  5.34k|}
sip_uri.c:pj_list_init:
   88|  9.98k|{
   89|  9.98k|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|  9.98k|}
sip_endpoint.c:pj_list_init:
   88|  19.2k|{
   89|  19.2k|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|  19.2k|}
sip_transport.c:pj_list_init:
   88|  91.6k|{
   89|  91.6k|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|  91.6k|}
sip_transport.c:pj_list_empty:
  102|  9.64k|{
  103|  9.64k|    return ((pj_list*)node)->next == node;
  104|  9.64k|}
sip_transport.c:pj_list_push_back:
  125|  82.0k|{
  126|  82.0k|    pj_list_insert_before(list, node);
  127|  82.0k|}
sip_transport_loop.c:pj_list_empty:
  102|  11.9k|{
  103|  11.9k|    return ((pj_list*)node)->next == node;
  104|  11.9k|}
sip_transport_loop.c:pj_list_init:
   88|  19.2k|{
   89|  19.2k|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|  19.2k|}
sip_multipart.c:pj_list_init:
   88|  8.98k|{
   89|  8.98k|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|  8.98k|}
sip_multipart.c:pj_list_push_back:
  125|  8.98k|{
  126|  8.98k|    pj_list_insert_before(list, node);
  127|  8.98k|}
sip_msg.c:pj_list_init:
   88|   109k|{
   89|   109k|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|   109k|}
sip_tel_uri.c:pj_list_init:
   88|  1.42k|{
   89|  1.42k|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|  1.42k|}
ioqueue_select.c:pj_list_init:
   88|  14.4k|{
   89|  14.4k|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|  14.4k|}
ioqueue_select.c:pj_list_push_back:
  125|   308k|{
  126|   308k|    pj_list_insert_before(list, node);
  127|   308k|}
list.c:pj_list_init:
   88|   152k|{
   89|   152k|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|   152k|}
lock.c:pj_list_init:
   88|  9.64k|{
   89|  9.64k|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|  9.64k|}
lock.c:pj_list_push_back:
  125|  4.82k|{
  126|  4.82k|    pj_list_insert_before(list, node);
  127|  4.82k|}
pool.c:pj_list_init:
   88|  33.7k|{
   89|  33.7k|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|  33.7k|}
pool_caching.c:pj_list_init:
   88|  82.0k|{
   89|  82.0k|    ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
   90|  82.0k|}
pool_caching.c:pj_list_empty:
  102|  28.9k|{
  103|  28.9k|    return ((pj_list*)node)->next == node;
  104|  28.9k|}

pj_list_insert_after:
   29|   640k|{
   30|   640k|    ((pj_list*)node)->prev = pos;
   31|   640k|    ((pj_list*)node)->next = ((pj_list*)pos)->next;
   32|   640k|    ((pj_list*) ((pj_list*)pos)->next) ->prev = node;
   33|   640k|    ((pj_list*)pos)->next = node;
   34|   640k|}
pj_list_insert_before:
   38|   508k|{
   39|   508k|    pj_list_insert_after(((pj_list*)pos)->prev, node);
   40|   508k|}
pj_list_insert_nodes_after:
   44|  35.4k|{
   45|  35.4k|    pj_list *lst_last = (pj_list *) ((pj_list*)lst)->prev;
   46|  35.4k|    pj_list *pos_next = (pj_list *) ((pj_list*)pos)->next;
   47|       |
   48|  35.4k|    pj_link_node(pos, lst);
   49|  35.4k|    pj_link_node(lst_last, pos_next);
   50|  35.4k|}
pj_list_insert_nodes_before:
   53|  35.4k|{
   54|  35.4k|    pj_list_insert_nodes_after(((pj_list*)pos)->prev, lst);
   55|  35.4k|}
pj_list_erase:
   93|   152k|{
   94|   152k|    pj_link_node( ((pj_list*)node)->prev, ((pj_list*)node)->next);
   95|       |
   96|       |    /* It'll be safer to init the next/prev fields to itself, to
   97|       |     * prevent multiple erase() from corrupting the list. See
   98|       |     * ticket #520 for one sample bug.
   99|       |     */
  100|   152k|    pj_list_init(node);
  101|   152k|}
pj_list_find_node:
  105|  28.9k|{
  106|  28.9k|    pj_list *p = (pj_list *) ((pj_list*)list)->next;
  107|  57.8k|    while (p != list && p != node)
  ------------------
  |  Branch (107:12): [True: 28.9k, False: 28.9k]
  |  Branch (107:25): [True: 28.9k, False: 0]
  ------------------
  108|  28.9k|        p = (pj_list *) p->next;
  109|       |
  110|  28.9k|    return p==node ? p : NULL;
  ------------------
  |  Branch (110:12): [True: 0, False: 28.9k]
  ------------------
  111|  28.9k|}
pj_list_search:
  116|  28.9k|{
  117|  28.9k|    pj_list *p = (pj_list *) ((pj_list*)list)->next;
  118|  57.8k|    while (p != list && (*comp)(value, p) != 0)
  ------------------
  |  Branch (118:12): [True: 28.9k, False: 28.9k]
  |  Branch (118:25): [True: 28.9k, False: 0]
  ------------------
  119|  28.9k|        p = (pj_list *) p->next;
  120|       |
  121|  28.9k|    return p==list ? NULL : p;
  ------------------
  |  Branch (121:12): [True: 28.9k, False: 0]
  ------------------
  122|  28.9k|}
list.c:pj_link_node:
   23|   222k|{
   24|   222k|    ((pj_list*)prev)->next = next;
   25|   222k|    ((pj_list*)next)->prev = prev;
   26|   222k|}

sip_uri.c:pj_pool_zalloc:
  489|  6.61k|{
  490|  6.61k|    return pj_pool_calloc(pool, 1, size);
  491|  6.61k|}
sip_endpoint.c:pj_pool_zalloc:
  489|  4.82k|{
  490|  4.82k|    return pj_pool_calloc(pool, 1, size);
  491|  4.82k|}
sip_resolve.c:pj_pool_zalloc:
  489|  4.82k|{
  490|  4.82k|    return pj_pool_calloc(pool, 1, size);
  491|  4.82k|}
sip_transport.c:pj_pool_zalloc:
  489|  82.0k|{
  490|  82.0k|    return pj_pool_calloc(pool, 1, size);
  491|  82.0k|}
sip_transport_loop.c:pj_pool_zalloc:
  489|  4.82k|{
  490|  4.82k|    return pj_pool_calloc(pool, 1, size);
  491|  4.82k|}
sip_multipart.c:pj_pool_zalloc:
  489|  17.9k|{
  490|  17.9k|    return pj_pool_calloc(pool, 1, size);
  491|  17.9k|}
sip_tel_uri.c:pj_pool_zalloc:
  489|  1.42k|{
  490|  1.42k|    return pj_pool_calloc(pool, 1, size);
  491|  1.42k|}
os_core_unix.c:pj_pool_zalloc:
  489|  19.2k|{
  490|  19.2k|    return pj_pool_calloc(pool, 1, size);
  491|  19.2k|}
lock.c:pj_pool_zalloc:
  489|  9.64k|{
  490|  9.64k|    return pj_pool_calloc(pool, 1, size);
  491|  9.64k|}
timer.c:pj_pool_zalloc:
  489|  4.82k|{
  490|  4.82k|    return pj_pool_calloc(pool, 1, size);
  491|  4.82k|}

pj_pool_get_capacity:
   25|  53.0k|{
   26|  53.0k|    return pool->capacity;
   27|  53.0k|}
pj_pool_alloc_from_block:
   41|  2.20M|{
   42|       |    /* The operation below is valid for size==0. 
   43|       |     * When size==0, the function will return the pointer to the pool
   44|       |     * memory address, but no memory will be allocated.
   45|       |     */
   46|  2.20M|    if (size & (PJ_POOL_ALIGNMENT-1)) {
  ------------------
  |  |  182|  2.20M|#define PJ_POOL_ALIGNMENT 8
  ------------------
  |  Branch (46:9): [True: 24.9k, False: 2.17M]
  ------------------
   47|  24.9k|        size = (size + PJ_POOL_ALIGNMENT) & ~(PJ_POOL_ALIGNMENT-1);
  ------------------
  |  |  182|  24.9k|#define PJ_POOL_ALIGNMENT 8
  ------------------
                      size = (size + PJ_POOL_ALIGNMENT) & ~(PJ_POOL_ALIGNMENT-1);
  ------------------
  |  |  182|  24.9k|#define PJ_POOL_ALIGNMENT 8
  ------------------
   48|  24.9k|    }
   49|  2.20M|    if ((pj_size_t)(block->end - block->cur) >= size) {
  ------------------
  |  Branch (49:9): [True: 1.39M, False: 804k]
  ------------------
   50|  1.39M|        void *ptr = block->cur;
   51|  1.39M|        block->cur += size;
   52|  1.39M|        return ptr;
   53|  1.39M|    }
   54|   804k|    return NULL;
   55|  2.20M|}
pj_pool_alloc:
   58|  1.39M|{
   59|  1.39M|    void *ptr = pj_pool_alloc_from_block(pool->block_list.next, size);
   60|  1.39M|    if (!ptr)
  ------------------
  |  Branch (60:9): [True: 267k, False: 1.12M]
  ------------------
   61|   267k|        ptr = pj_pool_allocate_find(pool, size);
   62|  1.39M|    return ptr;
   63|  1.39M|}
pj_pool_calloc:
   67|   175k|{
   68|   175k|    void *buf = pj_pool_alloc( pool, size*count);
   69|   175k|    if (buf)
  ------------------
  |  Branch (69:9): [True: 175k, False: 0]
  ------------------
   70|   175k|        pj_bzero(buf, size * count);
   71|   175k|    return buf;
   72|   175k|}
pj_pool_create:
   84|  28.9k|{
   85|  28.9k|    return (*f->create_pool)(f, name, initial_size, increment_size, callback);
   86|  28.9k|}
pj_pool_release:
   89|  28.9k|{
   90|       |#if PJ_POOL_RELEASE_WIPE_DATA
   91|       |    pj_pool_block *b;
   92|       |
   93|       |    b = pool->block_list.next;
   94|       |    while (b != &pool->block_list) {
   95|       |        volatile unsigned char *p = b->buf;
   96|       |        while (p < b->end) *p++ = 0;
   97|       |        b = b->next;
   98|       |    }
   99|       |#endif
  100|       |
  101|  28.9k|    if (pool->factory->release_pool)
  ------------------
  |  Branch (101:9): [True: 28.9k, False: 0]
  ------------------
  102|  28.9k|        (*pool->factory->release_pool)(pool->factory, pool);
  103|  28.9k|}

sip_parser.c:pj_memcpy:
  853|   523k|{
  854|   523k|    return memcpy(dst, src, size);
  855|   523k|}
sip_parser.c:pj_memchr:
  896|  3.92k|{
  897|  3.92k|    return (void*)memchr((void*)buf, c, size);
  898|  3.92k|}
sip_parser.c:pj_bzero:
  820|  13.3k|{
  821|       |#if defined(PJ_HAS_BZERO) && PJ_HAS_BZERO!=0
  822|       |    bzero(dst, size);
  823|       |#else
  824|  13.3k|    memset(dst, 0, size);
  825|  13.3k|#endif
  826|  13.3k|}
sip_parser.c:pj_memcmp:
  881|  58.3k|{
  882|  58.3k|    return memcmp(buf1, buf2, size);
  883|  58.3k|}
sip_parser.c:pj_memmove:
  867|   246k|{
  868|   246k|    return memmove(dst, src, size);
  869|   246k|}
sip_uri.c:pj_bzero:
  820|  4.27k|{
  821|       |#if defined(PJ_HAS_BZERO) && PJ_HAS_BZERO!=0
  822|       |    bzero(dst, size);
  823|       |#else
  824|  4.27k|    memset(dst, 0, size);
  825|  4.27k|#endif
  826|  4.27k|}
sip_endpoint.c:pj_cstr:
  101|  4.82k|{
  102|  4.82k|    str->ptr = (char*)s;
  103|  4.82k|    str->slen = s ? (pj_ssize_t)strlen(s) : 0;
  ------------------
  |  Branch (103:17): [True: 4.82k, False: 0]
  ------------------
  104|  4.82k|    return str;
  105|  4.82k|}
sip_transport.c:pj_bzero:
  820|  4.82k|{
  821|       |#if defined(PJ_HAS_BZERO) && PJ_HAS_BZERO!=0
  822|       |    bzero(dst, size);
  823|       |#else
  824|  4.82k|    memset(dst, 0, size);
  825|  4.82k|#endif
  826|  4.82k|}
sip_multipart.c:pj_memcpy:
  853|    796|{
  854|    796|    return memcpy(dst, src, size);
  855|    796|}
sip_multipart.c:pj_strset:
  117|    768|{
  118|    768|    str->ptr = ptr;
  119|    768|    str->slen = (pj_ssize_t)length;
  120|    768|    return str;
  121|    768|}
sip_msg.c:pj_memcmp:
  881|  11.8k|{
  882|  11.8k|    return memcmp(buf1, buf2, size);
  883|  11.8k|}
sip_msg.c:pj_bzero:
  820|  38.8k|{
  821|       |#if defined(PJ_HAS_BZERO) && PJ_HAS_BZERO!=0
  822|       |    bzero(dst, size);
  823|       |#else
  824|  38.8k|    memset(dst, 0, size);
  825|  38.8k|#endif
  826|  38.8k|}
scanner.c:pj_bzero:
  820|  9.64k|{
  821|       |#if defined(PJ_HAS_BZERO) && PJ_HAS_BZERO!=0
  822|       |    bzero(dst, size);
  823|       |#else
  824|  9.64k|    memset(dst, 0, size);
  825|  9.64k|#endif
  826|  9.64k|}
scanner.c:pj_memchr:
  896|  30.6k|{
  897|  30.6k|    return (void*)memchr((void*)buf, c, size);
  898|  30.6k|}
scanner.c:pj_strset3:
  149|   221k|{
  150|   221k|    str->ptr = begin;
  151|   221k|    str->slen = (pj_ssize_t)(end-begin);
  152|   221k|    return str;
  153|   221k|}
scanner.c:pj_strset:
  117|  7.16k|{
  118|  7.16k|    str->ptr = ptr;
  119|  7.16k|    str->slen = (pj_ssize_t)length;
  120|  7.16k|    return str;
  121|  7.16k|}
string.c:pj_strchr:
  481|  12.2k|{
  482|  12.2k|    if (str->slen == 0)
  ------------------
  |  Branch (482:9): [True: 0, False: 12.2k]
  ------------------
  483|      0|        return NULL;
  484|  12.2k|    return (char*) memchr((char*)str->ptr, chr, str->slen);
  485|  12.2k|}
string.c:pj_memcpy:
  853|  14.6k|{
  854|  14.6k|    return memcpy(dst, src, size);
  855|  14.6k|}
ioqueue_select.c:pj_bzero:
  820|  4.82k|{
  821|       |#if defined(PJ_HAS_BZERO) && PJ_HAS_BZERO!=0
  822|       |    bzero(dst, size);
  823|       |#else
  824|  4.82k|    memset(dst, 0, size);
  825|  4.82k|#endif
  826|  4.82k|}
os_core_unix.c:pj_bzero:
  820|      1|{
  821|       |#if defined(PJ_HAS_BZERO) && PJ_HAS_BZERO!=0
  822|       |    bzero(dst, size);
  823|       |#else
  824|      1|    memset(dst, 0, size);
  825|      1|#endif
  826|      1|}
os_core_unix.c:pj_strlen:
  282|      1|{
  283|      1|    return str->slen;
  284|      1|}
hash.c:pj_memcmp:
  881|  9.64k|{
  882|  9.64k|    return memcmp(buf1, buf2, size);
  883|  9.64k|}
lock.c:pj_memcpy:
  853|   337k|{
  854|   337k|    return memcpy(dst, src, size);
  855|   337k|}
pool.c:pj_bzero:
  820|   209k|{
  821|       |#if defined(PJ_HAS_BZERO) && PJ_HAS_BZERO!=0
  822|       |    bzero(dst, size);
  823|       |#else
  824|   209k|    memset(dst, 0, size);
  825|   209k|#endif
  826|   209k|}
pool_caching.c:pj_bzero:
  820|  4.82k|{
  821|       |#if defined(PJ_HAS_BZERO) && PJ_HAS_BZERO!=0
  822|       |    bzero(dst, size);
  823|       |#else
  824|  4.82k|    memset(dst, 0, size);
  825|  4.82k|#endif
  826|  4.82k|}
pool_caching.c:pj_memcpy:
  853|  4.82k|{
  854|  4.82k|    return memcpy(dst, src, size);
  855|  4.82k|}

pj_str:
   24|  35.9k|{
   25|  35.9k|    pj_str_t dst;
   26|  35.9k|    dst.ptr = str;
   27|  35.9k|    dst.slen = str ? pj_ansi_strlen(str) : 0;
  ------------------
  |  |   69|  35.9k|#define pj_ansi_strlen          strlen
  ------------------
  |  Branch (27:16): [True: 35.9k, False: 0]
  ------------------
   28|  35.9k|    return dst;
   29|  35.9k|}
pj_strdup:
   34|  12.1k|{
   35|  12.1k|    pj_assert(src->slen >= 0);
  ------------------
  |  |   48|  12.1k|#   define pj_assert(expr)   assert(expr)
  ------------------
   36|       |
   37|       |    /* Without this, destination will be corrupted */
   38|  12.1k|    if (dst == src)
  ------------------
  |  Branch (38:9): [True: 0, False: 12.1k]
  ------------------
   39|      0|        return dst;
   40|       |
   41|  12.1k|    if (src->slen > 0) {
  ------------------
  |  Branch (41:9): [True: 8.37k, False: 3.77k]
  ------------------
   42|  8.37k|        dst->ptr = (char*)pj_pool_alloc(pool, src->slen);
   43|  8.37k|        pj_memcpy(dst->ptr, src->ptr, src->slen);
   44|  8.37k|    }
   45|  12.1k|    dst->slen = (src->slen < 0)? 0: src->slen;
  ------------------
  |  Branch (45:17): [True: 0, False: 12.1k]
  ------------------
   46|  12.1k|    return dst;
   47|  12.1k|}
pj_strdup_with_null:
   52|  4.82k|{
   53|  4.82k|    pj_ssize_t src_slen = src->slen;
   54|       |
   55|  4.82k|    pj_assert(src->slen >= 0);
  ------------------
  |  |   48|  4.82k|#   define pj_assert(expr)   assert(expr)
  ------------------
   56|       |
   57|       |    /* Check if the source's length is invalid */
   58|  4.82k|    if (src_slen < 0)
  ------------------
  |  Branch (58:9): [True: 0, False: 4.82k]
  ------------------
   59|      0|        src_slen = 0;
   60|       |
   61|  4.82k|    dst->ptr = (char*)pj_pool_alloc(pool, src_slen+1);
   62|  4.82k|    if (src_slen) {
  ------------------
  |  Branch (62:9): [True: 4.82k, False: 0]
  ------------------
   63|  4.82k|        pj_memcpy(dst->ptr, src->ptr, src_slen);
   64|  4.82k|    }
   65|  4.82k|    dst->slen = src_slen;
   66|  4.82k|    dst->ptr[dst->slen] = '\0';
   67|  4.82k|    return dst;
   68|  4.82k|}
pj_strcpy:
  112|    500|{
  113|    500|    pj_assert(src->slen >= 0);
  ------------------
  |  |   48|    500|#   define pj_assert(expr)   assert(expr)
  ------------------
  114|       |
  115|    500|    dst->slen = (src->slen < 0)? 0: src->slen;
  ------------------
  |  Branch (115:17): [True: 0, False: 500]
  ------------------
  116|    500|    if (src->slen > 0)
  ------------------
  |  Branch (116:9): [True: 500, False: 0]
  ------------------
  117|    500|        pj_memcpy(dst->ptr, src->ptr, src->slen);
  118|    500|    return dst;
  119|    500|}
pj_stricmp:
  236|   100k|{
  237|   100k|    pj_assert(str1->slen >= 0);
  ------------------
  |  |   48|   100k|#   define pj_assert(expr)   assert(expr)
  ------------------
  238|   100k|    pj_assert(str2->slen >= 0);
  ------------------
  |  |   48|   100k|#   define pj_assert(expr)   assert(expr)
  ------------------
  239|       |
  240|   100k|    if (str1->slen <= 0) {
  ------------------
  |  Branch (240:9): [True: 1, False: 100k]
  ------------------
  241|      1|        return str2->slen<=0 ? 0 : -1;
  ------------------
  |  Branch (241:16): [True: 0, False: 1]
  ------------------
  242|   100k|    } else if (str2->slen <= 0) {
  ------------------
  |  Branch (242:16): [True: 0, False: 100k]
  ------------------
  243|      0|        return 1;
  244|   100k|    } else {
  245|   100k|        pj_size_t min = (str1->slen < str2->slen)? str1->slen : str2->slen;
  ------------------
  |  Branch (245:25): [True: 25.6k, False: 75.2k]
  ------------------
  246|   100k|        int res = pj_ansi_strnicmp(str1->ptr, str2->ptr, min);
  ------------------
  |  |   96|   100k|#define pj_ansi_strnicmp        strncasecmp
  ------------------
  247|   100k|        if (res == 0) {
  ------------------
  |  Branch (247:13): [True: 45.0k, False: 55.8k]
  ------------------
  248|  45.0k|            return (str1->slen < str2->slen) ? -1 :
  ------------------
  |  Branch (248:20): [True: 5.43k, False: 39.5k]
  ------------------
  249|  45.0k|                    (str1->slen == str2->slen ? 0 : 1);
  ------------------
  |  Branch (249:22): [True: 39.5k, False: 62]
  ------------------
  250|  55.8k|        } else {
  251|  55.8k|            return res;
  252|  55.8k|        }
  253|   100k|    }
  254|   100k|}
pj_stricmp2:
  328|  7.63k|{
  329|  7.63k|    pj_str_t copy2;
  330|       |
  331|  7.63k|    if (str2) {
  ------------------
  |  Branch (331:9): [True: 7.63k, False: 0]
  ------------------
  332|  7.63k|        copy2.ptr = (char*)str2;
  333|  7.63k|        copy2.slen = pj_ansi_strlen(str2);
  ------------------
  |  |   69|  7.63k|#define pj_ansi_strlen          strlen
  ------------------
  334|  7.63k|    } else {
  335|      0|        copy2.ptr = NULL;
  336|      0|        copy2.slen = 0;
  337|      0|    }
  338|       |
  339|  7.63k|    return pj_stricmp(str1, &copy2);
  340|  7.63k|}
pj_strcat:
  378|    500|{
  379|    500|    pj_assert(src->slen >= 0);
  ------------------
  |  |   48|    500|#   define pj_assert(expr)   assert(expr)
  ------------------
  380|    500|    pj_assert(dst->slen >= 0);
  ------------------
  |  |   48|    500|#   define pj_assert(expr)   assert(expr)
  ------------------
  381|       |
  382|    500|    if (src->slen > 0 && dst->slen >= 0) {
  ------------------
  |  Branch (382:9): [True: 500, False: 0]
  |  Branch (382:26): [True: 500, False: 0]
  ------------------
  383|    500|        pj_memcpy(dst->ptr + dst->slen, src->ptr, src->slen);
  384|    500|        dst->slen += src->slen;
  385|    500|    }
  386|    500|}
pj_strcat2:
  389|    500|{
  390|    500|    pj_size_t len = str? pj_ansi_strlen(str) : 0;
  ------------------
  |  |   69|    500|#define pj_ansi_strlen          strlen
  ------------------
  |  Branch (390:21): [True: 500, False: 0]
  ------------------
  391|       |
  392|    500|    pj_assert(dst->slen >= 0);
  ------------------
  |  |   48|    500|#   define pj_assert(expr)   assert(expr)
  ------------------
  393|       |
  394|    500|    if (len && dst->slen >= 0) {
  ------------------
  |  Branch (394:9): [True: 500, False: 0]
  |  Branch (394:16): [True: 500, False: 0]
  ------------------
  395|    500|        pj_memcpy(dst->ptr + dst->slen, str, len);
  396|    500|        dst->slen += len;
  397|    500|    }
  398|    500|}
pj_strtrim:
  401|    340|{
  402|    340|    pj_strltrim(str);
  403|    340|    pj_strrtrim(str);
  404|    340|    return str;
  405|    340|}

pj_dump_config:
   51|  4.82k|{
   52|  4.82k|    PJ_LOG(3, (id, "PJLIB (c)2008-2016 Teluu Inc."));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   53|  4.82k|    PJ_LOG(3, (id, "Dumping configurations:"));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   54|  4.82k|    PJ_LOG(3, (id, " PJ_VERSION                : %s", PJ_VERSION));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   55|  4.82k|    PJ_LOG(3, (id, " PJ_M_NAME                 : %s", PJ_M_NAME));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   56|  4.82k|    PJ_LOG(3, (id, " PJ_HAS_PENTIUM            : %d", PJ_HAS_PENTIUM));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   57|  4.82k|    PJ_LOG(3, (id, " PJ_OS_NAME                : %s", PJ_OS_NAME));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   58|  4.82k|    PJ_LOG(3, (id, " PJ_CC_NAME/VER_(1,2,3)    : %s-%d.%d.%d", PJ_CC_NAME,
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   59|  4.82k|               PJ_CC_VER_1, PJ_CC_VER_2, PJ_CC_VER_3));
   60|  4.82k|    PJ_LOG(3, (id, " PJ_IS_(BIG/LITTLE)_ENDIAN : %s", 
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   61|  4.82k|               (PJ_IS_BIG_ENDIAN?"big-endian":"little-endian")));
   62|  4.82k|    PJ_LOG(3, (id, " PJ_HAS_INT64              : %d", PJ_HAS_INT64));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   63|  4.82k|    PJ_LOG(3, (id, " PJ_HAS_FLOATING_POINT     : %d", PJ_HAS_FLOATING_POINT));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   64|  4.82k|    PJ_LOG(3, (id, " PJ_DEBUG                  : %d", PJ_DEBUG));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   65|  4.82k|    PJ_LOG(3, (id, " PJ_FUNCTIONS_ARE_INLINED  : %d", PJ_FUNCTIONS_ARE_INLINED));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   66|  4.82k|    PJ_LOG(3, (id, " PJ_LOG_MAX_LEVEL          : %d", PJ_LOG_MAX_LEVEL));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   67|  4.82k|    PJ_LOG(3, (id, " PJ_LOG_MAX_SIZE           : %d", PJ_LOG_MAX_SIZE));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   68|  4.82k|    PJ_LOG(3, (id, " PJ_LOG_USE_STACK_BUFFER   : %d", PJ_LOG_USE_STACK_BUFFER));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   69|  4.82k|    PJ_LOG(3, (id, " PJ_POOL_DEBUG             : %d", PJ_POOL_DEBUG));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   70|  4.82k|    PJ_LOG(3, (id, " PJ_HAS_POOL_ALT_API       : %d", PJ_HAS_POOL_ALT_API));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   71|  4.82k|    PJ_LOG(3, (id, " PJ_HAS_TCP                : %d", PJ_HAS_TCP));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   72|  4.82k|    PJ_LOG(3, (id, " PJ_MAX_HOSTNAME           : %d", PJ_MAX_HOSTNAME));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   73|  4.82k|    PJ_LOG(3, (id, " ioqueue type              : %s", pj_ioqueue_name()));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   74|  4.82k|    PJ_LOG(3, (id, " PJ_IOQUEUE_MAX_HANDLES    : %d", PJ_IOQUEUE_MAX_HANDLES));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   75|  4.82k|    PJ_LOG(3, (id, " PJ_IOQUEUE_HAS_SAFE_UNREG : %d", PJ_IOQUEUE_HAS_SAFE_UNREG));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   76|  4.82k|    PJ_LOG(3, (id, " PJ_HAS_THREADS            : %d", PJ_HAS_THREADS));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   77|  4.82k|    PJ_LOG(3, (id, " PJ_LOG_USE_STACK_BUFFER   : %d", PJ_LOG_USE_STACK_BUFFER));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   78|  4.82k|    PJ_LOG(3, (id, " PJ_HAS_SEMAPHORE          : %d", PJ_HAS_SEMAPHORE));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   79|  4.82k|    PJ_LOG(3, (id, " PJ_HAS_EVENT_OBJ          : %d", PJ_HAS_EVENT_OBJ));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   80|  4.82k|    PJ_LOG(3, (id, " PJ_HAS_EXCEPTION_NAMES    : %d", PJ_HAS_EXCEPTION_NAMES));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   81|  4.82k|    PJ_LOG(3, (id, " PJ_MAX_EXCEPTION_ID       : %d", PJ_MAX_EXCEPTION_ID));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   82|  4.82k|    PJ_LOG(3, (id, " PJ_EXCEPTION_USE_WIN32_SEH: %d", PJ_EXCEPTION_USE_WIN32_SEH));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   83|  4.82k|    PJ_LOG(3, (id, " PJ_TIMESTAMP_USE_RDTSC:   : %d", PJ_TIMESTAMP_USE_RDTSC));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   84|  4.82k|    PJ_LOG(3, (id, " PJ_OS_HAS_CHECK_STACK     : %d", PJ_OS_HAS_CHECK_STACK));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   85|  4.82k|    PJ_LOG(3, (id, " PJ_HAS_HIGH_RES_TIMER     : %d", PJ_HAS_HIGH_RES_TIMER));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   86|  4.82k|    PJ_LOG(3, (id, " PJ_HAS_IPV6               : %d", PJ_HAS_IPV6));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   87|  4.82k|    PJ_LOG(3, (id, " PJ_HAS_SSL_SOCK           : %d", PJ_HAS_SSL_SOCK));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   88|  4.82k|    PJ_LOG(3, (id, " PJ_SSL_SOCK_IMP           : %d", PJ_SSL_SOCK_IMP));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   89|  4.82k|}

pj_register_strerror:
  121|  9.64k|{
  122|  9.64k|    unsigned i;
  123|       |
  124|       |    /* Check arguments. */
  125|  9.64k|    PJ_ASSERT_RETURN(start && space && f, PJ_EINVAL);
  ------------------
  |  |   59|  9.64k|            do { \
  |  |   60|  38.5k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 9.64k, False: 0]
  |  |  |  Branch (60:23): [True: 9.64k, False: 0]
  |  |  |  Branch (60:23): [True: 9.64k, False: 0]
  |  |  ------------------
  |  |   61|  9.64k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  126|       |
  127|       |    /* Check if there aren't too many handlers registered. */
  128|  9.64k|    PJ_ASSERT_RETURN(err_msg_hnd_cnt < PJ_ARRAY_SIZE(err_msg_hnd),
  ------------------
  |  |   59|  9.64k|            do { \
  |  |   60|  9.64k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 9.64k]
  |  |  ------------------
  |  |   61|  9.64k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  129|  9.64k|                     PJ_ETOOMANY);
  130|       |
  131|       |    /* Start error must be greater than PJ_ERRNO_START_USER */
  132|  9.64k|    PJ_ASSERT_RETURN(start >= PJ_ERRNO_START_USER, PJ_EEXISTS);
  ------------------
  |  |   59|  9.64k|            do { \
  |  |   60|  9.64k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 9.64k]
  |  |  ------------------
  |  |   61|  9.64k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  133|       |
  134|       |    /* Check that no existing handler has covered the specified range. */
  135|  14.4k|    for (i=0; i<err_msg_hnd_cnt; ++i) {
  ------------------
  |  Branch (135:15): [True: 14.4k, False: 2]
  ------------------
  136|  14.4k|        if (IN_RANGE(start, err_msg_hnd[i].begin, err_msg_hnd[i].end) ||
  ------------------
  |  |  115|  28.9k|#define IN_RANGE(val,start,end)     ((val)>=(start) && (val)<(end))
  |  |  ------------------
  |  |  |  Branch (115:38): [True: 9.64k, False: 4.82k]
  |  |  |  Branch (115:56): [True: 9.64k, False: 0]
  |  |  ------------------
  ------------------
  137|  14.4k|            IN_RANGE(start+space-1, err_msg_hnd[i].begin, err_msg_hnd[i].end))
  ------------------
  |  |  115|  4.82k|#define IN_RANGE(val,start,end)     ((val)>=(start) && (val)<(end))
  |  |  ------------------
  |  |  |  Branch (115:38): [True: 0, False: 4.82k]
  |  |  |  Branch (115:56): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  138|  9.64k|        {
  139|  9.64k|            if (err_msg_hnd[i].begin == start && 
  ------------------
  |  Branch (139:17): [True: 9.64k, False: 0]
  ------------------
  140|  9.64k|                err_msg_hnd[i].end == (start+space) &&
  ------------------
  |  Branch (140:17): [True: 9.64k, False: 0]
  ------------------
  141|  9.64k|                err_msg_hnd[i].strerror == f)
  ------------------
  |  Branch (141:17): [True: 9.64k, False: 0]
  ------------------
  142|  9.64k|            {
  143|       |                /* The same range and handler has already been registered */
  144|  9.64k|                return PJ_SUCCESS;
  145|  9.64k|            }
  146|       |
  147|      0|            return PJ_EEXISTS;
  ------------------
  |  |  388|      0|#define PJ_EEXISTS          (PJ_ERRNO_START_STATUS + 15)/* 70015 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  148|  9.64k|        }
  149|  14.4k|    }
  150|       |
  151|       |    /* Register the handler. */
  152|      2|    err_msg_hnd[err_msg_hnd_cnt].begin = start;
  153|      2|    err_msg_hnd[err_msg_hnd_cnt].end = start + space;
  154|      2|    err_msg_hnd[err_msg_hnd_cnt].strerror = f;
  155|       |
  156|      2|    ++err_msg_hnd_cnt;
  157|       |
  158|      2|    return PJ_SUCCESS;
  159|  9.64k|}

pj_throw_exception_:
   41|  33.5k|{
   42|  33.5k|    struct pj_exception_state_t *handler;
   43|       |
   44|  33.5k|    handler = (struct pj_exception_state_t*) 
   45|  33.5k|              pj_thread_local_get(thread_local_id);
   46|  33.5k|    if (handler == NULL) {
  ------------------
  |  Branch (46:9): [True: 0, False: 33.5k]
  ------------------
   47|      0|        PJ_LOG(1,("except.c", "!!!FATAL: unhandled exception %s!\n", 
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
   48|      0|                   pj_exception_id_name(exception_id)));
   49|      0|        pj_assert(handler != NULL);
  ------------------
  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  ------------------
   50|       |        /* This will crash the system! */
   51|      0|    }
   52|  33.5k|    pj_pop_exception_handler_(handler);
   53|  33.5k|    pj_longjmp(handler->state, exception_id);
  ------------------
  |  |   34|  33.5k|#    define pj_longjmp(buf,d)   longjmp(buf,d)
  ------------------
   54|  33.5k|}
pj_push_exception_handler_:
   75|  37.1k|{
   76|  37.1k|    struct pj_exception_state_t *parent_handler = NULL;
   77|       |
   78|  37.1k|    if (thread_local_id == -1) {
  ------------------
  |  Branch (78:9): [True: 1, False: 37.1k]
  ------------------
   79|      1|        pj_thread_local_alloc(&thread_local_id);
   80|      1|        pj_assert(thread_local_id != -1);
  ------------------
  |  |   48|      1|#   define pj_assert(expr)   assert(expr)
  ------------------
   81|      1|        pj_atexit(&exception_cleanup);
   82|      1|    }
   83|  37.1k|    parent_handler = (struct pj_exception_state_t *)
   84|  37.1k|                      pj_thread_local_get(thread_local_id);
   85|  37.1k|    rec->prev = parent_handler;
   86|  37.1k|    pj_thread_local_set(thread_local_id, rec);
   87|  37.1k|}
pj_pop_exception_handler_:
   90|  42.0k|{
   91|  42.0k|    struct pj_exception_state_t *handler;
   92|       |
   93|  42.0k|    handler = (struct pj_exception_state_t *)
   94|  42.0k|              pj_thread_local_get(thread_local_id);
   95|  42.0k|    if (handler && handler==rec) {
  ------------------
  |  Branch (95:9): [True: 42.0k, False: 36]
  |  Branch (95:20): [True: 39.5k, False: 2.53k]
  ------------------
   96|  39.5k|        pj_thread_local_set(thread_local_id, handler->prev);
   97|  39.5k|    }
   98|  42.0k|}
pj_exception_id_alloc:
  104|  9.64k|{
  105|  9.64k|    unsigned i;
  106|       |
  107|  9.64k|    pj_enter_critical_section();
  108|       |
  109|       |    /*
  110|       |     * Start from 1 (not 0)!!!
  111|       |     * Exception 0 is reserved for normal path of setjmp()!!!
  112|       |     */
  113|  24.1k|    for (i=1; i<PJ_MAX_EXCEPTION_ID; ++i) {
  ------------------
  |  |  895|  24.1k|#   define PJ_MAX_EXCEPTION_ID      16
  ------------------
  |  Branch (113:15): [True: 24.1k, False: 0]
  ------------------
  114|  24.1k|        if (exception_id_names[i] == NULL) {
  ------------------
  |  Branch (114:13): [True: 9.64k, False: 14.4k]
  ------------------
  115|  9.64k|            exception_id_names[i] = name;
  116|  9.64k|            *id = i;
  117|  9.64k|            pj_leave_critical_section();
  118|  9.64k|            return PJ_SUCCESS;
  119|  9.64k|        }
  120|  24.1k|    }
  121|       |
  122|      0|    pj_leave_critical_section();
  123|      0|    return PJ_ETOOMANY;
  ------------------
  |  |  363|      0|#define PJ_ETOOMANY         (PJ_ERRNO_START_STATUS + 10)/* 70010 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  124|  9.64k|}
pj_exception_id_free:
  127|  9.64k|{
  128|       |    /*
  129|       |     * Start from 1 (not 0)!!!
  130|       |     * Exception 0 is reserved for normal path of setjmp()!!!
  131|       |     */
  132|  9.64k|    PJ_ASSERT_RETURN(id>0 && id<PJ_MAX_EXCEPTION_ID, PJ_EINVAL);
  ------------------
  |  |   59|  9.64k|            do { \
  |  |   60|  19.2k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 9.64k, False: 0]
  |  |  |  Branch (60:23): [True: 9.64k, False: 0]
  |  |  ------------------
  |  |   61|  9.64k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  133|       |    
  134|  9.64k|    pj_enter_critical_section();
  135|  9.64k|    exception_id_names[id] = NULL;
  136|  9.64k|    pj_leave_critical_section();
  137|       |
  138|  9.64k|    return PJ_SUCCESS;
  139|       |
  140|  9.64k|}

pj_generate_unique_string:
   52|      1|{
   53|      1|    char *p, *end;
   54|       |
   55|      1|    PJ_CHECK_STACK();
   56|       |
   57|      1|    if (guid_chars[0] == '\0') {
  ------------------
  |  Branch (57:9): [True: 1, False: 0]
  ------------------
   58|      1|        pj_enter_critical_section();
   59|      1|        if (guid_chars[0] == '\0') {
  ------------------
  |  Branch (59:13): [True: 1, False: 0]
  ------------------
   60|      1|            init_guid_chars();
   61|      1|        }
   62|      1|        pj_leave_critical_section();
   63|      1|    }
   64|       |
   65|       |    /* This would only work if PJ_GUID_STRING_LENGTH is multiple of 2 bytes */
   66|      1|    pj_assert(PJ_GUID_STRING_LENGTH % 2 == 0);
  ------------------
  |  |   48|      1|#   define pj_assert(expr)   assert(expr)
  ------------------
   67|       |
   68|      9|    for (p=str->ptr, end=p+PJ_GUID_STRING_LENGTH; p<end; ) {
  ------------------
  |  Branch (68:51): [True: 8, False: 1]
  ------------------
   69|      8|        pj_uint32_t rand_val = pj_rand();
   70|      8|        pj_uint32_t rand_idx = RAND_MAX;
   71|       |
   72|     40|        for ( ; rand_idx>0 && p<end; rand_idx>>=8, rand_val>>=8, p++) {
  ------------------
  |  Branch (72:17): [True: 32, False: 8]
  |  Branch (72:31): [True: 32, False: 0]
  ------------------
   73|     32|            *p = guid_chars[(rand_val & 0xFF) & 63];
   74|     32|        }
   75|      8|    }
   76|       |
   77|      1|    str->slen = PJ_GUID_STRING_LENGTH;
   78|      1|    return str;
   79|      1|}
guid_simple.c:init_guid_chars:
   35|      1|{
   36|      1|    char *p = guid_chars;
   37|      1|    unsigned i;
   38|       |
   39|     11|    for (i=0; i<10; ++i)
  ------------------
  |  Branch (39:15): [True: 10, False: 1]
  ------------------
   40|     10|        *p++ = '0'+i;
   41|       |
   42|     27|    for (i=0; i<26; ++i) {
  ------------------
  |  Branch (42:15): [True: 26, False: 1]
  ------------------
   43|     26|        *p++ = 'a'+i;
   44|     26|        *p++ = 'A'+i;
   45|     26|    }
   46|       |
   47|      1|    *p++ = '-';
   48|      1|    *p++ = '.';
   49|      1|}

pj_hash_calc:
   54|   322k|{
   55|   322k|    PJ_CHECK_STACK();
   56|       |
   57|   322k|    if (keylen==PJ_HASH_KEY_STRING) {
  ------------------
  |  |   45|   322k|#define PJ_HASH_KEY_STRING      ((unsigned)-1)
  ------------------
  |  Branch (57:9): [True: 0, False: 322k]
  ------------------
   58|      0|        const pj_uint8_t *p = (const pj_uint8_t*)key;
   59|      0|        for ( ; *p; ++p ) {
  ------------------
  |  Branch (59:17): [True: 0, False: 0]
  ------------------
   60|      0|            hash = (hash * PJ_HASH_MULTIPLIER) + *p;
  ------------------
  |  |   30|      0|#define PJ_HASH_MULTIPLIER      33
  ------------------
   61|      0|        }
   62|   322k|    } else {
   63|   322k|        const pj_uint8_t *p = (const pj_uint8_t*)key,
   64|   322k|                              *end = p + keylen;
   65|  2.53M|        for ( ; p!=end; ++p) {
  ------------------
  |  Branch (65:17): [True: 2.21M, False: 322k]
  ------------------
   66|  2.21M|            hash = (hash * PJ_HASH_MULTIPLIER) + *p;
  ------------------
  |  |   30|  2.21M|#define PJ_HASH_MULTIPLIER      33
  ------------------
   67|  2.21M|        }
   68|   322k|    }
   69|   322k|    return hash;
   70|   322k|}
pj_hash_calc_tolower:
   75|  32.2k|{
   76|  32.2k|    long i;
   77|       |
   78|  75.6k|    for (i=0; i<key->slen; ++i) {
  ------------------
  |  Branch (78:15): [True: 43.3k, False: 32.2k]
  ------------------
   79|  43.3k|        int lower = pj_tolower(key->ptr[i]);
   80|  43.3k|        if (result)
  ------------------
  |  Branch (80:13): [True: 43.3k, False: 0]
  ------------------
   81|  43.3k|            result[i] = (char)lower;
   82|       |
   83|  43.3k|        hval = hval * PJ_HASH_MULTIPLIER + lower;
  ------------------
  |  |   30|  43.3k|#define PJ_HASH_MULTIPLIER      33
  ------------------
   84|  43.3k|    }
   85|       |
   86|  32.2k|    return hval;
   87|  32.2k|}
pj_hash_create:
   91|  14.4k|{
   92|  14.4k|    pj_hash_table_t *h;
   93|  14.4k|    unsigned table_size;
   94|       |    
   95|       |    /* Check that PJ_HASH_ENTRY_BUF_SIZE is correct. */
   96|  14.4k|    PJ_ASSERT_RETURN(sizeof(pj_hash_entry)<=PJ_HASH_ENTRY_BUF_SIZE, NULL);
  ------------------
  |  |   59|  14.4k|            do { \
  |  |   60|  14.4k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [Folded - Ignored]
  |  |  ------------------
  |  |   61|  14.4k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
   97|       |
   98|  14.4k|    h = PJ_POOL_ALLOC_T(pool, pj_hash_table_t);
  ------------------
  |  |  506|  14.4k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
   99|  14.4k|    h->count = 0;
  100|       |
  101|  14.4k|    PJ_LOG( 6, ("hashtbl", "hash table %p created from pool %s", h, pj_pool_getobjname(pool)));
  ------------------
  |  |  106|  14.4k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  14.4k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 14.4k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  14.4k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  102|       |
  103|       |    /* size must be 2^n - 1.
  104|       |       round-up the size to this rule, except when size is 2^n, then size
  105|       |       will be round-down to 2^n-1.
  106|       |     */
  107|  14.4k|    table_size = 8;
  108|  77.1k|    do {
  109|  77.1k|        table_size <<= 1;    
  110|  77.1k|    } while (table_size < size);
  ------------------
  |  Branch (110:14): [True: 62.7k, False: 14.4k]
  ------------------
  111|  14.4k|    table_size -= 1;
  112|       |    
  113|  14.4k|    h->rows = table_size;
  114|  14.4k|    h->table = (pj_hash_entry**)
  115|  14.4k|               pj_pool_calloc(pool, table_size+1, sizeof(pj_hash_entry*));
  116|  14.4k|    return h;
  117|  14.4k|}
pj_hash_get:
  214|  9.64k|{
  215|  9.64k|    pj_hash_entry *entry;
  216|  9.64k|    entry = *find_entry( NULL, ht, key, keylen, NULL, hval, NULL, PJ_FALSE);
  217|  9.64k|    return entry ? entry->value : NULL;
  ------------------
  |  Branch (217:12): [True: 4.82k, False: 4.82k]
  ------------------
  218|  9.64k|}
pj_hash_set:
  256|  4.82k|{
  257|  4.82k|    hash_set(pool, ht, key, keylen, hval, value, NULL, PJ_FALSE);
  258|  4.82k|}
pj_hash_set_np:
  271|  4.82k|{
  272|  4.82k|    hash_set(NULL, ht, key, keylen, hval, value, (void *)entry_buf, PJ_FALSE);
  273|  4.82k|}
pj_hash_count:
  285|  4.82k|{
  286|  4.82k|    return ht->count;
  287|  4.82k|}
pj_hash_first:
  291|  14.4k|{
  292|  14.4k|    it->index = 0;
  293|  14.4k|    it->entry = NULL;
  294|       |
  295|  5.14M|    for (; it->index <= ht->rows; ++it->index) {
  ------------------
  |  Branch (295:12): [True: 5.13M, False: 9.64k]
  ------------------
  296|  5.13M|        it->entry = ht->table[it->index];
  297|  5.13M|        if (it->entry) {
  ------------------
  |  Branch (297:13): [True: 4.82k, False: 5.12M]
  ------------------
  298|  4.82k|            break;
  299|  4.82k|        }
  300|  5.13M|    }
  301|       |
  302|  14.4k|    return it->entry ? it : NULL;
  ------------------
  |  Branch (302:12): [True: 4.82k, False: 9.64k]
  ------------------
  303|  14.4k|}
pj_hash_this:
  324|  4.82k|{
  325|  4.82k|    PJ_CHECK_STACK();
  326|  4.82k|    PJ_UNUSED_ARG(ht);
  ------------------
  |  | 1433|  4.82k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  327|  4.82k|    return it->entry->value;
  328|  4.82k|}
hash.c:find_entry:
  123|  19.2k|{
  124|  19.2k|    pj_uint32_t hash;
  125|  19.2k|    pj_hash_entry **p_entry, *entry;
  126|       |
  127|  19.2k|    if (hval && *hval != 0) {
  ------------------
  |  Branch (127:9): [True: 19.2k, False: 0]
  |  Branch (127:17): [True: 9.64k, False: 9.64k]
  ------------------
  128|  9.64k|        hash = *hval;
  129|  9.64k|        if (keylen==PJ_HASH_KEY_STRING) {
  ------------------
  |  |   45|  9.64k|#define PJ_HASH_KEY_STRING      ((unsigned)-1)
  ------------------
  |  Branch (129:13): [True: 0, False: 9.64k]
  ------------------
  130|      0|            keylen = (unsigned)pj_ansi_strlen((const char*)key);
  ------------------
  |  |   69|      0|#define pj_ansi_strlen          strlen
  ------------------
  131|      0|        }
  132|  9.64k|    } else {
  133|       |        /* This slightly differs with pj_hash_calc() because we need 
  134|       |         * to get the keylen when keylen is PJ_HASH_KEY_STRING.
  135|       |         */
  136|  9.64k|        hash=0;
  137|  9.64k|        if (keylen==PJ_HASH_KEY_STRING) {
  ------------------
  |  |   45|  9.64k|#define PJ_HASH_KEY_STRING      ((unsigned)-1)
  ------------------
  |  Branch (137:13): [True: 0, False: 9.64k]
  ------------------
  138|      0|            const pj_uint8_t *p = (const pj_uint8_t*)key;
  139|      0|            for ( ; *p; ++p ) {
  ------------------
  |  Branch (139:21): [True: 0, False: 0]
  ------------------
  140|      0|                if (lower)
  ------------------
  |  Branch (140:21): [True: 0, False: 0]
  ------------------
  141|      0|                    hash = hash * PJ_HASH_MULTIPLIER + pj_tolower(*p);
  ------------------
  |  |   30|      0|#define PJ_HASH_MULTIPLIER      33
  ------------------
  142|      0|                else 
  143|      0|                    hash = hash * PJ_HASH_MULTIPLIER + *p;
  ------------------
  |  |   30|      0|#define PJ_HASH_MULTIPLIER      33
  ------------------
  144|      0|            }
  145|      0|            keylen = (unsigned)(p - (const unsigned char*)key);
  146|  9.64k|        } else {
  147|  9.64k|            const pj_uint8_t *p = (const pj_uint8_t*)key,
  148|  9.64k|                                  *end = p + keylen;
  149|   241k|            for ( ; p!=end; ++p) {
  ------------------
  |  Branch (149:21): [True: 231k, False: 9.64k]
  ------------------
  150|   231k|                if (lower)
  ------------------
  |  Branch (150:21): [True: 0, False: 231k]
  ------------------
  151|      0|                    hash = hash * PJ_HASH_MULTIPLIER + pj_tolower(*p);
  ------------------
  |  |   30|      0|#define PJ_HASH_MULTIPLIER      33
  ------------------
  152|   231k|                else
  153|   231k|                    hash = hash * PJ_HASH_MULTIPLIER + *p;
  ------------------
  |  |   30|   231k|#define PJ_HASH_MULTIPLIER      33
  ------------------
  154|   231k|            }
  155|  9.64k|        }
  156|       |
  157|       |        /* Report back the computed hash. */
  158|  9.64k|        if (hval)
  ------------------
  |  Branch (158:13): [True: 9.64k, False: 0]
  ------------------
  159|  9.64k|            *hval = hash;
  160|  9.64k|    }
  161|       |
  162|       |    /* scan the linked list */
  163|  19.2k|    for (p_entry = &ht->table[hash & ht->rows], entry=*p_entry; 
  164|  19.2k|         entry; 
  ------------------
  |  Branch (164:10): [True: 9.64k, False: 9.64k]
  ------------------
  165|  19.2k|         p_entry = &entry->next, entry = *p_entry)
  166|  9.64k|    {
  167|  9.64k|        if (entry->hash==hash && entry->keylen==keylen &&
  ------------------
  |  Branch (167:13): [True: 9.64k, False: 0]
  |  Branch (167:34): [True: 9.64k, False: 0]
  ------------------
  168|  9.64k|            ((lower && pj_ansi_strnicmp((const char*)entry->key,
  ------------------
  |  |   96|      0|#define pj_ansi_strnicmp        strncasecmp
  ------------------
  |  Branch (168:15): [True: 0, False: 9.64k]
  |  Branch (168:24): [True: 0, False: 0]
  ------------------
  169|      0|                                        (const char*)key, keylen)==0) ||
  170|  9.64k|             (!lower && pj_memcmp(entry->key, key, keylen)==0)))
  ------------------
  |  Branch (170:15): [True: 9.64k, False: 0]
  |  Branch (170:25): [True: 9.64k, False: 0]
  ------------------
  171|  9.64k|        {
  172|  9.64k|            break;
  173|  9.64k|        }
  174|  9.64k|    }
  175|       |
  176|  19.2k|    if (entry || val==NULL)
  ------------------
  |  Branch (176:9): [True: 9.64k, False: 9.64k]
  |  Branch (176:18): [True: 4.82k, False: 4.82k]
  ------------------
  177|  14.4k|        return p_entry;
  178|       |
  179|       |    /* Entry not found, create a new one. 
  180|       |     * If entry_buf is specified, use it. Otherwise allocate from pool.
  181|       |     */
  182|  4.82k|    if (entry_buf) {
  ------------------
  |  Branch (182:9): [True: 4.82k, False: 0]
  ------------------
  183|  4.82k|        entry = (pj_hash_entry*)entry_buf;
  184|  4.82k|    } else {
  185|       |        /* Pool must be specified! */
  186|      0|        PJ_ASSERT_RETURN(pool != NULL, NULL);
  ------------------
  |  |   59|      0|            do { \
  |  |   60|      0|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 0]
  |  |  ------------------
  |  |   61|      0|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  187|       |
  188|      0|        entry = PJ_POOL_ALLOC_T(pool, pj_hash_entry);
  ------------------
  |  |  506|      0|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
  189|      0|        PJ_LOG(6, ("hashtbl", 
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  190|      0|                   "%p: New p_entry %p created, pool used=%lu, cap=%lu", 
  191|      0|                   ht, entry,  (unsigned long)pj_pool_get_used_size(pool),
  192|      0|                   (unsigned long)pj_pool_get_capacity(pool)));
  193|      0|    }
  194|  4.82k|    entry->next = NULL;
  195|  4.82k|    entry->hash = hash;
  196|  4.82k|    if (pool) {
  ------------------
  |  Branch (196:9): [True: 0, False: 4.82k]
  ------------------
  197|      0|        entry->key = pj_pool_alloc(pool, keylen);
  198|      0|        pj_memcpy(entry->key, key, keylen);
  199|  4.82k|    } else {
  200|  4.82k|        entry->key = (void*)key;
  201|  4.82k|    }
  202|  4.82k|    entry->keylen = keylen;
  203|  4.82k|    entry->value = val;
  204|  4.82k|    *p_entry = entry;
  205|       |    
  206|  4.82k|    ++ht->count;
  207|       |    
  208|  4.82k|    return p_entry;
  209|  4.82k|}
hash.c:hash_set:
  232|  9.64k|{
  233|  9.64k|    pj_hash_entry **p_entry;
  234|       |
  235|  9.64k|    p_entry = find_entry( pool, ht, key, keylen, value, &hval, entry_buf,
  236|  9.64k|                          lower);
  237|  9.64k|    if (*p_entry) {
  ------------------
  |  Branch (237:9): [True: 9.64k, False: 0]
  ------------------
  238|  9.64k|        if (value == NULL) {
  ------------------
  |  Branch (238:13): [True: 4.82k, False: 4.82k]
  ------------------
  239|       |            /* delete entry */
  240|  4.82k|            PJ_LOG(6, ("hashtbl", "%p: p_entry %p deleted", ht, *p_entry));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  241|  4.82k|            *p_entry = (*p_entry)->next;
  242|  4.82k|            --ht->count;
  243|       |            
  244|  4.82k|        } else {
  245|       |            /* overwrite */
  246|  4.82k|            (*p_entry)->value = value;
  247|  4.82k|            PJ_LOG(6, ("hashtbl", "%p: p_entry %p value set to %p", ht, 
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  248|  4.82k|                       *p_entry, value));
  249|  4.82k|        }
  250|  9.64k|    }
  251|  9.64k|}

pj_ioqueue_cfg_default:
   33|  4.82k|{
   34|  4.82k|    pj_bzero(cfg, sizeof(*cfg));
   35|  4.82k|    cfg->epoll_flags = PJ_IOQUEUE_DEFAULT_EPOLL_FLAGS;
  ------------------
  |  |  773|  4.82k|#   define PJ_IOQUEUE_DEFAULT_EPOLL_FLAGS PJ_IOQUEUE_EPOLL_AUTO
  ------------------
   36|  4.82k|    cfg->default_concurrency = PJ_IOQUEUE_DEFAULT_ALLOW_CONCURRENCY;
  ------------------
  |  |  738|  4.82k|#   define PJ_IOQUEUE_DEFAULT_ALLOW_CONCURRENCY   1
  ------------------
   37|  4.82k|}
pj_ioqueue_set_lock:
   61|  4.82k|{
   62|  4.82k|    PJ_ASSERT_RETURN(ioqueue && lock, PJ_EINVAL);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  9.64k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 4.82k, False: 0]
  |  |  |  Branch (60:23): [True: 4.82k, False: 0]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
   63|       |
   64|  4.82k|    if (ioqueue->auto_delete_lock && ioqueue->lock) {
  ------------------
  |  Branch (64:9): [True: 0, False: 4.82k]
  |  Branch (64:38): [True: 0, False: 0]
  ------------------
   65|      0|        pj_lock_destroy(ioqueue->lock);
   66|      0|    }
   67|       |
   68|  4.82k|    ioqueue->lock = lock;
   69|  4.82k|    ioqueue->auto_delete_lock = auto_delete;
   70|       |
   71|  4.82k|    return PJ_SUCCESS;
   72|  4.82k|}
ioqueue_select.c:ioqueue_init:
   40|  4.82k|{
   41|  4.82k|    ioqueue->lock = NULL;
   42|  4.82k|    ioqueue->auto_delete_lock = 0;
   43|  4.82k|}
ioqueue_select.c:ioqueue_destroy:
   46|  4.82k|{
   47|  4.82k|    if (ioqueue->auto_delete_lock && ioqueue->lock ) {
  ------------------
  |  Branch (47:9): [True: 4.82k, False: 0]
  |  Branch (47:38): [True: 4.82k, False: 0]
  ------------------
   48|  4.82k|        pj_lock_release(ioqueue->lock);
   49|  4.82k|        return pj_lock_destroy(ioqueue->lock);
   50|  4.82k|    }
   51|       |    
   52|      0|    return PJ_SUCCESS;
   53|  4.82k|}

pj_ioqueue_create:
  191|  4.82k|{
  192|  4.82k|    return pj_ioqueue_create2(pool, max_fd, NULL, p_ioqueue);
  193|  4.82k|}
pj_ioqueue_create2:
  205|  4.82k|{
  206|  4.82k|    pj_ioqueue_t *ioqueue;
  207|  4.82k|    pj_lock_t *lock;
  208|  4.82k|    pj_size_t i;
  209|  4.82k|    pj_status_t rc;
  210|       |
  211|       |    /* Check that arguments are valid. */
  212|  4.82k|    PJ_ASSERT_RETURN(pool != NULL && p_ioqueue != NULL && 
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  28.9k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 4.82k, False: 0]
  |  |  |  Branch (60:23): [True: 4.82k, False: 0]
  |  |  |  Branch (60:23): [True: 4.82k, False: 0]
  |  |  |  Branch (60:23): [True: 4.82k, False: 0]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  213|  4.82k|                     max_fd > 0 && max_fd <= PJ_IOQUEUE_MAX_HANDLES, 
  214|  4.82k|                     PJ_EINVAL);
  215|       |
  216|       |    /* Check that size of pj_ioqueue_op_key_t is sufficient */
  217|  4.82k|    PJ_ASSERT_RETURN(sizeof(pj_ioqueue_op_key_t)-sizeof(void*) >=
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [Folded - Ignored]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  218|  4.82k|                     sizeof(union operation_key), PJ_EBUG);
  219|       |
  220|       |    /* Create and init common ioqueue stuffs */
  221|  4.82k|    ioqueue = PJ_POOL_ALLOC_T(pool, pj_ioqueue_t);
  ------------------
  |  |  506|  4.82k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
  222|  4.82k|    ioqueue_init(ioqueue);
  223|       |
  224|  4.82k|    if (cfg)
  ------------------
  |  Branch (224:9): [True: 0, False: 4.82k]
  ------------------
  225|      0|        pj_memcpy(&ioqueue->cfg, cfg, sizeof(*cfg));
  226|  4.82k|    else
  227|  4.82k|        pj_ioqueue_cfg_default(&ioqueue->cfg);
  228|  4.82k|    ioqueue->max = (unsigned)max_fd;
  229|  4.82k|    ioqueue->count = 0;
  230|  4.82k|    PJ_FD_ZERO(&ioqueue->rfdset);
  231|  4.82k|    PJ_FD_ZERO(&ioqueue->wfdset);
  232|  4.82k|#if PJ_HAS_TCP
  233|  4.82k|    PJ_FD_ZERO(&ioqueue->xfdset);
  234|  4.82k|#endif
  235|  4.82k|    pj_list_init(&ioqueue->active_list);
  236|       |
  237|  4.82k|    rescan_fdset(ioqueue);
  238|       |
  239|  4.82k|#if PJ_IOQUEUE_HAS_SAFE_UNREG
  240|       |    /* When safe unregistration is used (the default), we pre-create
  241|       |     * all keys and put them in the free list.
  242|       |     */
  243|       |
  244|       |    /* Mutex to protect key's reference counter 
  245|       |     * We don't want to use key's mutex or ioqueue's mutex because
  246|       |     * that would create deadlock situation in some cases.
  247|       |     */
  248|  4.82k|    rc = pj_mutex_create_simple(pool, NULL, &ioqueue->ref_cnt_mutex);
  249|  4.82k|    if (rc != PJ_SUCCESS)
  ------------------
  |  Branch (249:9): [True: 0, False: 4.82k]
  ------------------
  250|      0|        return rc;
  251|       |
  252|       |
  253|       |    /* Init key list */
  254|  4.82k|    pj_list_init(&ioqueue->free_list);
  255|  4.82k|    pj_list_init(&ioqueue->closing_list);
  256|       |
  257|       |
  258|       |    /* Pre-create all keys according to max_fd */
  259|   313k|    for (i=0; i<max_fd; ++i) {
  ------------------
  |  Branch (259:15): [True: 308k, False: 4.82k]
  ------------------
  260|   308k|        pj_ioqueue_key_t *key;
  261|       |
  262|   308k|        key = PJ_POOL_ALLOC_T(pool, pj_ioqueue_key_t);
  ------------------
  |  |  506|   308k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
  263|   308k|        key->ref_count = 0;
  264|   308k|        rc = pj_lock_create_recursive_mutex(pool, NULL, &key->lock);
  265|   308k|        if (rc != PJ_SUCCESS) {
  ------------------
  |  Branch (265:13): [True: 0, False: 308k]
  ------------------
  266|      0|            key = ioqueue->free_list.next;
  267|      0|            while (key != &ioqueue->free_list) {
  ------------------
  |  Branch (267:20): [True: 0, False: 0]
  ------------------
  268|      0|                pj_lock_destroy(key->lock);
  269|      0|                key = key->next;
  270|      0|            }
  271|      0|            pj_mutex_destroy(ioqueue->ref_cnt_mutex);
  272|      0|            return rc;
  273|      0|        }
  274|       |
  275|   308k|        pj_list_push_back(&ioqueue->free_list, key);
  276|   308k|    }
  277|  4.82k|#endif
  278|       |
  279|       |    /* Create and init ioqueue mutex */
  280|  4.82k|    rc = pj_lock_create_simple_mutex(pool, "ioq%p", &lock);
  281|  4.82k|    if (rc != PJ_SUCCESS)
  ------------------
  |  Branch (281:9): [True: 0, False: 4.82k]
  ------------------
  282|      0|        return rc;
  283|       |
  284|  4.82k|    rc = pj_ioqueue_set_lock(ioqueue, lock, PJ_TRUE);
  285|  4.82k|    if (rc != PJ_SUCCESS)
  ------------------
  |  Branch (285:9): [True: 0, False: 4.82k]
  ------------------
  286|      0|        return rc;
  287|       |
  288|  4.82k|    PJ_LOG(4, ("pjlib", "select() I/O Queue created (%p)", ioqueue));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  289|       |
  290|  4.82k|    *p_ioqueue = ioqueue;
  291|  4.82k|    return PJ_SUCCESS;
  292|  4.82k|}
pj_ioqueue_destroy:
  300|  4.82k|{
  301|  4.82k|    pj_ioqueue_key_t *key;
  302|       |
  303|  4.82k|    PJ_ASSERT_RETURN(ioqueue, PJ_EINVAL);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  304|       |
  305|  4.82k|    pj_lock_acquire(ioqueue->lock);
  306|       |
  307|  4.82k|#if PJ_IOQUEUE_HAS_SAFE_UNREG
  308|       |    /* Destroy reference counters */
  309|  4.82k|    key = ioqueue->active_list.next;
  310|  4.82k|    while (key != &ioqueue->active_list) {
  ------------------
  |  Branch (310:12): [True: 0, False: 4.82k]
  ------------------
  311|      0|        pj_lock_destroy(key->lock);
  312|      0|        key = key->next;
  313|      0|    }
  314|       |
  315|  4.82k|    key = ioqueue->closing_list.next;
  316|  4.82k|    while (key != &ioqueue->closing_list) {
  ------------------
  |  Branch (316:12): [True: 0, False: 4.82k]
  ------------------
  317|      0|        pj_lock_destroy(key->lock);
  318|      0|        key = key->next;
  319|      0|    }
  320|       |
  321|  4.82k|    key = ioqueue->free_list.next;
  322|   313k|    while (key != &ioqueue->free_list) {
  ------------------
  |  Branch (322:12): [True: 308k, False: 4.82k]
  ------------------
  323|   308k|        pj_lock_destroy(key->lock);
  324|   308k|        key = key->next;
  325|   308k|    }
  326|       |
  327|  4.82k|    pj_mutex_destroy(ioqueue->ref_cnt_mutex);
  328|  4.82k|#endif
  329|       |
  330|  4.82k|    return ioqueue_destroy(ioqueue);
  331|  4.82k|}
ioqueue_select.c:rescan_fdset:
  177|  4.82k|{
  178|  4.82k|    ioqueue->nfds = FD_SETSIZE-1;
  179|  4.82k|}

pj_lock_create_simple_mutex:
   87|  9.64k|{
   88|  9.64k|    return create_mutex_lock(pool, name, PJ_MUTEX_SIMPLE, lock);
   89|  9.64k|}
pj_lock_create_recursive_mutex:
   94|   328k|{
   95|   328k|    return create_mutex_lock(pool, name, PJ_MUTEX_RECURSE, lock);
   96|   328k|}
pj_lock_create_null_mutex:
  120|  4.82k|{
  121|  4.82k|    PJ_UNUSED_ARG(name);
  ------------------
  |  | 1433|  4.82k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  122|  4.82k|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1433|  4.82k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  123|       |
  124|  4.82k|    PJ_ASSERT_RETURN(lock, PJ_EINVAL);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  125|       |
  126|  4.82k|    *lock = &null_lock_template;
  127|  4.82k|    return PJ_SUCCESS;
  128|  4.82k|}
pj_lock_acquire:
  177|  87.4k|{
  178|  87.4k|    PJ_ASSERT_RETURN(lock != NULL, PJ_EINVAL);
  ------------------
  |  |   59|  87.4k|            do { \
  |  |   60|  87.4k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 87.4k]
  |  |  ------------------
  |  |   61|  87.4k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  179|  87.4k|    return (*lock->acquire)(lock->lock_object);
  180|  87.4k|}
pj_lock_release:
  189|  87.4k|{
  190|  87.4k|    PJ_ASSERT_RETURN(lock != NULL, PJ_EINVAL);
  ------------------
  |  |   59|  87.4k|            do { \
  |  |   60|  87.4k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 87.4k]
  |  |  ------------------
  |  |   61|  87.4k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  191|  87.4k|    return (*lock->release)(lock->lock_object);
  192|  87.4k|}
pj_lock_destroy:
  195|   337k|{
  196|   337k|    PJ_ASSERT_RETURN(lock != NULL, PJ_EINVAL);
  ------------------
  |  |   59|   337k|            do { \
  |  |   60|   337k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 337k]
  |  |  ------------------
  |  |   61|   337k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  197|   337k|    return (*lock->destroy)(lock->lock_object);
  198|   337k|}
pj_grp_lock_create:
  413|  4.82k|{
  414|  4.82k|    pj_grp_lock_t *glock;
  415|  4.82k|    grp_lock_item *own_lock;
  416|  4.82k|    pj_status_t status;
  417|       |
  418|  4.82k|    PJ_ASSERT_RETURN(pool && p_grp_lock, PJ_EINVAL);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  9.64k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 4.82k, False: 0]
  |  |  |  Branch (60:23): [True: 4.82k, False: 0]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  419|       |
  420|  4.82k|    PJ_UNUSED_ARG(cfg);
  ------------------
  |  | 1433|  4.82k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  421|       |
  422|  4.82k|    pool = pj_pool_create(pool->factory, "glck%p", 512, 512, NULL);
  423|  4.82k|    if (!pool)
  ------------------
  |  Branch (423:9): [True: 0, False: 4.82k]
  ------------------
  424|      0|        return PJ_ENOMEM;
  ------------------
  |  |  348|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  425|       |
  426|  4.82k|    glock = PJ_POOL_ZALLOC_T(pool, pj_grp_lock_t);
  ------------------
  |  |  520|  4.82k|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  427|  4.82k|    glock->base.lock_object = glock;
  428|  4.82k|    glock->base.acquire = &grp_lock_acquire;
  429|  4.82k|    glock->base.tryacquire = &grp_lock_tryacquire;
  430|  4.82k|    glock->base.release = &grp_lock_release;
  431|  4.82k|    glock->base.destroy = &grp_lock_destroy;
  432|       |
  433|  4.82k|    glock->pool = pool;
  434|  4.82k|    pj_list_init(&glock->lock_list);
  435|  4.82k|    pj_list_init(&glock->destroy_list);
  436|       |#if PJ_GRP_LOCK_DEBUG
  437|       |    pj_list_init(&glock->ref_list);
  438|       |    pj_list_init(&glock->ref_free_list);
  439|       |#endif
  440|       |
  441|  4.82k|    status = pj_atomic_create(pool, 0, &glock->ref_cnt);
  442|  4.82k|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (442:9): [True: 0, False: 4.82k]
  ------------------
  443|      0|        goto on_error;
  444|       |
  445|  4.82k|    status = pj_lock_create_recursive_mutex(pool, pool->obj_name,
  446|  4.82k|                                            &glock->own_lock);
  447|  4.82k|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (447:9): [True: 0, False: 4.82k]
  ------------------
  448|      0|        goto on_error;
  449|       |
  450|  4.82k|    own_lock = PJ_POOL_ZALLOC_T(pool, grp_lock_item);
  ------------------
  |  |  520|  4.82k|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  451|  4.82k|    own_lock->lock = glock->own_lock;
  452|  4.82k|    pj_list_push_back(&glock->lock_list, own_lock);
  453|       |
  454|  4.82k|    *p_grp_lock = glock;
  455|  4.82k|    return PJ_SUCCESS;
  456|       |
  457|      0|on_error:
  458|      0|    grp_lock_destroy(glock);
  459|      0|    return status;
  460|  4.82k|}
pj_grp_lock_add_ref:
  648|  4.82k|{
  649|  4.82k|    return grp_lock_add_ref(glock);
  650|  4.82k|}
pj_grp_lock_dec_ref:
  653|  4.82k|{
  654|  4.82k|    return grp_lock_dec_ref(glock);
  655|  4.82k|}
lock.c:create_mutex_lock:
   62|   337k|{
   63|   337k|    pj_lock_t *p_lock;
   64|   337k|    pj_mutex_t *mutex;
   65|   337k|    pj_status_t rc;
   66|       |
   67|   337k|    PJ_ASSERT_RETURN(pool && lock, PJ_EINVAL);
  ------------------
  |  |   59|   337k|            do { \
  |  |   60|   675k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 337k, False: 0]
  |  |  |  Branch (60:23): [True: 337k, False: 0]
  |  |  ------------------
  |  |   61|   337k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
   68|       |
   69|   337k|    p_lock = PJ_POOL_ALLOC_T(pool, pj_lock_t);
  ------------------
  |  |  506|   337k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
   70|   337k|    if (!p_lock)
  ------------------
  |  Branch (70:9): [True: 0, False: 337k]
  ------------------
   71|      0|        return PJ_ENOMEM;
  ------------------
  |  |  348|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   72|       |
   73|   337k|    pj_memcpy(p_lock, &mutex_lock_template, sizeof(pj_lock_t));
   74|   337k|    rc = pj_mutex_create(pool, name, type, &mutex);
   75|   337k|    if (rc != PJ_SUCCESS)
  ------------------
  |  Branch (75:9): [True: 0, False: 337k]
  ------------------
   76|      0|        return rc;
   77|       |
   78|   337k|    p_lock->lock_object = mutex;
   79|   337k|    *lock = p_lock;
   80|   337k|    return PJ_SUCCESS;
   81|   337k|}
lock.c:grp_lock_destroy:
  371|  4.82k|{
  372|  4.82k|    pj_grp_lock_t *glock = (pj_grp_lock_t*)p;
  373|  4.82k|    pj_pool_t *pool = glock->pool;
  374|  4.82k|    grp_lock_item *lck;
  375|  4.82k|    grp_destroy_callback *cb;
  376|       |
  377|  4.82k|    if (!glock->pool) {
  ------------------
  |  Branch (377:9): [True: 0, False: 4.82k]
  ------------------
  378|       |        /* already destroyed?! */
  379|      0|        return PJ_EINVAL;
  ------------------
  |  |  333|      0|#define PJ_EINVAL           (PJ_ERRNO_START_STATUS + 4) /* 70004 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  380|      0|    }
  381|       |
  382|       |    /* Release all chained locks */
  383|  4.82k|    lck = glock->lock_list.next;
  384|  9.64k|    while (lck != &glock->lock_list) {
  ------------------
  |  Branch (384:12): [True: 4.82k, False: 4.82k]
  ------------------
  385|  4.82k|        if (lck->lock != glock->own_lock) {
  ------------------
  |  Branch (385:13): [True: 0, False: 4.82k]
  ------------------
  386|      0|            int i;
  387|      0|            for (i=0; i<glock->owner_cnt; ++i)
  ------------------
  |  Branch (387:23): [True: 0, False: 0]
  ------------------
  388|      0|                pj_lock_release(lck->lock);
  389|      0|        }
  390|  4.82k|        lck = lck->next;
  391|  4.82k|    }
  392|       |
  393|       |    /* Call callbacks */
  394|  4.82k|    cb = glock->destroy_list.next;
  395|  4.82k|    while (cb != &glock->destroy_list) {
  ------------------
  |  Branch (395:12): [True: 0, False: 4.82k]
  ------------------
  396|      0|        grp_destroy_callback *next = cb->next;
  397|      0|        cb->handler(cb->comp);
  398|      0|        cb = next;
  399|      0|    }
  400|       |
  401|  4.82k|    pj_lock_destroy(glock->own_lock);
  402|  4.82k|    pj_atomic_destroy(glock->ref_cnt);
  403|  4.82k|    glock->pool = NULL;
  404|  4.82k|    pj_pool_release(pool);
  405|       |
  406|  4.82k|    return PJ_SUCCESS;
  407|  4.82k|}
lock.c:grp_lock_add_ref:
  554|  4.82k|{
  555|  4.82k|    pj_atomic_inc(glock->ref_cnt);
  556|  4.82k|    return PJ_SUCCESS;
  557|  4.82k|}
lock.c:grp_lock_dec_ref:
  560|  4.82k|{
  561|  4.82k|    int cnt; /* for debugging */
  562|  4.82k|    if ((cnt=pj_atomic_dec_and_get(glock->ref_cnt)) == 0) {
  ------------------
  |  Branch (562:9): [True: 4.82k, False: 0]
  ------------------
  563|  4.82k|        grp_lock_destroy(glock);
  564|  4.82k|        return PJ_EGONE;
  ------------------
  |  |  429|  4.82k|#define PJ_EGONE            (PJ_ERRNO_START_STATUS + 23)/* 70023 */
  |  |  ------------------
  |  |  |  |  456|  4.82k|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|  4.82k|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|  4.82k|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  565|  4.82k|    }
  566|      0|    pj_assert(cnt > 0);
  ------------------
  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  ------------------
  567|      0|    return PJ_SUCCESS;
  568|      0|}

pj_log_init:
  149|      1|{
  150|      1|#if PJ_HAS_THREADS
  151|      1|    if (thread_suspended_tls_id == -1) {
  ------------------
  |  Branch (151:9): [True: 1, False: 0]
  ------------------
  152|      1|        pj_status_t status;
  153|      1|        status = pj_thread_local_alloc(&thread_suspended_tls_id);
  154|      1|        if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (154:13): [True: 0, False: 1]
  ------------------
  155|      0|            thread_suspended_tls_id = -1;
  156|      0|            return status;
  157|      0|        }
  158|       |
  159|      1|#  if PJ_LOG_ENABLE_INDENT
  160|      1|        status = pj_thread_local_alloc(&thread_indent_tls_id);
  161|      1|        if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (161:13): [True: 0, False: 1]
  ------------------
  162|      0|            pj_thread_local_free(thread_suspended_tls_id);
  163|      0|            thread_suspended_tls_id = -1;
  164|      0|            thread_indent_tls_id = -1;
  165|      0|            return status;
  166|      0|        }
  167|      1|#  endif
  168|      1|        pj_atexit(&logging_shutdown);
  169|      1|    }
  170|      1|#endif
  171|      1|    g_last_thread = NULL;
  172|       |
  173|       |    /* Normalize log decor, e.g: unset thread flags when threading is
  174|       |     * disabled.
  175|       |     */
  176|      1|    pj_log_set_decor(pj_log_get_decor());
  177|       |
  178|      1|    return PJ_SUCCESS;
  179|      1|}
pj_log_set_decor:
  182|      1|{
  183|      1|    log_decor = decor;
  184|       |
  185|       |#if !PJ_HAS_THREADS
  186|       |    /* Unset thread related flags */
  187|       |    if (log_decor & PJ_LOG_HAS_THREAD_ID) {
  188|       |       log_decor &= ~(PJ_LOG_HAS_THREAD_ID);
  189|       |    }
  190|       |    if (log_decor & PJ_LOG_HAS_THREAD_SWC) {
  191|       |       log_decor &= ~(PJ_LOG_HAS_THREAD_SWC);
  192|       |    }
  193|       |#endif
  194|      1|}
pj_log_get_decor:
  197|      1|{
  198|      1|    return log_decor;
  199|      1|}
pj_log_set_level:
  252|  4.82k|{
  253|  4.82k|    pj_log_max_level = level;
  254|  4.82k|}
pj_log_get_level:
  258|  1.83M|{
  259|  1.83M|    return pj_log_max_level;
  260|  1.83M|}

pj_init:
  175|  4.82k|{
  176|  4.82k|    char dummy_guid[PJ_GUID_MAX_LENGTH];
  177|  4.82k|    pj_str_t guid;
  178|  4.82k|    pj_status_t rc;
  179|       |
  180|       |    /* Check if PJLIB have been initialized */
  181|  4.82k|    if (initialized) {
  ------------------
  |  Branch (181:9): [True: 4.82k, False: 1]
  ------------------
  182|  4.82k|        ++initialized;
  183|  4.82k|        return PJ_SUCCESS;
  184|  4.82k|    }
  185|       |
  186|       |    /* Init logging */
  187|      1|    pj_log_init();
  188|       |
  189|      1|#if PJ_HAS_THREADS
  190|       |    /* Init this thread's TLS. */
  191|      1|    if ((rc=pj_thread_init()) != 0) {
  ------------------
  |  Branch (191:9): [True: 0, False: 1]
  ------------------
  192|      0|        return rc;
  193|      0|    }
  194|       |
  195|       |    /* Critical section. */
  196|      1|    if ((rc=init_mutex(&critical_section, "critsec", PJ_MUTEX_RECURSE)) != 0)
  ------------------
  |  Branch (196:9): [True: 0, False: 1]
  ------------------
  197|      0|        return rc;
  198|       |
  199|      1|#endif
  200|       |
  201|       |    /* Initialize exception ID for the pool.
  202|       |     * Must do so after critical section is configured.
  203|       |     */
  204|      1|    rc = pj_exception_id_alloc("PJLIB/No memory", &PJ_NO_MEMORY_EXCEPTION);
  205|      1|    if (rc != PJ_SUCCESS)
  ------------------
  |  Branch (205:9): [True: 0, False: 1]
  ------------------
  206|      0|        return rc;
  207|       |
  208|       |    /* Init random seed. */
  209|       |    /* Or probably not. Let application in charge of this */
  210|       |    /* pj_srand( clock() ); */
  211|       |
  212|       |    /* Startup GUID. */
  213|      1|    guid.ptr = dummy_guid;
  214|      1|    pj_generate_unique_string( &guid );
  215|       |
  216|       |    /* Startup timestamp */
  217|      1|#if defined(PJ_HAS_HIGH_RES_TIMER) && PJ_HAS_HIGH_RES_TIMER != 0
  218|      1|    {
  219|      1|        pj_timestamp dummy_ts;
  220|      1|        if ((rc=pj_get_timestamp(&dummy_ts)) != 0) {
  ------------------
  |  Branch (220:13): [True: 0, False: 1]
  ------------------
  221|      0|            return rc;
  222|      0|        }
  223|      1|    }
  224|      1|#endif
  225|       |
  226|       |    /* Flag PJLIB as initialized */
  227|      1|    ++initialized;
  228|      1|    pj_assert(initialized == 1);
  ------------------
  |  |   48|      1|#   define pj_assert(expr)   assert(expr)
  ------------------
  229|       |
  230|      1|    PJ_LOG(4,(THIS_FILE, "pjlib %s for POSIX initialized",
  ------------------
  |  |  106|      1|#define PJ_LOG(level,arg)       do { \
  |  |  107|      1|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 1]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|      1|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  231|      1|              PJ_VERSION));
  232|       |
  233|      1|    return PJ_SUCCESS;
  234|      1|}
pj_atexit:
  240|      3|{
  241|      3|    if (atexit_count >= PJ_ARRAY_SIZE(atexit_func))
  ------------------
  |  |  294|      3|#define PJ_ARRAY_SIZE(a)    (sizeof(a)/sizeof(a[0]))
  ------------------
  |  Branch (241:9): [True: 0, False: 3]
  ------------------
  242|      0|        return PJ_ETOOMANY;
  ------------------
  |  |  363|      0|#define PJ_ETOOMANY         (PJ_ERRNO_START_STATUS + 10)/* 70010 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  243|       |
  244|      3|    atexit_func[atexit_count++] = func;
  245|      3|    return PJ_SUCCESS;
  246|      3|}
pj_thread_register:
  547|      1|{
  548|      1|#if PJ_HAS_THREADS
  549|      1|    char stack_ptr;
  550|      1|    pj_status_t rc;
  551|      1|    pj_thread_t *thread = (pj_thread_t *)desc;
  552|      1|    pj_str_t thread_name = pj_str((char*)cstr_thread_name);
  553|       |
  554|       |    /* Size sanity check. */
  555|      1|    if (sizeof(pj_thread_desc) < sizeof(pj_thread_t)) {
  ------------------
  |  Branch (555:9): [Folded - Ignored]
  ------------------
  556|      0|        pj_assert(!"Not enough pj_thread_desc size!");
  ------------------
  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  ------------------
  557|      0|        return PJ_EBUG;
  ------------------
  |  |  353|      0|#define PJ_EBUG             (PJ_ERRNO_START_STATUS + 8) /* 70008 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  558|      0|    }
  559|       |
  560|       |    /* Warn if this thread has been registered before */
  561|      1|    if (pj_thread_local_get (thread_tls_id) != 0) {
  ------------------
  |  Branch (561:9): [True: 0, False: 1]
  ------------------
  562|       |        // 2006-02-26 bennylp:
  563|       |        //  This wouldn't work in all cases!.
  564|       |        //  If thread is created by external module (e.g. sound thread),
  565|       |        //  thread may be reused while the pool used for the thread descriptor
  566|       |        //  has been deleted by application.
  567|       |        //*thread_ptr = (pj_thread_t*)pj_thread_local_get (thread_tls_id);
  568|       |        //return PJ_SUCCESS;
  569|      0|        PJ_LOG(4,(THIS_FILE, "Info: possibly re-registering existing "
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  570|      0|                             "thread"));
  571|      0|    }
  572|       |
  573|       |    /* On the other hand, also warn if the thread descriptor buffer seem to
  574|       |     * have been used to register other threads.
  575|       |     */
  576|      1|    pj_assert(thread->signature1 != SIGNATURE1 ||
  ------------------
  |  |   48|      1|#   define pj_assert(expr)   assert(expr)
  ------------------
  577|      1|              thread->signature2 != SIGNATURE2 ||
  578|      1|              (thread->thread == pthread_self()));
  579|       |
  580|       |    /* Initialize and set the thread entry. */
  581|      1|    pj_bzero(desc, sizeof(struct pj_thread_t));
  582|      1|    thread->thread = pthread_self();
  583|      1|    thread->signature1 = SIGNATURE1;
  ------------------
  |  |   60|      1|#define SIGNATURE1  0xDEAFBEEF
  ------------------
  584|      1|    thread->signature2 = SIGNATURE2;
  ------------------
  |  |   61|      1|#define SIGNATURE2  0xDEADC0DE
  ------------------
  585|       |
  586|      1|    if(cstr_thread_name && pj_strlen(&thread_name) < sizeof(thread->obj_name)-1)
  ------------------
  |  Branch (586:8): [True: 1, False: 0]
  |  Branch (586:28): [True: 1, False: 0]
  ------------------
  587|      1|        pj_ansi_snprintf(thread->obj_name, sizeof(thread->obj_name),
  ------------------
  |  |  114|      1|#define pj_ansi_snprintf        snprintf
  ------------------
  588|      1|                         cstr_thread_name, thread->thread);
  589|      0|    else
  590|      0|        pj_ansi_snprintf(thread->obj_name, sizeof(thread->obj_name),
  ------------------
  |  |  114|      0|#define pj_ansi_snprintf        snprintf
  ------------------
  591|      0|                         "thr%p", (void*)thread->thread);
  592|       |
  593|      1|    rc = pj_thread_local_set(thread_tls_id, thread);
  594|      1|    if (rc != PJ_SUCCESS) {
  ------------------
  |  Branch (594:9): [True: 0, False: 1]
  ------------------
  595|      0|        pj_bzero(desc, sizeof(struct pj_thread_t));
  596|      0|        return rc;
  597|      0|    }
  598|       |
  599|       |#if defined(PJ_OS_HAS_CHECK_STACK) && PJ_OS_HAS_CHECK_STACK!=0
  600|       |    thread->stk_start = &stack_ptr;
  601|       |    thread->stk_size = 0xFFFFFFFFUL;
  602|       |    thread->stk_max_usage = 0;
  603|       |#else
  604|      1|    PJ_UNUSED_ARG(stack_ptr);
  ------------------
  |  | 1433|      1|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  605|      1|#endif
  606|       |
  607|      1|    *ptr_thread = thread;
  608|      1|    return PJ_SUCCESS;
  609|       |#else
  610|       |    pj_thread_t *thread = (pj_thread_t*)desc;
  611|       |    *ptr_thread = thread;
  612|       |    return PJ_SUCCESS;
  613|       |#endif
  614|      1|}
pj_thread_init:
  620|      1|{
  621|      1|#if PJ_HAS_THREADS
  622|      1|    pj_status_t rc;
  623|      1|    pj_thread_t *dummy;
  624|       |
  625|      1|    rc = pj_thread_local_alloc(&thread_tls_id );
  626|      1|    if (rc != PJ_SUCCESS) {
  ------------------
  |  Branch (626:9): [True: 0, False: 1]
  ------------------
  627|      0|        return rc;
  628|      0|    }
  629|      1|    return pj_thread_register("thr%p", main_thread_desc, &dummy);
  630|       |#else
  631|       |    PJ_LOG(2,(THIS_FILE, "Thread init error. Threading is not enabled!"));
  632|       |    return PJ_EINVALIDOP;
  633|       |#endif
  634|      1|}
pj_thread_create:
  720|  4.82k|{
  721|  4.82k|#if PJ_HAS_THREADS
  722|  4.82k|    pj_thread_t *rec;
  723|  4.82k|    pthread_attr_t thread_attr;
  724|  4.82k|    void *stack_addr;
  725|  4.82k|    int rc;
  726|       |
  727|  4.82k|    PJ_UNUSED_ARG(stack_addr);
  ------------------
  |  | 1433|  4.82k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  728|       |
  729|  4.82k|    PJ_CHECK_STACK();
  730|  4.82k|    PJ_ASSERT_RETURN(pool && proc && ptr_thread, PJ_EINVAL);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  19.2k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 4.82k, False: 0]
  |  |  |  Branch (60:23): [True: 4.82k, False: 0]
  |  |  |  Branch (60:23): [True: 4.82k, False: 0]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  731|       |
  732|       |    /* Create thread record and assign name for the thread */
  733|  4.82k|    rec = (struct pj_thread_t*) pj_pool_zalloc(pool, sizeof(pj_thread_t));
  734|  4.82k|    PJ_ASSERT_RETURN(rec, PJ_ENOMEM);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  735|       |
  736|       |    /* Set name. */
  737|  4.82k|    if (!thread_name)
  ------------------
  |  Branch (737:9): [True: 0, False: 4.82k]
  ------------------
  738|      0|        thread_name = "thr%p";
  739|       |
  740|  4.82k|    if (strchr(thread_name, '%')) {
  ------------------
  |  Branch (740:9): [True: 0, False: 4.82k]
  ------------------
  741|      0|        pj_ansi_snprintf(rec->obj_name, PJ_MAX_OBJ_NAME, thread_name, rec);
  ------------------
  |  |  114|      0|#define pj_ansi_snprintf        snprintf
  ------------------
                      pj_ansi_snprintf(rec->obj_name, PJ_MAX_OBJ_NAME, thread_name, rec);
  ------------------
  |  |  299|      0|#define PJ_MAX_OBJ_NAME 32
  ------------------
  742|  4.82k|    } else {
  743|  4.82k|        pj_ansi_strxcpy(rec->obj_name, thread_name, PJ_MAX_OBJ_NAME);
  ------------------
  |  |  299|  4.82k|#define PJ_MAX_OBJ_NAME 32
  ------------------
  744|  4.82k|    }
  745|       |
  746|       |    /* Set default stack size */
  747|  4.82k|    if (stack_size == 0)
  ------------------
  |  Branch (747:9): [True: 4.82k, False: 0]
  ------------------
  748|  4.82k|        stack_size = PJ_THREAD_DEFAULT_STACK_SIZE;
  ------------------
  |  |  623|  4.82k|#  define PJ_THREAD_DEFAULT_STACK_SIZE    8192
  ------------------
  749|       |
  750|       |#if defined(PJ_OS_HAS_CHECK_STACK) && PJ_OS_HAS_CHECK_STACK!=0
  751|       |    rec->stk_size = stack_size;
  752|       |    rec->stk_max_usage = 0;
  753|       |#endif
  754|       |
  755|       |    /* Emulate suspended thread with mutex. */
  756|  4.82k|    if (flags & PJ_THREAD_SUSPENDED) {
  ------------------
  |  Branch (756:9): [True: 4.82k, False: 0]
  ------------------
  757|  4.82k|        rc = pj_mutex_create_simple(pool, NULL, &rec->suspended_mutex);
  758|  4.82k|        if (rc != PJ_SUCCESS) {
  ------------------
  |  Branch (758:13): [True: 0, False: 4.82k]
  ------------------
  759|      0|            return rc;
  760|      0|        }
  761|       |
  762|  4.82k|        pj_mutex_lock(rec->suspended_mutex);
  763|  4.82k|    } else {
  764|      0|        pj_assert(rec->suspended_mutex == NULL);
  ------------------
  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  ------------------
  765|      0|    }
  766|       |
  767|       |
  768|       |    /* Init thread attributes */
  769|  4.82k|    pthread_attr_init(&thread_attr);
  770|       |
  771|       |#if defined(PJ_THREAD_SET_STACK_SIZE) && PJ_THREAD_SET_STACK_SIZE!=0
  772|       |    /* Set thread's stack size */
  773|       |    rc = pthread_attr_setstacksize(&thread_attr, stack_size);
  774|       |    if (rc != 0) {
  775|       |        pthread_attr_destroy(&thread_attr);
  776|       |        return PJ_RETURN_OS_ERROR(rc);
  777|       |    }
  778|       |#endif  /* PJ_THREAD_SET_STACK_SIZE */
  779|       |
  780|       |
  781|       |#if defined(PJ_THREAD_ALLOCATE_STACK) && PJ_THREAD_ALLOCATE_STACK!=0
  782|       |    /* Allocate memory for the stack */
  783|       |    stack_addr = pj_pool_alloc(pool, stack_size);
  784|       |    PJ_ASSERT_RETURN(stack_addr, PJ_ENOMEM);
  785|       |
  786|       |    rc = pthread_attr_setstackaddr(&thread_attr, stack_addr);
  787|       |    if (rc != 0) {
  788|       |        pthread_attr_destroy(&thread_attr);
  789|       |        return PJ_RETURN_OS_ERROR(rc);
  790|       |    }
  791|       |#endif  /* PJ_THREAD_ALLOCATE_STACK */
  792|       |
  793|       |
  794|       |    /* Create the thread. */
  795|  4.82k|    rec->proc = proc;
  796|  4.82k|    rec->arg = arg;
  797|  4.82k|    rc = pthread_create( &rec->thread, &thread_attr, &thread_main, rec);
  798|  4.82k|    if (rc != 0) {
  ------------------
  |  Branch (798:9): [True: 0, False: 4.82k]
  ------------------
  799|      0|        pthread_attr_destroy(&thread_attr);
  800|      0|        return PJ_RETURN_OS_ERROR(rc);
  ------------------
  |  |  259|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (259:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  260|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  274|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  463|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  801|      0|    }
  802|       |
  803|       |    /* Destroy thread attributes */
  804|  4.82k|    pthread_attr_destroy(&thread_attr);
  805|       |
  806|  4.82k|    *ptr_thread = rec;
  807|       |
  808|  4.82k|    PJ_LOG(6, (rec->obj_name, "Thread created"));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  809|  4.82k|    return PJ_SUCCESS;
  810|       |#else
  811|       |    pj_assert(!"Threading is disabled!");
  812|       |    return PJ_EINVALIDOP;
  813|       |#endif
  814|  4.82k|}
pj_thread_resume:
  837|  4.82k|{
  838|  4.82k|    pj_status_t rc;
  839|       |
  840|  4.82k|    PJ_CHECK_STACK();
  841|  4.82k|    PJ_ASSERT_RETURN(p, PJ_EINVAL);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  842|       |
  843|  4.82k|    rc = pj_mutex_unlock(p->suspended_mutex);
  844|       |
  845|  4.82k|    return rc;
  846|  4.82k|}
pj_thread_this:
  852|   295k|{
  853|   295k|#if PJ_HAS_THREADS
  854|   295k|    pj_thread_t *rec = (pj_thread_t*)pj_thread_local_get(thread_tls_id);
  855|       |
  856|   295k|    if (rec == NULL) {
  ------------------
  |  Branch (856:9): [True: 0, False: 295k]
  ------------------
  857|      0|        pj_assert(!"Calling pjlib from unknown/external thread. You must "
  ------------------
  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  ------------------
  858|      0|                   "register external threads with pj_thread_register() "
  859|      0|                   "before calling any pjlib functions.");
  860|      0|    }
  861|       |
  862|       |    /*
  863|       |     * MUST NOT check stack because this function is called
  864|       |     * by PJ_CHECK_STACK() itself!!!
  865|       |     *
  866|       |     */
  867|       |
  868|   295k|    return rec;
  869|       |#else
  870|       |    pj_assert(!"Threading is not enabled!");
  871|       |    return NULL;
  872|       |#endif
  873|   295k|}
pj_thread_join:
  879|  4.82k|{
  880|  4.82k|#if PJ_HAS_THREADS
  881|  4.82k|    pj_thread_t *rec = (pj_thread_t *)p;
  882|  4.82k|    void *ret;
  883|  4.82k|    int result;
  884|       |
  885|  4.82k|    PJ_CHECK_STACK();
  886|       |
  887|  4.82k|    if (p == pj_thread_this())
  ------------------
  |  Branch (887:9): [True: 0, False: 4.82k]
  ------------------
  888|      0|        return PJ_ECANCELLED;
  ------------------
  |  |  383|      0|#define PJ_ECANCELLED       (PJ_ERRNO_START_STATUS + 14)/* 70014 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  889|       |
  890|  4.82k|    PJ_LOG(6, (pj_thread_this()->obj_name, "Joining thread %s", p->obj_name));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  891|  4.82k|    result = pthread_join( rec->thread, &ret);
  892|       |
  893|  4.82k|    if (result == 0)
  ------------------
  |  Branch (893:9): [True: 4.82k, False: 0]
  ------------------
  894|  4.82k|        return PJ_SUCCESS;
  895|      0|    else {
  896|       |        /* Calling pthread_join() on a thread that no longer exists and
  897|       |         * getting back ESRCH isn't an error (in this context).
  898|       |         * Thanks Phil Torre <ptorre@zetron.com>.
  899|       |         */
  900|      0|        return result==ESRCH ? PJ_SUCCESS : PJ_RETURN_OS_ERROR(result);
  ------------------
  |  |  259|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (259:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  260|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  274|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  463|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (900:16): [True: 0, False: 0]
  ------------------
  901|      0|    }
  902|       |#else
  903|       |    PJ_CHECK_STACK();
  904|       |    pj_assert(!"No multithreading support!");
  905|       |    return PJ_EINVALIDOP;
  906|       |#endif
  907|  4.82k|}
pj_thread_destroy:
  913|  4.82k|{
  914|  4.82k|    PJ_CHECK_STACK();
  915|       |
  916|       |    /* Destroy mutex used to suspend thread */
  917|  4.82k|    if (p->suspended_mutex) {
  ------------------
  |  Branch (917:9): [True: 4.82k, False: 0]
  ------------------
  918|  4.82k|        pj_mutex_destroy(p->suspended_mutex);
  919|  4.82k|        p->suspended_mutex = NULL;
  920|  4.82k|    }
  921|       |
  922|  4.82k|    return PJ_SUCCESS;
  923|  4.82k|}
pj_thread_sleep:
  929|    587|{
  930|       |/* TODO: should change this to something like PJ_OS_HAS_NANOSLEEP */
  931|       |#if defined(PJ_RTEMS) && PJ_RTEMS!=0
  932|       |    enum { NANOSEC_PER_MSEC = 1000000 };
  933|       |    struct timespec req;
  934|       |
  935|       |    PJ_CHECK_STACK();
  936|       |    req.tv_sec = msec / 1000;
  937|       |    req.tv_nsec = (msec % 1000) * NANOSEC_PER_MSEC;
  938|       |
  939|       |    if (nanosleep(&req, NULL) == 0)
  940|       |        return PJ_SUCCESS;
  941|       |
  942|       |    return PJ_RETURN_OS_ERROR(pj_get_native_os_error());
  943|       |#else
  944|    587|    PJ_CHECK_STACK();
  945|       |
  946|    587|    pj_set_os_error(0);
  947|       |
  948|    587|    usleep(msec * 1000);
  949|       |
  950|       |    /* MacOS X (reported on 10.5) seems to always set errno to ETIMEDOUT.
  951|       |     * It does so because usleep() is declared to return int, and we're
  952|       |     * supposed to check for errno only when usleep() returns non-zero.
  953|       |     * Unfortunately, usleep() is declared to return void in other platforms
  954|       |     * so it's not possible to always check for the return value (unless
  955|       |     * we add a detection routine in autoconf).
  956|       |     *
  957|       |     * As a workaround, here we check if ETIMEDOUT is returned and
  958|       |     * return successfully if it is.
  959|       |     */
  960|    587|    if (pj_get_native_os_error() == ETIMEDOUT)
  ------------------
  |  |   33|    587|#   define pj_get_native_os_error()         (errno)
  ------------------
  |  Branch (960:9): [True: 0, False: 587]
  ------------------
  961|      0|        return PJ_SUCCESS;
  962|       |
  963|    587|    return pj_get_os_error();
  964|       |
  965|    587|#endif  /* PJ_RTEMS */
  966|    587|}
pj_atomic_create:
 1025|  14.4k|{
 1026|  14.4k|    pj_status_t rc;
 1027|  14.4k|    pj_atomic_t *atomic_var;
 1028|       |
 1029|  14.4k|    atomic_var = PJ_POOL_ZALLOC_T(pool, pj_atomic_t);
  ------------------
  |  |  520|  14.4k|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
 1030|       |
 1031|  14.4k|    PJ_ASSERT_RETURN(atomic_var, PJ_ENOMEM);
  ------------------
  |  |   59|  14.4k|            do { \
  |  |   60|  14.4k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 14.4k]
  |  |  ------------------
  |  |   61|  14.4k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1032|       |
 1033|  14.4k|#if PJ_HAS_THREADS
 1034|  14.4k|    rc = pj_mutex_create(pool, "atm%p", PJ_MUTEX_SIMPLE, &atomic_var->mutex);
 1035|  14.4k|    if (rc != PJ_SUCCESS)
  ------------------
  |  Branch (1035:9): [True: 0, False: 14.4k]
  ------------------
 1036|      0|        return rc;
 1037|  14.4k|#endif
 1038|  14.4k|    atomic_var->value = initial;
 1039|       |
 1040|  14.4k|    *ptr_atomic = atomic_var;
 1041|  14.4k|    return PJ_SUCCESS;
 1042|  14.4k|}
pj_atomic_destroy:
 1048|  14.4k|{
 1049|  14.4k|    pj_status_t status;
 1050|       |
 1051|  14.4k|    PJ_ASSERT_RETURN(atomic_var, PJ_EINVAL);
  ------------------
  |  |   59|  14.4k|            do { \
  |  |   60|  14.4k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 14.4k]
  |  |  ------------------
  |  |   61|  14.4k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1052|       |    
 1053|  14.4k|#if PJ_HAS_THREADS
 1054|  14.4k|    status = pj_mutex_destroy( atomic_var->mutex );
 1055|  14.4k|    if (status == PJ_SUCCESS) {
  ------------------
  |  Branch (1055:9): [True: 14.4k, False: 0]
  ------------------
 1056|  14.4k|        atomic_var->mutex = NULL;
 1057|  14.4k|    }
 1058|  14.4k|    return status;
 1059|       |#else
 1060|       |    return 0;
 1061|       |#endif
 1062|  14.4k|}
pj_atomic_get:
 1090|  4.82k|{
 1091|  4.82k|    pj_atomic_value_t oldval;
 1092|       |
 1093|  4.82k|    PJ_CHECK_STACK();
 1094|       |
 1095|  4.82k|#if PJ_HAS_THREADS
 1096|  4.82k|    pj_mutex_lock( atomic_var->mutex );
 1097|  4.82k|#endif
 1098|  4.82k|    oldval = atomic_var->value;
 1099|  4.82k|#if PJ_HAS_THREADS
 1100|  4.82k|    pj_mutex_unlock( atomic_var->mutex);
 1101|  4.82k|#endif
 1102|  4.82k|    return oldval;
 1103|  4.82k|}
pj_atomic_inc_and_get:
 1109|  4.82k|{
 1110|  4.82k|    pj_atomic_value_t new_value;
 1111|       |
 1112|  4.82k|    PJ_CHECK_STACK();
 1113|       |
 1114|  4.82k|#if PJ_HAS_THREADS
 1115|  4.82k|    pj_mutex_lock( atomic_var->mutex );
 1116|  4.82k|#endif
 1117|  4.82k|    new_value = ++atomic_var->value;
 1118|  4.82k|#if PJ_HAS_THREADS
 1119|  4.82k|    pj_mutex_unlock( atomic_var->mutex);
 1120|  4.82k|#endif
 1121|       |
 1122|  4.82k|    return new_value;
 1123|  4.82k|}
pj_atomic_inc:
 1128|  4.82k|{
 1129|  4.82k|    PJ_ASSERT_ON_FAIL(atomic_var, return);
  ------------------
  |  |   73|  4.82k|            { \
  |  |   74|  4.82k|                pj_assert(expr); \
  |  |  ------------------
  |  |  |  |   48|  4.82k|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |   75|  4.82k|                if (!(expr)) exec_on_fail; \
  |  |  ------------------
  |  |  |  Branch (75:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   76|  4.82k|            }
  ------------------
 1130|  4.82k|    pj_atomic_inc_and_get(atomic_var);
 1131|  4.82k|}
pj_atomic_dec_and_get:
 1137|  4.82k|{
 1138|  4.82k|    pj_atomic_value_t new_value;
 1139|       |
 1140|  4.82k|    PJ_CHECK_STACK();
 1141|       |
 1142|  4.82k|#if PJ_HAS_THREADS
 1143|  4.82k|    pj_mutex_lock( atomic_var->mutex );
 1144|  4.82k|#endif
 1145|  4.82k|    new_value = --atomic_var->value;
 1146|  4.82k|#if PJ_HAS_THREADS
 1147|  4.82k|    pj_mutex_unlock( atomic_var->mutex);
 1148|  4.82k|#endif
 1149|       |
 1150|  4.82k|    return new_value;
 1151|  4.82k|}
pj_thread_local_alloc:
 1199|      5|{
 1200|      5|#if PJ_HAS_THREADS
 1201|      5|    pthread_key_t key;
 1202|      5|    int rc;
 1203|       |
 1204|      5|    PJ_ASSERT_RETURN(p_index != NULL, PJ_EINVAL);
  ------------------
  |  |   59|      5|            do { \
  |  |   60|      5|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 5]
  |  |  ------------------
  |  |   61|      5|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1205|       |
 1206|      5|    pj_assert( sizeof(pthread_key_t) <= sizeof(long));
  ------------------
  |  |   48|      5|#   define pj_assert(expr)   assert(expr)
  ------------------
 1207|      5|    if ((rc=pthread_key_create(&key, NULL)) != 0)
  ------------------
  |  Branch (1207:9): [True: 0, False: 5]
  ------------------
 1208|      0|        return PJ_RETURN_OS_ERROR(rc);
  ------------------
  |  |  259|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (259:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  260|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  274|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  463|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1209|       |
 1210|      5|    *p_index = key;
 1211|      5|    return PJ_SUCCESS;
 1212|       |#else
 1213|       |    int i;
 1214|       |    for (i=0; i<MAX_THREADS; ++i) {
 1215|       |        if (tls_flag[i] == 0)
 1216|       |            break;
 1217|       |    }
 1218|       |    if (i == MAX_THREADS)
 1219|       |        return PJ_ETOOMANY;
 1220|       |
 1221|       |    tls_flag[i] = 1;
 1222|       |    tls[i] = NULL;
 1223|       |
 1224|       |    *p_index = i;
 1225|       |    return PJ_SUCCESS;
 1226|       |#endif
 1227|      5|}
pj_thread_local_set:
 1246|  91.0k|{
 1247|       |    //Can't check stack because this function is called in the
 1248|       |    //beginning before main thread is initialized.
 1249|       |    //PJ_CHECK_STACK();
 1250|  91.0k|#if PJ_HAS_THREADS
 1251|  91.0k|    int rc=pthread_setspecific(index, value);
 1252|  91.0k|    return rc==0 ? PJ_SUCCESS : PJ_RETURN_OS_ERROR(rc);
  ------------------
  |  |  259|      1|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (259:43): [True: 0, False: 1]
  |  |  ------------------
  |  |  260|      1|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  274|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  463|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1252:12): [True: 91.0k, False: 1]
  ------------------
 1253|       |#else
 1254|       |    pj_assert(index >= 0 && index < MAX_THREADS);
 1255|       |    tls[index] = value;
 1256|       |    return PJ_SUCCESS;
 1257|       |#endif
 1258|  91.0k|}
pj_thread_local_get:
 1261|   412k|{
 1262|       |    //Can't check stack because this function is called
 1263|       |    //by PJ_CHECK_STACK() itself!!!
 1264|       |    //PJ_CHECK_STACK();
 1265|   412k|#if PJ_HAS_THREADS
 1266|   412k|    return pthread_getspecific(index);
 1267|       |#else
 1268|       |    pj_assert(index >= 0 && index < MAX_THREADS);
 1269|       |    return tls[index];
 1270|       |#endif
 1271|   412k|}
pj_enter_critical_section:
 1275|  28.9k|{
 1276|  28.9k|#if PJ_HAS_THREADS
 1277|  28.9k|    pj_mutex_lock(&critical_section);
 1278|  28.9k|#endif
 1279|  28.9k|}
pj_leave_critical_section:
 1282|  28.9k|{
 1283|  28.9k|#if PJ_HAS_THREADS
 1284|  28.9k|    pj_mutex_unlock(&critical_section);
 1285|  28.9k|#endif
 1286|  28.9k|}
pj_mutex_create:
 1386|   371k|{
 1387|   371k|#if PJ_HAS_THREADS
 1388|   371k|    pj_status_t rc;
 1389|   371k|    pj_mutex_t *mutex;
 1390|       |
 1391|   371k|    PJ_ASSERT_RETURN(pool && ptr_mutex, PJ_EINVAL);
  ------------------
  |  |   59|   371k|            do { \
  |  |   60|   742k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 371k, False: 0]
  |  |  |  Branch (60:23): [True: 371k, False: 0]
  |  |  ------------------
  |  |   61|   371k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1392|       |
 1393|   371k|    mutex = PJ_POOL_ALLOC_T(pool, pj_mutex_t);
  ------------------
  |  |  506|   371k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
 1394|   371k|    PJ_ASSERT_RETURN(mutex, PJ_ENOMEM);
  ------------------
  |  |   59|   371k|            do { \
  |  |   60|   371k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 371k]
  |  |  ------------------
  |  |   61|   371k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1395|       |
 1396|   371k|    if ((rc=init_mutex(mutex, name, type)) != PJ_SUCCESS)
  ------------------
  |  Branch (1396:9): [True: 0, False: 371k]
  ------------------
 1397|      0|        return rc;
 1398|       |
 1399|   371k|    *ptr_mutex = mutex;
 1400|   371k|    return PJ_SUCCESS;
 1401|       |#else /* PJ_HAS_THREADS */
 1402|       |    *ptr_mutex = (pj_mutex_t*)1;
 1403|       |    return PJ_SUCCESS;
 1404|       |#endif
 1405|   371k|}
pj_mutex_create_simple:
 1413|  9.64k|{
 1414|  9.64k|    return pj_mutex_create(pool, name, PJ_MUTEX_SIMPLE, mutex);
 1415|  9.64k|}
pj_mutex_create_recursive:
 1423|  9.64k|{
 1424|  9.64k|    return pj_mutex_create(pool, name, PJ_MUTEX_RECURSE, mutex);
 1425|  9.64k|}
pj_mutex_lock:
 1431|   145k|{
 1432|   145k|#if PJ_HAS_THREADS
 1433|   145k|    pj_status_t status;
 1434|       |
 1435|   145k|    PJ_CHECK_STACK();
 1436|   145k|    PJ_ASSERT_RETURN(mutex, PJ_EINVAL);
  ------------------
  |  |   59|   145k|            do { \
  |  |   60|   145k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 145k]
  |  |  ------------------
  |  |   61|   145k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1437|       |
 1438|   145k|#if PJ_DEBUG
 1439|   145k|    PJ_LOG(6,(mutex->obj_name, "Mutex: thread %s is waiting (mutex owner=%s)",
  ------------------
  |  |  106|   145k|#define PJ_LOG(level,arg)       do { \
  |  |  107|   145k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 145k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|   145k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1440|   145k|                                pj_thread_this()->obj_name,
 1441|   145k|                                mutex->owner_name));
 1442|       |#else
 1443|       |    PJ_LOG(6,(mutex->obj_name, "Mutex: thread %s is waiting",
 1444|       |                                pj_thread_this()->obj_name));
 1445|       |#endif
 1446|       |
 1447|   145k|    status = pthread_mutex_lock( &mutex->mutex );
 1448|       |
 1449|       |
 1450|   145k|#if PJ_DEBUG
 1451|   145k|    if (status == PJ_SUCCESS) {
  ------------------
  |  Branch (1451:9): [True: 145k, False: 18.4E]
  ------------------
 1452|   145k|        mutex->owner = pj_thread_this();
 1453|   145k|        pj_ansi_strxcpy(mutex->owner_name, mutex->owner->obj_name,
 1454|   145k|                        sizeof(mutex->owner_name));
 1455|   145k|        ++mutex->nesting_level;
 1456|   145k|    }
 1457|       |
 1458|   145k|    PJ_LOG(6,(mutex->obj_name,
  ------------------
  |  |  106|   145k|#define PJ_LOG(level,arg)       do { \
  |  |  107|   145k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 145k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|   145k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1459|   145k|              (status==0 ?
 1460|   145k|                "Mutex acquired by thread %s (level=%d)" :
 1461|   145k|                "Mutex acquisition FAILED by %s (level=%d)"),
 1462|   145k|              pj_thread_this()->obj_name,
 1463|   145k|              mutex->nesting_level));
 1464|       |#else
 1465|       |    PJ_LOG(6,(mutex->obj_name,
 1466|       |              (status==0 ? "Mutex acquired by thread %s" : "FAILED by %s"),
 1467|       |              pj_thread_this()->obj_name));
 1468|       |#endif
 1469|       |
 1470|   145k|    if (status == 0)
  ------------------
  |  Branch (1470:9): [True: 145k, False: 18.4E]
  ------------------
 1471|   145k|        return PJ_SUCCESS;
 1472|  18.4E|    else
 1473|  18.4E|        return PJ_RETURN_OS_ERROR(status);
  ------------------
  |  |  259|  18.4E|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (259:43): [True: 0, False: 18.4E]
  |  |  ------------------
  |  |  260|  18.4E|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  274|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  463|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1474|       |#else   /* PJ_HAS_THREADS */
 1475|       |    pj_assert( mutex == (pj_mutex_t*)1 );
 1476|       |    return PJ_SUCCESS;
 1477|       |#endif
 1478|   145k|}
pj_mutex_unlock:
 1484|   145k|{
 1485|   145k|#if PJ_HAS_THREADS
 1486|   145k|    pj_status_t status;
 1487|       |
 1488|   145k|    PJ_CHECK_STACK();
 1489|   145k|    PJ_ASSERT_RETURN(mutex, PJ_EINVAL);
  ------------------
  |  |   59|   145k|            do { \
  |  |   60|   145k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 145k]
  |  |  ------------------
  |  |   61|   145k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1490|       |
 1491|   145k|#if PJ_DEBUG
 1492|   145k|    pj_assert(mutex->owner == pj_thread_this());
  ------------------
  |  |   48|   145k|#   define pj_assert(expr)   assert(expr)
  ------------------
 1493|   145k|    if (--mutex->nesting_level == 0) {
  ------------------
  |  Branch (1493:9): [True: 121k, False: 24.1k]
  ------------------
 1494|   121k|        mutex->owner = NULL;
 1495|   121k|        mutex->owner_name[0] = '\0';
 1496|   121k|    }
 1497|       |
 1498|   145k|    PJ_LOG(6,(mutex->obj_name, "Mutex released by thread %s (level=%d)",
  ------------------
  |  |  106|   145k|#define PJ_LOG(level,arg)       do { \
  |  |  107|   145k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 145k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|   145k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1499|   145k|                                pj_thread_this()->obj_name,
 1500|   145k|                                mutex->nesting_level));
 1501|       |#else
 1502|       |    PJ_LOG(6,(mutex->obj_name, "Mutex released by thread %s",
 1503|       |                                pj_thread_this()->obj_name));
 1504|       |#endif
 1505|       |
 1506|   145k|    status = pthread_mutex_unlock( &mutex->mutex );
 1507|   145k|    if (status == 0)
  ------------------
  |  Branch (1507:9): [True: 145k, False: 18.4E]
  ------------------
 1508|   145k|        return PJ_SUCCESS;
 1509|  18.4E|    else
 1510|  18.4E|        return PJ_RETURN_OS_ERROR(status);
  ------------------
  |  |  259|  18.4E|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (259:43): [True: 0, False: 18.4E]
  |  |  ------------------
  |  |  260|  18.4E|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  274|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  463|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1511|       |
 1512|       |#else /* PJ_HAS_THREADS */
 1513|       |    pj_assert( mutex == (pj_mutex_t*)1 );
 1514|       |    return PJ_SUCCESS;
 1515|       |#endif
 1516|   145k|}
pj_mutex_destroy:
 1567|   371k|{
 1568|   371k|    enum { RETRY = 4 };
 1569|   371k|    int status = 0;
 1570|   371k|    unsigned retry;
 1571|       |
 1572|   371k|    PJ_CHECK_STACK();
 1573|   371k|    PJ_ASSERT_RETURN(mutex, PJ_EINVAL);
  ------------------
  |  |   59|   371k|            do { \
  |  |   60|   371k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 371k]
  |  |  ------------------
  |  |   61|   371k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1574|       |
 1575|   371k|#if PJ_HAS_THREADS
 1576|   371k|    PJ_LOG(6,(mutex->obj_name, "Mutex destroyed by thread %s",
  ------------------
  |  |  106|   371k|#define PJ_LOG(level,arg)       do { \
  |  |  107|   371k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 371k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|   371k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1577|   371k|                               pj_thread_this()->obj_name));
 1578|       |
 1579|   371k|    for (retry=0; retry<RETRY; ++retry) {
  ------------------
  |  Branch (1579:19): [True: 371k, False: 0]
  ------------------
 1580|   371k|        status = pthread_mutex_destroy( &mutex->mutex );
 1581|   371k|        if (status == PJ_SUCCESS)
  ------------------
  |  Branch (1581:13): [True: 371k, False: 0]
  ------------------
 1582|   371k|            break;
 1583|      0|        else if (retry<RETRY-1 && status == EBUSY)
  ------------------
  |  Branch (1583:18): [True: 0, False: 0]
  |  Branch (1583:35): [True: 0, False: 0]
  ------------------
 1584|      0|            pthread_mutex_unlock(&mutex->mutex);
 1585|   371k|    }
 1586|       |
 1587|   371k|    if (status == 0)
  ------------------
  |  Branch (1587:9): [True: 371k, False: 0]
  ------------------
 1588|   371k|        return PJ_SUCCESS;
 1589|      0|    else {
 1590|      0|        return PJ_RETURN_OS_ERROR(status);
  ------------------
  |  |  259|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (259:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  260|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  274|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  463|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1591|      0|    }
 1592|       |#else
 1593|       |    pj_assert( mutex == (pj_mutex_t*)1 );
 1594|       |    status = PJ_SUCCESS;
 1595|       |    return status;
 1596|       |#endif
 1597|   371k|}
pj_rwmutex_create:
 1629|  4.82k|{
 1630|  4.82k|    pj_rwmutex_t *rwm;
 1631|  4.82k|    pj_status_t status;
 1632|       |
 1633|  4.82k|    PJ_UNUSED_ARG(name);
  ------------------
  |  | 1433|  4.82k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1634|       |
 1635|  4.82k|    rwm = PJ_POOL_ALLOC_T(pool, pj_rwmutex_t);
  ------------------
  |  |  506|  4.82k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
 1636|  4.82k|    PJ_ASSERT_RETURN(rwm, PJ_ENOMEM);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1637|       |
 1638|  4.82k|    status = pthread_rwlock_init(&rwm->rwlock, NULL);
 1639|  4.82k|    if (status != 0)
  ------------------
  |  Branch (1639:9): [True: 0, False: 4.82k]
  ------------------
 1640|      0|        return PJ_RETURN_OS_ERROR(status);
  ------------------
  |  |  259|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (259:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  260|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  274|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  463|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1641|       |
 1642|  4.82k|    *p_mutex = rwm;
 1643|  4.82k|    return PJ_SUCCESS;
 1644|  4.82k|}
pj_rwmutex_lock_write:
 1666|  14.4k|{
 1667|  14.4k|    pj_status_t status;
 1668|       |
 1669|  14.4k|    status = pthread_rwlock_wrlock(&mutex->rwlock);
 1670|  14.4k|    if (status != 0)
  ------------------
  |  Branch (1670:9): [True: 0, False: 14.4k]
  ------------------
 1671|      0|        return PJ_RETURN_OS_ERROR(status);
  ------------------
  |  |  259|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (259:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  260|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  274|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  463|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1672|       |
 1673|  14.4k|    return PJ_SUCCESS;
 1674|  14.4k|}
pj_rwmutex_unlock_write:
 1690|  14.4k|{
 1691|  14.4k|    pj_status_t status;
 1692|       |
 1693|  14.4k|    status = pthread_rwlock_unlock(&mutex->rwlock);
 1694|  14.4k|    if (status != 0)
  ------------------
  |  Branch (1694:9): [True: 0, False: 14.4k]
  ------------------
 1695|      0|        return PJ_RETURN_OS_ERROR(status);
  ------------------
  |  |  259|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (259:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  260|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  274|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  463|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1696|       |
 1697|  14.4k|    return PJ_SUCCESS;
 1698|  14.4k|}
pj_rwmutex_destroy:
 1705|  4.82k|{
 1706|  4.82k|    pj_status_t status;
 1707|       |
 1708|  4.82k|    status = pthread_rwlock_destroy(&mutex->rwlock);
 1709|  4.82k|    if (status != 0)
  ------------------
  |  Branch (1709:9): [True: 0, False: 4.82k]
  ------------------
 1710|      0|        return PJ_RETURN_OS_ERROR(status);
  ------------------
  |  |  259|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (259:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  260|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  274|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  463|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1711|       |
 1712|  4.82k|    return PJ_SUCCESS;
 1713|  4.82k|}
os_core_unix.c:thread_main:
  675|  4.82k|{
  676|  4.82k|    pj_thread_t *rec = (pj_thread_t*)param;
  677|  4.82k|    void *result;
  678|  4.82k|    pj_status_t rc;
  679|       |
  680|       |#if defined(PJ_OS_HAS_CHECK_STACK) && PJ_OS_HAS_CHECK_STACK!=0
  681|       |    rec->stk_start = (char*)&rec;
  682|       |#endif
  683|       |
  684|       |    /* Set current thread id. */
  685|  4.82k|    rc = pj_thread_local_set(thread_tls_id, rec);
  686|  4.82k|    if (rc != PJ_SUCCESS) {
  ------------------
  |  Branch (686:9): [True: 0, False: 4.82k]
  ------------------
  687|      0|        pj_assert(!"Thread TLS ID is not set (pj_init() error?)");
  ------------------
  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  ------------------
  688|      0|    }
  689|       |
  690|       |    /* Check if suspension is required. */
  691|  4.82k|    if (rec->suspended_mutex) {
  ------------------
  |  Branch (691:9): [True: 4.82k, False: 0]
  ------------------
  692|  4.82k|        pj_mutex_lock(rec->suspended_mutex);
  693|  4.82k|        pj_mutex_unlock(rec->suspended_mutex);
  694|  4.82k|    }
  695|       |
  696|  4.82k|    PJ_LOG(6,(rec->obj_name, "Thread started"));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  697|       |
  698|  4.82k|    set_thread_display_name(rec->obj_name);
  699|       |
  700|       |    /* Call user's entry! */
  701|  4.82k|    result = (void*)(long)(*rec->proc)(rec->arg);
  702|       |
  703|       |    /* Done. */
  704|  4.82k|    PJ_LOG(6,(rec->obj_name, "Thread quitting"));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  705|       |
  706|  4.82k|    return result;
  707|  4.82k|}
os_core_unix.c:set_thread_display_name:
  643|  4.82k|{
  644|  4.82k|#if (defined(PJ_LINUX) && PJ_LINUX != 0) || \
  645|  4.82k|    (defined(PJ_ANDROID) && PJ_ANDROID != 0)
  646|  4.82k|    char xname[16];
  647|       |    // On linux, thread display name length is restricted to 16 (include '\0')
  648|  4.82k|    if (pj_ansi_strlen(name) >= 16) {
  ------------------
  |  |   69|  4.82k|#define pj_ansi_strlen          strlen
  ------------------
  |  Branch (648:9): [True: 0, False: 4.82k]
  ------------------
  649|      0|        pj_memcpy(xname, name, 15);
  650|      0|        xname[15] = '\0';
  651|      0|        name = xname;
  652|      0|    }
  653|  4.82k|#endif
  654|       |
  655|  4.82k|#if defined(PJ_HAS_PTHREAD_SETNAME_NP) && PJ_HAS_PTHREAD_SETNAME_NP != 0
  656|       |#   if defined(PJ_DARWINOS) && PJ_DARWINOS != 0
  657|       |    pthread_setname_np(name);
  658|       |#   else
  659|  4.82k|    pthread_setname_np(pthread_self(), name);
  660|  4.82k|#   endif
  661|       |#elif defined(PJ_HAS_PTHREAD_SET_NAME_NP) && PJ_HAS_PTHREAD_SET_NAME_NP != 0
  662|       |    pthread_set_name_np(pthread_self(), name);
  663|       |#else
  664|       |// #   warning "OS does not support set thread display name"
  665|       |    PJ_UNUSED_ARG(name);
  666|       |#endif
  667|  4.82k|}
os_core_unix.c:init_mutex:
 1297|   371k|{
 1298|   371k|#if PJ_HAS_THREADS
 1299|   371k|    pthread_mutexattr_t attr;
 1300|   371k|    int rc;
 1301|       |
 1302|   371k|    PJ_CHECK_STACK();
 1303|       |
 1304|   371k|    rc = pthread_mutexattr_init(&attr);
 1305|   371k|    if (rc != 0)
  ------------------
  |  Branch (1305:9): [True: 0, False: 371k]
  ------------------
 1306|      0|        return PJ_RETURN_OS_ERROR(rc);
  ------------------
  |  |  259|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (259:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  260|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  274|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  463|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1307|       |
 1308|   371k|    if (type == PJ_MUTEX_SIMPLE) {
  ------------------
  |  Branch (1308:9): [True: 33.7k, False: 337k]
  ------------------
 1309|  33.7k|#if (defined(PJ_LINUX) && PJ_LINUX!=0) || \
 1310|  33.7k|    defined(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE)
 1311|  33.7k|        rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
 1312|       |#elif (defined(PJ_RTEMS) && PJ_RTEMS!=0) || \
 1313|       |       defined(PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE)
 1314|       |        /* Nothing to do, default is simple */
 1315|       |#else
 1316|       |        rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
 1317|       |#endif
 1318|   337k|    } else {
 1319|   337k|#if (defined(PJ_LINUX) && PJ_LINUX!=0) || \
 1320|   337k|     defined(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE)
 1321|   337k|        rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
 1322|       |#elif (defined(PJ_RTEMS) && PJ_RTEMS!=0) || \
 1323|       |       defined(PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE)
 1324|       |        // Phil Torre <ptorre@zetron.com>:
 1325|       |        // The RTEMS implementation of POSIX mutexes doesn't include
 1326|       |        // pthread_mutexattr_settype(), so what follows is a hack
 1327|       |        // until I get RTEMS patched to support the set/get functions.
 1328|       |        //
 1329|       |        // More info:
 1330|       |        //   newlib's pthread also lacks pthread_mutexattr_settype(),
 1331|       |        //   but it seems to have mutexattr.recursive.
 1332|       |        PJ_TODO(FIX_RTEMS_RECURSIVE_MUTEX_TYPE)
 1333|       |        attr.recursive = 1;
 1334|       |#else
 1335|       |        rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
 1336|       |#endif
 1337|   337k|    }
 1338|       |
 1339|   371k|    if (rc != 0) {
  ------------------
  |  Branch (1339:9): [True: 0, False: 371k]
  ------------------
 1340|      0|        return PJ_RETURN_OS_ERROR(rc);
  ------------------
  |  |  259|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (259:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  260|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  274|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  463|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1341|      0|    }
 1342|       |
 1343|   371k|    rc = pthread_mutex_init(&mutex->mutex, &attr);
 1344|   371k|    if (rc != 0) {
  ------------------
  |  Branch (1344:9): [True: 0, False: 371k]
  ------------------
 1345|      0|        return PJ_RETURN_OS_ERROR(rc);
  ------------------
  |  |  259|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (259:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  260|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  274|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  463|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1346|      0|    }
 1347|       |
 1348|   371k|    rc = pthread_mutexattr_destroy(&attr);
 1349|   371k|    if (rc != 0) {
  ------------------
  |  Branch (1349:9): [True: 0, False: 371k]
  ------------------
 1350|      0|        pj_status_t status = PJ_RETURN_OS_ERROR(rc);
  ------------------
  |  |  259|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (259:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  260|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  274|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  463|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1351|      0|        pthread_mutex_destroy(&mutex->mutex);
 1352|      0|        return status;
 1353|      0|    }
 1354|       |
 1355|   371k|#if PJ_DEBUG
 1356|       |    /* Set owner. */
 1357|   371k|    mutex->nesting_level = 0;
 1358|   371k|    mutex->owner = NULL;
 1359|   371k|    mutex->owner_name[0] = '\0';
 1360|   371k|#endif
 1361|       |
 1362|       |    /* Set name. */
 1363|   371k|    if (!name) {
  ------------------
  |  Branch (1363:9): [True: 318k, False: 53.0k]
  ------------------
 1364|   318k|        name = "mtx%p";
 1365|   318k|    }
 1366|   371k|    if (strchr(name, '%')) {
  ------------------
  |  Branch (1366:9): [True: 352k, False: 19.2k]
  ------------------
 1367|   352k|        pj_ansi_snprintf(mutex->obj_name, PJ_MAX_OBJ_NAME, name, mutex);
  ------------------
  |  |  114|   352k|#define pj_ansi_snprintf        snprintf
  ------------------
                      pj_ansi_snprintf(mutex->obj_name, PJ_MAX_OBJ_NAME, name, mutex);
  ------------------
  |  |  299|   352k|#define PJ_MAX_OBJ_NAME 32
  ------------------
 1368|   352k|    } else {
 1369|  19.2k|        pj_ansi_strxcpy(mutex->obj_name, name, PJ_MAX_OBJ_NAME);
  ------------------
  |  |  299|  19.2k|#define PJ_MAX_OBJ_NAME 32
  ------------------
 1370|  19.2k|    }
 1371|       |
 1372|   371k|    PJ_LOG(6, (mutex->obj_name, "Mutex created"));
  ------------------
  |  |  106|   371k|#define PJ_LOG(level,arg)       do { \
  |  |  107|   371k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 371k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|   371k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1373|   371k|    return PJ_SUCCESS;
 1374|       |#else /* PJ_HAS_THREADS */
 1375|       |    return PJ_SUCCESS;
 1376|       |#endif
 1377|   371k|}

pj_get_os_error:
   24|    587|{
   25|    587|    return PJ_STATUS_FROM_OS(errno);
  ------------------
  |  |  274|    587|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  ------------------
  |  |  |  |  463|    587|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (274:34): [True: 587, False: 0]
  |  |  ------------------
  ------------------
   26|    587|}
pj_set_os_error:
   29|    587|{
   30|    587|    errno = PJ_STATUS_TO_OS(code);
  ------------------
  |  |  290|    587|#   define PJ_STATUS_TO_OS(e) (e == 0 ? PJ_SUCCESS : e - PJ_ERRNO_START_SYS)
  |  |  ------------------
  |  |  |  |  463|    587|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (290:32): [True: 587, False: 0]
  |  |  ------------------
  ------------------
   31|    587|}

pj_gettimeofday:
   32|    587|{
   33|    587|    struct timeval the_time;
   34|    587|    int rc;
   35|       |
   36|    587|    PJ_CHECK_STACK();
   37|       |
   38|    587|    rc = gettimeofday(&the_time, NULL);
   39|    587|    if (rc != 0)
  ------------------
  |  Branch (39:9): [True: 0, False: 587]
  ------------------
   40|      0|        return PJ_RETURN_OS_ERROR(pj_get_native_os_error());
  ------------------
  |  |  259|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (259:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  260|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  274|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  463|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   41|       |
   42|    587|    p_tv->sec = the_time.tv_sec;
   43|    587|    p_tv->msec = the_time.tv_usec / 1000;
   44|    587|    return PJ_SUCCESS;
   45|    587|}

pj_get_timestamp:
  285|      1|{
  286|      1|    struct timespec tp;
  287|       |
  288|      1|    if (clock_gettime(CLOCK_MONOTONIC, &tp) != 0) {
  ------------------
  |  Branch (288:9): [True: 0, False: 1]
  ------------------
  289|      0|        return PJ_RETURN_OS_ERROR(pj_get_native_os_error());
  ------------------
  |  |  259|      0|#   define PJ_RETURN_OS_ERROR(os_code)   (os_code ? \
  |  |  ------------------
  |  |  |  Branch (259:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  260|      0|                                            PJ_STATUS_FROM_OS(os_code) : -1)
  |  |  ------------------
  |  |  |  |  274|      0|#   define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  463|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  290|      0|    }
  291|       |
  292|      1|    ts->u64 = tp.tv_sec;
  293|      1|    ts->u64 *= NSEC_PER_SEC;
  ------------------
  |  |  282|      1|#define NSEC_PER_SEC    1000000000
  ------------------
  294|      1|    ts->u64 += tp.tv_nsec;
  295|       |
  296|      1|    return PJ_SUCCESS;
  297|      1|}

pj_pool_allocate_find:
   94|   267k|{
   95|   267k|    pj_pool_block *block = pool->block_list.next;
   96|   267k|    void *p;
   97|   267k|    pj_size_t block_size;
   98|   267k|    unsigned i = 0;
   99|       |
  100|   267k|    PJ_CHECK_STACK();
  101|       |
  102|   783k|    while (block != &pool->block_list) {
  ------------------
  |  Branch (102:12): [True: 729k, False: 54.1k]
  ------------------
  103|   729k|        p = pj_pool_alloc_from_block(block, size);
  104|   729k|        if (p != NULL)
  ------------------
  |  Branch (104:13): [True: 192k, False: 536k]
  ------------------
  105|   192k|            return p;
  106|       |
  107|   536k|#if PJ_POOL_MAX_SEARCH_BLOCK_COUNT > 0
  108|   536k|        if (i >= PJ_POOL_MAX_SEARCH_BLOCK_COUNT) {
  ------------------
  |  |  559|   536k|#   define PJ_POOL_MAX_SEARCH_BLOCK_COUNT 5
  ------------------
  |  Branch (108:13): [True: 20.8k, False: 515k]
  ------------------
  109|  20.8k|            break;
  110|  20.8k|        }
  111|   515k|#endif
  112|       |
  113|   515k|        i++;
  114|   515k|        block = block->next;
  115|   515k|    }
  116|       |    /* No available space in all blocks. */
  117|       |
  118|       |    /* If pool is configured NOT to expand, return error. */
  119|  75.0k|    if (pool->increment_size == 0) {
  ------------------
  |  Branch (119:9): [True: 0, False: 75.0k]
  ------------------
  120|      0|        LOG((pool->obj_name, "Can't expand pool to allocate %lu bytes "
  ------------------
  |  |   33|      0|#define LOG(expr)                   PJ_LOG(6,expr)
  |  |  ------------------
  |  |  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  |  |  107|      0|                                    if (level <= pj_log_get_level()) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (107:41): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  |  |  109|      0|                                    } \
  |  |  |  |  110|      0|                                } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  121|      0|             "(used=%lu, cap=%lu)",
  122|      0|             (unsigned long)size, (unsigned long)pj_pool_get_used_size(pool),
  123|      0|             (unsigned long)pool->capacity));
  124|      0|        (*pool->callback)(pool, size);
  125|      0|        return NULL;
  126|      0|    }
  127|       |
  128|       |    /* If pool is configured to expand, but the increment size
  129|       |     * is less than the required size, expand the pool by multiple
  130|       |     * increment size. Also count the size wasted due to aligning
  131|       |     * the block.
  132|       |     */
  133|  75.0k|    if (pool->increment_size < 
  ------------------
  |  Branch (133:9): [True: 28.9k, False: 46.0k]
  ------------------
  134|  75.0k|            size + sizeof(pj_pool_block) + PJ_POOL_ALIGNMENT) 
  ------------------
  |  |  182|  75.0k|#define PJ_POOL_ALIGNMENT 8
  ------------------
  135|  28.9k|    {
  136|  28.9k|        pj_size_t count;
  137|  28.9k|        count = (size + pool->increment_size + sizeof(pj_pool_block) +
  138|  28.9k|                 PJ_POOL_ALIGNMENT) / 
  ------------------
  |  |  182|  28.9k|#define PJ_POOL_ALIGNMENT 8
  ------------------
  139|  28.9k|                pool->increment_size;
  140|  28.9k|        block_size = count * pool->increment_size;
  141|       |
  142|  46.0k|    } else {
  143|  46.0k|        block_size = pool->increment_size;
  144|  46.0k|    }
  145|       |
  146|  75.0k|    LOG((pool->obj_name, 
  ------------------
  |  |   33|  75.0k|#define LOG(expr)                   PJ_LOG(6,expr)
  |  |  ------------------
  |  |  |  |  106|  75.0k|#define PJ_LOG(level,arg)       do { \
  |  |  |  |  107|  75.0k|                                    if (level <= pj_log_get_level()) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (107:41): [True: 0, False: 75.0k]
  |  |  |  |  ------------------
  |  |  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  |  |  109|      0|                                    } \
  |  |  |  |  110|  75.0k|                                } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  147|  75.0k|         "%lu bytes requested, resizing pool by %lu bytes (used=%lu, cap=%lu)",
  148|  75.0k|         (unsigned long)size, (unsigned long)block_size,
  149|  75.0k|         (unsigned long)pj_pool_get_used_size(pool),
  150|  75.0k|         (unsigned long)pool->capacity));
  151|       |
  152|  75.0k|    block = pj_pool_create_block(pool, block_size);
  153|  75.0k|    if (!block)
  ------------------
  |  Branch (153:9): [True: 0, False: 75.0k]
  ------------------
  154|      0|        return NULL;
  155|       |
  156|  75.0k|    p = pj_pool_alloc_from_block(block, size);
  157|  75.0k|    pj_assert(p != NULL);
  ------------------
  |  |   48|  75.0k|#   define pj_assert(expr)   assert(expr)
  ------------------
  158|  75.0k|#if PJ_DEBUG
  159|  75.0k|    if (p == NULL) {
  ------------------
  |  Branch (159:9): [True: 0, False: 75.0k]
  ------------------
  160|      0|        PJ_UNUSED_ARG(p);
  ------------------
  |  | 1433|      0|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  161|      0|    }
  162|  75.0k|#endif
  163|  75.0k|    return p;
  164|  75.0k|}
pj_pool_init_int:
  173|  33.7k|{
  174|  33.7k|    PJ_CHECK_STACK();
  175|       |
  176|  33.7k|    pool->increment_size = increment_size;
  177|  33.7k|    pool->callback = callback;
  178|       |
  179|  33.7k|    if (name) {
  ------------------
  |  Branch (179:9): [True: 28.9k, False: 4.82k]
  ------------------
  180|  28.9k|        if (strchr(name, '%') != NULL) {
  ------------------
  |  Branch (180:13): [True: 9.64k, False: 19.2k]
  ------------------
  181|  9.64k|            pj_ansi_snprintf(pool->obj_name, sizeof(pool->obj_name), 
  ------------------
  |  |  114|  9.64k|#define pj_ansi_snprintf        snprintf
  ------------------
  182|  9.64k|                             name, pool);
  183|  19.2k|        } else {
  184|  19.2k|            pj_ansi_strxcpy(pool->obj_name, name, PJ_MAX_OBJ_NAME);
  ------------------
  |  |  299|  19.2k|#define PJ_MAX_OBJ_NAME 32
  ------------------
  185|  19.2k|        }
  186|  28.9k|    } else {
  187|  4.82k|        pool->obj_name[0] = '\0';
  188|  4.82k|    }
  189|  33.7k|}
pj_pool_create_int:
  198|  33.7k|{
  199|  33.7k|    pj_pool_t *pool;
  200|  33.7k|    pj_pool_block *block;
  201|  33.7k|    pj_uint8_t *buffer;
  202|       |
  203|  33.7k|    PJ_CHECK_STACK();
  204|       |
  205|       |    /* Size must be at least sizeof(pj_pool)+sizeof(pj_pool_block) */
  206|  33.7k|    PJ_ASSERT_RETURN(initial_size >= sizeof(pj_pool_t)+sizeof(pj_pool_block),
  ------------------
  |  |   59|  33.7k|            do { \
  |  |   60|  33.7k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 33.7k]
  |  |  ------------------
  |  |   61|  33.7k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  207|  33.7k|                     NULL);
  208|       |
  209|       |    /* If callback is NULL, set calback from the policy */
  210|  33.7k|    if (callback == NULL)
  ------------------
  |  Branch (210:9): [True: 0, False: 33.7k]
  ------------------
  211|      0|        callback = f->policy.callback;
  212|       |
  213|       |    /* Allocate initial block */
  214|  33.7k|    buffer = (pj_uint8_t*) (*f->policy.block_alloc)(f, initial_size);
  215|  33.7k|    if (!buffer)
  ------------------
  |  Branch (215:9): [True: 0, False: 33.7k]
  ------------------
  216|      0|        return NULL;
  217|       |
  218|       |    /* Set pool administrative data. */
  219|  33.7k|    pool = (pj_pool_t*)buffer;
  220|  33.7k|    pj_bzero(pool, sizeof(*pool));
  221|       |
  222|  33.7k|    pj_list_init(&pool->block_list);
  223|  33.7k|    pool->factory = f;
  224|       |
  225|       |    /* Create the first block from the memory. */
  226|  33.7k|    block = (pj_pool_block*) (buffer + sizeof(*pool));
  227|  33.7k|    block->buf = ((unsigned char*)block) + sizeof(pj_pool_block);
  228|  33.7k|    block->end = buffer + initial_size;
  229|       |
  230|       |    /* Set the start pointer, aligning it as needed */
  231|  33.7k|    block->cur = ALIGN_PTR(block->buf, PJ_POOL_ALIGNMENT);
  ------------------
  |  |   34|  33.7k|#define ALIGN_PTR(PTR,ALIGNMENT)    (PTR + (-(pj_ssize_t)(PTR) & (ALIGNMENT-1)))
  ------------------
  232|       |
  233|  33.7k|    pj_list_insert_after(&pool->block_list, block);
  234|       |
  235|  33.7k|    pj_pool_init_int(pool, name, increment_size, callback);
  236|       |
  237|       |    /* Pool initial capacity and used size */
  238|  33.7k|    pool->capacity = initial_size;
  239|       |
  240|  33.7k|    LOG((pool->obj_name, "pool created, size=%lu",
  ------------------
  |  |   33|  33.7k|#define LOG(expr)                   PJ_LOG(6,expr)
  |  |  ------------------
  |  |  |  |  106|  33.7k|#define PJ_LOG(level,arg)       do { \
  |  |  |  |  107|  33.7k|                                    if (level <= pj_log_get_level()) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (107:41): [True: 0, False: 33.7k]
  |  |  |  |  ------------------
  |  |  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  |  |  109|      0|                                    } \
  |  |  |  |  110|  33.7k|                                } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  241|  33.7k|                         (unsigned long)pool->capacity));
  242|  33.7k|    return pool;
  243|  33.7k|}
pj_pool_reset:
  285|  24.0k|{
  286|  24.0k|    LOG((pool->obj_name, "reset(): cap=%lu, used=%lu(%lu%%)", 
  ------------------
  |  |   33|  24.0k|#define LOG(expr)                   PJ_LOG(6,expr)
  |  |  ------------------
  |  |  |  |  106|  24.0k|#define PJ_LOG(level,arg)       do { \
  |  |  |  |  107|  24.0k|                                    if (level <= pj_log_get_level()) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (107:41): [True: 0, False: 24.0k]
  |  |  |  |  ------------------
  |  |  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  |  |  109|      0|                                    } \
  |  |  |  |  110|  24.0k|                                } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  287|  24.0k|        (unsigned long)pool->capacity,
  288|  24.0k|        (unsigned long)pj_pool_get_used_size(pool), 
  289|  24.0k|        (unsigned long)(pj_pool_get_used_size(pool)*100/pool->capacity)));
  290|       |
  291|  24.0k|    reset_pool(pool);
  292|  24.0k|}
pj_pool_destroy_int:
  298|  28.9k|{
  299|  28.9k|    pj_size_t initial_size;
  300|       |
  301|  28.9k|    LOG((pool->obj_name, "destroy(): cap=%lu, used=%lu(%lu%%), block0=%p-%p", 
  ------------------
  |  |   33|  28.9k|#define LOG(expr)                   PJ_LOG(6,expr)
  |  |  ------------------
  |  |  |  |  106|  28.9k|#define PJ_LOG(level,arg)       do { \
  |  |  |  |  107|  28.9k|                                    if (level <= pj_log_get_level()) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (107:41): [True: 0, False: 28.9k]
  |  |  |  |  ------------------
  |  |  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  |  |  109|      0|                                    } \
  |  |  |  |  110|  28.9k|                                } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  302|  28.9k|        (unsigned long)pool->capacity,
  303|  28.9k|        (unsigned long)pj_pool_get_used_size(pool),
  304|  28.9k|        (unsigned long)(pj_pool_get_used_size(pool)*100/pool->capacity),
  305|  28.9k|        ((pj_pool_block*)pool->block_list.next)->buf, 
  306|  28.9k|        ((pj_pool_block*)pool->block_list.next)->end));
  307|       |
  308|  28.9k|    reset_pool(pool);
  309|  28.9k|    initial_size = ((pj_pool_block*)pool->block_list.next)->end - 
  310|  28.9k|                   (unsigned char*)pool;
  311|  28.9k|    if (pool->factory->policy.block_free)
  ------------------
  |  Branch (311:9): [True: 28.9k, False: 0]
  ------------------
  312|  28.9k|        (*pool->factory->policy.block_free)(pool->factory, pool, initial_size);
  313|  28.9k|}
pool.c:pj_pool_create_block:
   49|  75.0k|{
   50|  75.0k|    pj_pool_block *block;
   51|       |
   52|  75.0k|    PJ_CHECK_STACK();
   53|  75.0k|    pj_assert(size >= sizeof(pj_pool_block));
  ------------------
  |  |   48|  75.0k|#   define pj_assert(expr)   assert(expr)
  ------------------
   54|       |
   55|  75.0k|    LOG((pool->obj_name, "create_block(sz=%lu), cur.cap=%lu, cur.used=%lu", 
  ------------------
  |  |   33|  75.0k|#define LOG(expr)                   PJ_LOG(6,expr)
  |  |  ------------------
  |  |  |  |  106|  75.0k|#define PJ_LOG(level,arg)       do { \
  |  |  |  |  107|  75.0k|                                    if (level <= pj_log_get_level()) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (107:41): [True: 0, False: 75.0k]
  |  |  |  |  ------------------
  |  |  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  |  |  109|      0|                                    } \
  |  |  |  |  110|  75.0k|                                } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   56|  75.0k|         (unsigned long)size, (unsigned long)pool->capacity,
   57|  75.0k|         (unsigned long)pj_pool_get_used_size(pool)));
   58|       |
   59|       |    /* Request memory from allocator. */
   60|  75.0k|    block = (pj_pool_block*) 
   61|  75.0k|        (*pool->factory->policy.block_alloc)(pool->factory, size);
   62|  75.0k|    if (block == NULL) {
  ------------------
  |  Branch (62:9): [True: 0, False: 75.0k]
  ------------------
   63|      0|        (*pool->callback)(pool, size);
   64|      0|        return NULL;
   65|      0|    }
   66|       |
   67|       |    /* Add capacity. */
   68|  75.0k|    pool->capacity += size;
   69|       |
   70|       |    /* Set start and end of buffer. */
   71|  75.0k|    block->buf = ((unsigned char*)block) + sizeof(pj_pool_block);
   72|  75.0k|    block->end = ((unsigned char*)block) + size;
   73|       |
   74|       |    /* Set the start pointer, aligning it as needed */
   75|  75.0k|    block->cur = ALIGN_PTR(block->buf, PJ_POOL_ALIGNMENT);
  ------------------
  |  |   34|  75.0k|#define ALIGN_PTR(PTR,ALIGNMENT)    (PTR + (-(pj_ssize_t)(PTR) & (ALIGNMENT-1)))
  ------------------
   76|       |
   77|       |    /* Insert in the front of the list. */
   78|  75.0k|    pj_list_insert_after(&pool->block_list, block);
   79|       |
   80|  75.0k|    LOG((pool->obj_name," block created, buffer=%p-%p",block->buf, block->end));
  ------------------
  |  |   33|  75.0k|#define LOG(expr)                   PJ_LOG(6,expr)
  |  |  ------------------
  |  |  |  |  106|  75.0k|#define PJ_LOG(level,arg)       do { \
  |  |  |  |  107|  75.0k|                                    if (level <= pj_log_get_level()) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (107:41): [True: 0, False: 75.0k]
  |  |  |  |  ------------------
  |  |  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  |  |  109|      0|                                    } \
  |  |  |  |  110|  75.0k|                                } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   81|       |
   82|  75.0k|    return block;
   83|  75.0k|}
pool.c:reset_pool:
  251|  53.0k|{
  252|  53.0k|    pj_pool_block *block;
  253|       |
  254|  53.0k|    PJ_CHECK_STACK();
  255|       |
  256|  53.0k|    block = pool->block_list.prev;
  257|  53.0k|    if (block == &pool->block_list)
  ------------------
  |  Branch (257:9): [True: 0, False: 53.0k]
  ------------------
  258|      0|        return;
  259|       |
  260|       |    /* Skip the first block because it is occupying the same memory
  261|       |       as the pool itself.
  262|       |    */
  263|  53.0k|    block = block->prev;
  264|       |    
  265|   128k|    while (block != &pool->block_list) {
  ------------------
  |  Branch (265:12): [True: 75.0k, False: 53.0k]
  ------------------
  266|  75.0k|        pj_pool_block *prev = block->prev;
  267|  75.0k|        pj_list_erase(block);
  268|  75.0k|        (*pool->factory->policy.block_free)(pool->factory, block, 
  269|  75.0k|                                            block->end - (unsigned char*)block);
  270|  75.0k|        block = prev;
  271|  75.0k|    }
  272|       |
  273|  53.0k|    block = pool->block_list.next;
  274|       |
  275|       |    /* Set the start pointer, aligning it as needed */
  276|  53.0k|    block->cur = ALIGN_PTR(block->buf, PJ_POOL_ALIGNMENT);
  ------------------
  |  |   34|  53.0k|#define ALIGN_PTR(PTR,ALIGNMENT)    (PTR + (-(pj_ssize_t)(PTR) & (ALIGNMENT-1)))
  ------------------
  277|       |
  278|  53.0k|    pool->capacity = block->end - (unsigned char*)pool;
  279|  53.0k|}

pj_pool_create_on_buf:
   82|  4.82k|{
   83|  4.82k|#if PJ_HAS_POOL_ALT_API == 0
   84|  4.82k|    struct creation_param param;
   85|  4.82k|    pj_size_t align_diff;
   86|       |
   87|  4.82k|    PJ_ASSERT_RETURN(buf && size, NULL);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  9.64k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 4.82k, False: 0]
  |  |  |  Branch (60:23): [True: 4.82k, False: 0]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
   88|       |
   89|  4.82k|    if (!is_initialized) {
  ------------------
  |  Branch (89:9): [True: 1, False: 4.82k]
  ------------------
   90|      1|        if (pool_buf_initialize() != PJ_SUCCESS)
  ------------------
  |  Branch (90:13): [True: 0, False: 1]
  ------------------
   91|      0|            return NULL;
   92|      1|        is_initialized = 1;
   93|      1|    }
   94|       |
   95|       |    /* Check and align buffer */
   96|  4.82k|    align_diff = (pj_size_t)buf;
   97|  4.82k|    if (align_diff & (PJ_POOL_ALIGNMENT-1)) {
  ------------------
  |  |  182|  4.82k|#define PJ_POOL_ALIGNMENT 8
  ------------------
  |  Branch (97:9): [True: 0, False: 4.82k]
  ------------------
   98|      0|        align_diff &= (PJ_POOL_ALIGNMENT-1);
  ------------------
  |  |  182|      0|#define PJ_POOL_ALIGNMENT 8
  ------------------
   99|      0|        buf = (void*) (((char*)buf) + align_diff);
  100|      0|        size -= align_diff;
  101|      0|    }
  102|       |
  103|  4.82k|    param.stack_buf = buf;
  104|  4.82k|    param.size = size;
  105|  4.82k|    pj_thread_local_set(tls, &param);
  106|       |
  107|  4.82k|    return pj_pool_create_int(&stack_based_factory, name, size, 0, 
  108|  4.82k|                              pj_pool_factory_default_policy.callback);
  109|       |#else
  110|       |    PJ_UNUSED_ARG(buf);
  111|       |    return pj_pool_create(NULL, name, size, size, NULL);
  112|       |#endif
  113|  4.82k|}
pool_buf.c:pool_buf_initialize:
   46|      1|{
   47|      1|    pj_atexit(&pool_buf_cleanup);
   48|       |
   49|      1|    stack_based_factory.policy.block_alloc = &stack_alloc;
   50|      1|    return pj_thread_local_alloc(&tls);
   51|      1|}
pool_buf.c:stack_alloc:
   54|  4.82k|{
   55|  4.82k|    struct creation_param *param;
   56|  4.82k|    void *buf;
   57|       |
   58|  4.82k|    PJ_UNUSED_ARG(factory);
  ------------------
  |  | 1433|  4.82k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
   59|       |
   60|  4.82k|    param = (struct creation_param*) pj_thread_local_get(tls);
   61|  4.82k|    if (param == NULL) {
  ------------------
  |  Branch (61:9): [True: 0, False: 4.82k]
  ------------------
   62|       |        /* Don't assert(), this is normal no-memory situation */
   63|      0|        return NULL;
   64|      0|    }
   65|       |
   66|  4.82k|    pj_thread_local_set(tls, NULL);
   67|       |
   68|  4.82k|    PJ_ASSERT_RETURN(size <= param->size, NULL);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
   69|       |
   70|  4.82k|    buf = param->stack_buf;
   71|       |
   72|       |    /* Prevent the buffer from being reused */
   73|  4.82k|    param->stack_buf = NULL;
   74|       |
   75|  4.82k|    return buf;
   76|  4.82k|}

pj_caching_pool_init:
   56|  4.82k|{
   57|  4.82k|    int i;
   58|  4.82k|    pj_pool_t *pool;
   59|  4.82k|    pj_status_t status;
   60|       |
   61|  4.82k|    PJ_CHECK_STACK();
   62|       |
   63|  4.82k|    pj_bzero(cp, sizeof(*cp));
   64|       |    
   65|  4.82k|    cp->max_capacity = max_capacity;
   66|  4.82k|    pj_list_init(&cp->used_list);
   67|  82.0k|    for (i=0; i<PJ_CACHING_POOL_ARRAY_SIZE; ++i)
  ------------------
  |  |  815|  82.0k|#define PJ_CACHING_POOL_ARRAY_SIZE      16
  ------------------
  |  Branch (67:15): [True: 77.1k, False: 4.82k]
  ------------------
   68|  77.1k|        pj_list_init(&cp->free_list[i]);
   69|       |
   70|  4.82k|    if (policy == NULL) {
  ------------------
  |  Branch (70:9): [True: 0, False: 4.82k]
  ------------------
   71|      0|        policy = &pj_pool_factory_default_policy;
   72|      0|    }
   73|       |    
   74|  4.82k|    pj_memcpy(&cp->factory.policy, policy, sizeof(pj_pool_factory_policy));
   75|  4.82k|    cp->factory.create_pool = &cpool_create_pool;
   76|  4.82k|    cp->factory.release_pool = &cpool_release_pool;
   77|  4.82k|    cp->factory.dump_status = &cpool_dump_status;
   78|       |
   79|       |    /* Deprecated, these callbacks are only used for updating cp.used_size &
   80|       |     * cp.peak_used_size which are no longer used.
   81|       |     */
   82|       |    //cp->factory.on_block_alloc = &cpool_on_block_alloc;
   83|       |    //cp->factory.on_block_free = &cpool_on_block_free;
   84|       |
   85|  4.82k|    pool = pj_pool_create_on_buf("cachingpool", cp->pool_buf, sizeof(cp->pool_buf));
   86|  4.82k|    status = pj_lock_create_simple_mutex(pool, "cachingpool", &cp->lock);
   87|       |    /* This mostly serves to silent coverity warning about unchecked 
   88|       |     * return value. There's not much we can do if it fails. */
   89|  4.82k|    PJ_ASSERT_ON_FAIL(status==PJ_SUCCESS, return);
  ------------------
  |  |   73|  4.82k|            { \
  |  |   74|  4.82k|                pj_assert(expr); \
  |  |  ------------------
  |  |  |  |   48|  4.82k|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |   75|  4.82k|                if (!(expr)) exec_on_fail; \
  |  |  ------------------
  |  |  |  Branch (75:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   76|  4.82k|            }
  ------------------
   90|  4.82k|}
pj_caching_pool_destroy:
   93|  4.82k|{
   94|  4.82k|    int i;
   95|  4.82k|    pj_pool_t *pool;
   96|       |
   97|  4.82k|    PJ_CHECK_STACK();
   98|       |
   99|       |    /* Delete all pool in free list */
  100|  82.0k|    for (i=0; i < PJ_CACHING_POOL_ARRAY_SIZE; ++i) {
  ------------------
  |  |  815|  82.0k|#define PJ_CACHING_POOL_ARRAY_SIZE      16
  ------------------
  |  Branch (100:15): [True: 77.1k, False: 4.82k]
  ------------------
  101|  77.1k|        pj_pool_t *next;
  102|  77.1k|        pool = (pj_pool_t*) cp->free_list[i].next;
  103|   101k|        for (; pool != (void*)&cp->free_list[i]; pool = next) {
  ------------------
  |  Branch (103:16): [True: 24.0k, False: 77.1k]
  ------------------
  104|  24.0k|            next = pool->next;
  105|  24.0k|            pj_list_erase(pool);
  106|  24.0k|            pj_pool_destroy_int(pool);
  107|  24.0k|        }
  108|  77.1k|    }
  109|       |
  110|       |    /* Delete all pools in used list */
  111|  4.82k|    pool = (pj_pool_t*) cp->used_list.next;
  112|  4.82k|    while (pool != (pj_pool_t*) &cp->used_list) {
  ------------------
  |  Branch (112:12): [True: 0, False: 4.82k]
  ------------------
  113|      0|        pj_pool_t *next = pool->next;
  114|      0|        pj_list_erase(pool);
  115|      0|        PJ_LOG(4,(pool->obj_name, 
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  116|      0|                  "Pool is not released by application, releasing now"));
  117|      0|        pj_pool_destroy_int(pool);
  118|      0|        pool = next;
  119|      0|    }
  120|       |
  121|  4.82k|    if (cp->lock) {
  ------------------
  |  Branch (121:9): [True: 4.82k, False: 0]
  ------------------
  122|  4.82k|        pj_lock_destroy(cp->lock);
  123|  4.82k|        pj_lock_create_null_mutex(NULL, "cachingpool", &cp->lock);
  124|  4.82k|    }
  125|  4.82k|}
pool_caching.c:cpool_create_pool:
  132|  28.9k|{
  133|  28.9k|    pj_caching_pool *cp = (pj_caching_pool*)pf;
  134|  28.9k|    pj_pool_t *pool;
  135|  28.9k|    int idx;
  136|       |
  137|  28.9k|    PJ_CHECK_STACK();
  138|       |
  139|  28.9k|    pj_lock_acquire(cp->lock);
  140|       |
  141|       |    /* Use pool factory's policy when callback is NULL */
  142|  28.9k|    if (callback == NULL) {
  ------------------
  |  Branch (142:9): [True: 4.82k, False: 24.1k]
  ------------------
  143|  4.82k|        callback = pf->policy.callback;
  144|  4.82k|    }
  145|       |
  146|       |    /* Search the suitable size for the pool. 
  147|       |     * We'll just do linear search to the size array, as the array size itself
  148|       |     * is only a few elements. Binary search I suspect will be less efficient
  149|       |     * for this purpose.
  150|       |     */
  151|  28.9k|    if (initial_size <= pool_sizes[START_SIZE]) {
  ------------------
  |  |   50|  28.9k|#define START_SIZE  5
  ------------------
  |  Branch (151:9): [True: 24.1k, False: 4.82k]
  ------------------
  152|  24.1k|        for (idx=START_SIZE-1; 
  ------------------
  |  |   50|  24.1k|#define START_SIZE  5
  ------------------
  153|  82.0k|             idx >= 0 && pool_sizes[idx] >= initial_size;
  ------------------
  |  Branch (153:14): [True: 82.0k, False: 0]
  |  Branch (153:26): [True: 57.8k, False: 24.1k]
  ------------------
  154|  57.8k|             --idx)
  155|  57.8k|            ;
  156|  24.1k|        ++idx;
  157|  24.1k|    } else {
  158|  4.82k|        for (idx=START_SIZE+1; 
  ------------------
  |  |   50|  4.82k|#define START_SIZE  5
  ------------------
  159|  9.64k|             idx < PJ_CACHING_POOL_ARRAY_SIZE && 
  ------------------
  |  |  815|  19.2k|#define PJ_CACHING_POOL_ARRAY_SIZE      16
  ------------------
  |  Branch (159:14): [True: 9.64k, False: 0]
  ------------------
  160|  9.64k|                  pool_sizes[idx] < initial_size;
  ------------------
  |  Branch (160:19): [True: 4.82k, False: 4.82k]
  ------------------
  161|  4.82k|             ++idx)
  162|  4.82k|            ;
  163|  4.82k|    }
  164|       |
  165|       |    /* Check whether there's a pool in the list. */
  166|  28.9k|    if (idx==PJ_CACHING_POOL_ARRAY_SIZE || pj_list_empty(&cp->free_list[idx])) {
  ------------------
  |  |  815|  57.8k|#define PJ_CACHING_POOL_ARRAY_SIZE      16
  ------------------
  |  Branch (166:9): [True: 0, False: 28.9k]
  |  Branch (166:44): [True: 28.9k, False: 0]
  ------------------
  167|       |        /* No pool is available. */
  168|       |        /* Set minimum size. */
  169|  28.9k|        if (idx < PJ_CACHING_POOL_ARRAY_SIZE)
  ------------------
  |  |  815|  28.9k|#define PJ_CACHING_POOL_ARRAY_SIZE      16
  ------------------
  |  Branch (169:13): [True: 28.9k, False: 0]
  ------------------
  170|  28.9k|            initial_size =  pool_sizes[idx];
  171|       |
  172|       |        /* Create new pool */
  173|  28.9k|        pool = pj_pool_create_int(&cp->factory, name, initial_size, 
  174|  28.9k|                                  increment_sz, callback);
  175|  28.9k|        if (!pool) {
  ------------------
  |  Branch (175:13): [True: 0, False: 28.9k]
  ------------------
  176|      0|            pj_lock_release(cp->lock);
  177|      0|            return NULL;
  178|      0|        }
  179|       |
  180|  28.9k|    } else {
  181|       |        /* Get one pool from the list. */
  182|      0|        pool = (pj_pool_t*) cp->free_list[idx].next;
  183|      0|        pj_list_erase(pool);
  184|       |
  185|       |        /* Initialize the pool. */
  186|      0|        pj_pool_init_int(pool, name, increment_sz, callback);
  187|       |
  188|       |        /* Update pool manager's free capacity. */
  189|      0|        if (cp->capacity > pj_pool_get_capacity(pool)) {
  ------------------
  |  Branch (189:13): [True: 0, False: 0]
  ------------------
  190|      0|            cp->capacity -= pj_pool_get_capacity(pool);
  191|      0|        } else {
  192|      0|            cp->capacity = 0;
  193|      0|        }
  194|       |
  195|      0|        PJ_LOG(6, (pool->obj_name, "pool reused, size=%lu",
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  196|      0|                   (unsigned long)pool->capacity));
  197|      0|    }
  198|       |
  199|       |    /* Put in used list. */
  200|  28.9k|    pj_list_insert_before( &cp->used_list, pool );
  201|       |
  202|       |    /* Mark factory data */
  203|  28.9k|    pool->factory_data = (void*) (pj_ssize_t) idx;
  204|       |
  205|       |    /* Increment used count. */
  206|  28.9k|    ++cp->used_count;
  207|       |
  208|  28.9k|    pj_lock_release(cp->lock);
  209|  28.9k|    return pool;
  210|  28.9k|}
pool_caching.c:cpool_release_pool:
  213|  28.9k|{
  214|  28.9k|    pj_caching_pool *cp = (pj_caching_pool*)pf;
  215|  28.9k|    pj_size_t pool_capacity;
  216|  28.9k|    unsigned i;
  217|       |
  218|  28.9k|    PJ_CHECK_STACK();
  219|       |
  220|  28.9k|    PJ_ASSERT_ON_FAIL(pf && pool, return);
  ------------------
  |  |   73|  28.9k|            { \
  |  |   74|  28.9k|                pj_assert(expr); \
  |  |  ------------------
  |  |  |  |   48|  28.9k|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |   75|  57.8k|                if (!(expr)) exec_on_fail; \
  |  |  ------------------
  |  |  |  Branch (75:23): [True: 28.9k, False: 0]
  |  |  |  Branch (75:23): [True: 28.9k, False: 0]
  |  |  ------------------
  |  |   76|  28.9k|            }
  ------------------
  221|       |
  222|  28.9k|    pj_lock_acquire(cp->lock);
  223|       |
  224|       |#if PJ_SAFE_POOL
  225|       |    /* Make sure pool is still in our used list */
  226|       |    if (pj_list_find_node(&cp->used_list, pool) != pool) {
  227|       |        pj_lock_release(cp->lock);
  228|       |        pj_assert(!"Attempt to destroy pool that has been destroyed before");
  229|       |        return;
  230|       |    }
  231|       |#endif
  232|       |
  233|       |    /* Erase from the used list. */
  234|  28.9k|    pj_list_erase(pool);
  235|       |
  236|       |    /* Decrement used count. */
  237|  28.9k|    --cp->used_count;
  238|       |
  239|  28.9k|    pool_capacity = pj_pool_get_capacity(pool);
  240|       |
  241|       |    /* Destroy the pool if the size is greater than our size or if the total
  242|       |     * capacity in our recycle list (plus the size of the pool) exceeds 
  243|       |     * maximum capacity.
  244|       |   . */
  245|  28.9k|    if (pool_capacity > pool_sizes[PJ_CACHING_POOL_ARRAY_SIZE-1] ||
  ------------------
  |  |  815|  28.9k|#define PJ_CACHING_POOL_ARRAY_SIZE      16
  ------------------
  |  Branch (245:9): [True: 4.88k, False: 24.0k]
  ------------------
  246|  28.9k|        cp->capacity + pool_capacity > cp->max_capacity)
  ------------------
  |  Branch (246:9): [True: 0, False: 24.0k]
  ------------------
  247|  4.88k|    {
  248|  4.88k|        pj_pool_destroy_int(pool);
  249|  4.88k|        pj_lock_release(cp->lock);
  250|  4.88k|        return;
  251|  4.88k|    }
  252|       |
  253|       |    /* Reset pool. */
  254|  24.0k|    PJ_LOG(6, (pool->obj_name, "recycle(): cap=%lu, used=%lu(%lu%%)", 
  ------------------
  |  |  106|  24.0k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  24.0k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 24.0k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  24.0k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  255|  24.0k|               (unsigned long)pool_capacity,
  256|  24.0k|               (unsigned long)pj_pool_get_used_size(pool), 
  257|  24.0k|               (unsigned long)(pj_pool_get_used_size(pool)*100/
  258|  24.0k|                               pool_capacity)));
  259|  24.0k|    pj_pool_reset(pool);
  260|       |
  261|  24.0k|    pool_capacity = pj_pool_get_capacity(pool);
  262|       |
  263|       |    /*
  264|       |     * Otherwise put the pool in our recycle list.
  265|       |     */
  266|  24.0k|    i = (unsigned) (unsigned long) (pj_ssize_t) pool->factory_data;
  267|       |
  268|  24.0k|    pj_assert(i<PJ_CACHING_POOL_ARRAY_SIZE);
  ------------------
  |  |   48|  24.0k|#   define pj_assert(expr)   assert(expr)
  ------------------
  269|  24.0k|    if (i >= PJ_CACHING_POOL_ARRAY_SIZE ) {
  ------------------
  |  |  815|  24.0k|#define PJ_CACHING_POOL_ARRAY_SIZE      16
  ------------------
  |  Branch (269:9): [True: 0, False: 24.0k]
  ------------------
  270|       |        /* Something has gone wrong with the pool. */
  271|      0|        pj_pool_destroy_int(pool);
  272|      0|        pj_lock_release(cp->lock);
  273|      0|        return;
  274|      0|    }
  275|       |
  276|  24.0k|    pj_list_insert_after(&cp->free_list[i], pool);
  277|  24.0k|    cp->capacity += pool_capacity;
  278|       |
  279|  24.0k|    pj_lock_release(cp->lock);
  280|  24.0k|}

pool_policy_malloc.c:default_block_alloc:
   33|   103k|{
   34|   103k|    void *p;
   35|       |
   36|   103k|    PJ_CHECK_STACK();
   37|       |
   38|   103k|    if (factory->on_block_alloc) {
  ------------------
  |  Branch (38:9): [True: 0, False: 103k]
  ------------------
   39|      0|        int rc;
   40|      0|        rc = factory->on_block_alloc(factory, size);
   41|      0|        if (!rc)
  ------------------
  |  Branch (41:13): [True: 0, False: 0]
  ------------------
   42|      0|            return NULL;
   43|      0|    }
   44|       |
   45|   103k|    p = malloc(size+(SIG_SIZE << 1));
  ------------------
  |  |   64|   103k|#   define SIG_SIZE         0
  ------------------
   46|       |
   47|   103k|    if (p == NULL) {
  ------------------
  |  Branch (47:9): [True: 0, False: 103k]
  ------------------
   48|      0|        if (factory->on_block_free) 
  ------------------
  |  Branch (48:13): [True: 0, False: 0]
  ------------------
   49|      0|            factory->on_block_free(factory, size);
   50|   103k|    } else {
   51|       |        /* Apply signature when PJ_SAFE_POOL is set. It will move
   52|       |         * "p" pointer forward.
   53|       |         */
   54|   103k|        APPLY_SIG(p, size);
   55|   103k|    }
   56|       |
   57|   103k|    return p;
   58|   103k|}
pool_policy_malloc.c:default_block_free:
   62|   103k|{
   63|   103k|    PJ_CHECK_STACK();
   64|       |
   65|   103k|    if (factory->on_block_free) 
  ------------------
  |  Branch (65:9): [True: 0, False: 103k]
  ------------------
   66|      0|        factory->on_block_free(factory, size);
   67|       |
   68|       |    /* Check and remove signature when PJ_SAFE_POOL is set. It will
   69|       |     * move "mem" pointer backward.
   70|       |     */
   71|   103k|    REMOVE_SIG(mem, size);
   72|       |
   73|       |    /* Note that when PJ_SAFE_POOL is set, the actual size of the block
   74|       |     * is size + SIG_SIZE*2.
   75|       |     */
   76|       |
   77|   103k|    free(mem);
   78|   103k|}

pj_rand:
   30|      8|{
   31|      8|    PJ_CHECK_STACK();
   32|      8|    return platform_rand();
  ------------------
  |  |   43|      8|#      define platform_rand rand
  ------------------
   33|      8|}

PJ_FD_ZERO:
   43|  14.4k|{
   44|  14.4k|    PJ_CHECK_STACK();
   45|  14.4k|    pj_assert(sizeof(pj_fd_set_t)-sizeof(pj_sock_t) >= sizeof(fd_set));
  ------------------
  |  |   48|  14.4k|#   define pj_assert(expr)   assert(expr)
  ------------------
   46|       |
   47|  14.4k|    FD_ZERO(PART_FDSET(fdsetp));
   48|  14.4k|    PART_COUNT(fdsetp) = 0;
  ------------------
  |  |   40|  14.4k|#define PART_COUNT(ps)          (ps->data[0])
  ------------------
   49|  14.4k|}

pj_strstr:
  147|  9.14k|{
  148|  9.14k|    const char *s, *ends;
  149|       |
  150|  9.14k|    PJ_ASSERT_RETURN(str->slen >= 0 && substr->slen >= 0, NULL);
  ------------------
  |  |   59|  9.14k|            do { \
  |  |   60|  18.2k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 9.14k, False: 0]
  |  |  |  Branch (60:23): [True: 9.14k, False: 0]
  |  |  ------------------
  |  |   61|  9.14k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  151|       |
  152|       |    /* Check if the string is empty */
  153|  9.14k|    if (str->slen <= 0)
  ------------------
  |  Branch (153:9): [True: 19, False: 9.12k]
  ------------------
  154|     19|        return NULL;
  155|       |
  156|       |    /* Special case when substr is empty */
  157|  9.12k|    if (substr->slen <= 0) {
  ------------------
  |  Branch (157:9): [True: 0, False: 9.12k]
  ------------------
  158|      0|        return (char*)str->ptr;
  159|      0|    }
  160|       |
  161|  9.12k|    s = str->ptr;
  162|  9.12k|    ends = str->ptr + str->slen - substr->slen;
  163|   121k|    for (; s<=ends; ++s) {
  ------------------
  |  Branch (163:12): [True: 121k, False: 135]
  ------------------
  164|   121k|        if (pj_ansi_strncmp(s, substr->ptr, substr->slen)==0)
  ------------------
  |  |   68|   121k|#define pj_ansi_strncmp         strncmp
  ------------------
  |  Branch (164:13): [True: 8.98k, False: 112k]
  ------------------
  165|  8.98k|            return (char*)s;
  166|   121k|    }
  167|    135|    return NULL;
  168|  9.12k|}
pj_strltrim:
  197|  22.4k|{
  198|  22.4k|    char *end = str->ptr + str->slen;
  199|  22.4k|    register char *p = str->ptr;
  200|       |
  201|  22.4k|    pj_assert(str->slen >= 0);
  ------------------
  |  |   48|  22.4k|#   define pj_assert(expr)   assert(expr)
  ------------------
  202|       |
  203|  23.6k|    while (p < end && pj_isspace(*p))
  ------------------
  |  Branch (203:12): [True: 22.9k, False: 717]
  |  Branch (203:23): [True: 1.23k, False: 21.7k]
  ------------------
  204|  1.23k|        ++p;
  205|  22.4k|    str->slen -= (p - str->ptr);
  206|  22.4k|    str->ptr = p;
  207|  22.4k|    return str;
  208|  22.4k|}
pj_strrtrim:
  211|    340|{
  212|    340|    char *end = str->ptr + str->slen;
  213|    340|    register char *p = end - 1;
  214|       |
  215|    340|    pj_assert(str->slen >= 0);
  ------------------
  |  |   48|    340|#   define pj_assert(expr)   assert(expr)
  ------------------
  216|       |
  217|    785|    while (p >= str->ptr && pj_isspace(*p))
  ------------------
  |  Branch (217:12): [True: 493, False: 292]
  |  Branch (217:29): [True: 445, False: 48]
  ------------------
  218|    445|        --p;
  219|    340|    str->slen -= ((end - p) - 1);
  220|    340|    return str;
  221|    340|}
pj_strtol2:
  270|  11.1k|{
  271|  11.1k|    pj_str_t s;
  272|  11.1k|    unsigned long retval = 0;
  273|  11.1k|    pj_bool_t is_negative = PJ_FALSE;
  274|  11.1k|    int rc = 0;
  275|       |
  276|  11.1k|    PJ_CHECK_STACK();
  277|       |
  278|  11.1k|    if (!str || !value) {
  ------------------
  |  Branch (278:9): [True: 0, False: 11.1k]
  |  Branch (278:17): [True: 0, False: 11.1k]
  ------------------
  279|      0|        return PJ_EINVAL;
  ------------------
  |  |  333|      0|#define PJ_EINVAL           (PJ_ERRNO_START_STATUS + 4) /* 70004 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  280|      0|    }
  281|  11.1k|    PJ_ASSERT_RETURN(str->slen >= 0, PJ_EINVAL);
  ------------------
  |  |   59|  11.1k|            do { \
  |  |   60|  11.1k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 11.1k]
  |  |  ------------------
  |  |   61|  11.1k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  282|       |
  283|  11.1k|    s = *str;
  284|  11.1k|    pj_strltrim(&s);
  285|       |
  286|  11.1k|    if (s.slen == 0)
  ------------------
  |  Branch (286:9): [True: 204, False: 10.9k]
  ------------------
  287|    204|        return PJ_EINVAL;
  ------------------
  |  |  333|    204|#define PJ_EINVAL           (PJ_ERRNO_START_STATUS + 4) /* 70004 */
  |  |  ------------------
  |  |  |  |  456|    204|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|    204|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|    204|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  288|       |
  289|  10.9k|    if (s.ptr[0] == '+' || s.ptr[0] == '-') {
  ------------------
  |  Branch (289:9): [True: 198, False: 10.7k]
  |  Branch (289:28): [True: 1.35k, False: 9.39k]
  ------------------
  290|  1.55k|        is_negative = (s.ptr[0] == '-');
  291|  1.55k|        s.ptr += 1;
  292|  1.55k|        s.slen -= 1;
  293|  1.55k|    }
  294|       |
  295|  10.9k|    rc = pj_strtoul3(&s, &retval, 10);
  296|  10.9k|    if (rc == PJ_EINVAL) {
  ------------------
  |  |  333|  10.9k|#define PJ_EINVAL           (PJ_ERRNO_START_STATUS + 4) /* 70004 */
  |  |  ------------------
  |  |  |  |  456|  10.9k|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|  10.9k|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|  10.9k|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (296:9): [True: 660, False: 10.2k]
  ------------------
  297|    660|        return rc;
  298|  10.2k|    } else if (rc != PJ_SUCCESS) {
  ------------------
  |  Branch (298:16): [True: 412, False: 9.87k]
  ------------------
  299|    412|        *value = is_negative ? PJ_MINLONG : PJ_MAXLONG;
  ------------------
  |  |   45|    412|#define PJ_MINLONG      LONG_MIN
  ------------------
                      *value = is_negative ? PJ_MINLONG : PJ_MAXLONG;
  ------------------
  |  |   42|    412|#define PJ_MAXLONG      LONG_MAX
  ------------------
  |  Branch (299:18): [True: 3, False: 409]
  ------------------
  300|    412|        return is_negative ? PJ_ETOOSMALL : PJ_ETOOBIG;
  ------------------
  |  |  409|      3|#define PJ_ETOOSMALL        (PJ_ERRNO_START_STATUS + 19)/* 70019 */
  |  |  ------------------
  |  |  |  |  456|      3|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      3|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      3|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                      return is_negative ? PJ_ETOOSMALL : PJ_ETOOBIG;
  ------------------
  |  |  398|    409|#define PJ_ETOOBIG          (PJ_ERRNO_START_STATUS + 17)/* 70017 */
  |  |  ------------------
  |  |  |  |  456|    409|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|    409|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|    409|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (300:16): [True: 3, False: 409]
  ------------------
  301|    412|    }
  302|       |
  303|  9.87k|    if (retval > PJ_MAXLONG && !is_negative) {
  ------------------
  |  |   42|  19.7k|#define PJ_MAXLONG      LONG_MAX
  ------------------
  |  Branch (303:9): [True: 749, False: 9.12k]
  |  Branch (303:32): [True: 257, False: 492]
  ------------------
  304|    257|        *value = PJ_MAXLONG;
  ------------------
  |  |   42|    257|#define PJ_MAXLONG      LONG_MAX
  ------------------
  305|    257|        return PJ_ETOOBIG;
  ------------------
  |  |  398|    257|#define PJ_ETOOBIG          (PJ_ERRNO_START_STATUS + 17)/* 70017 */
  |  |  ------------------
  |  |  |  |  456|    257|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|    257|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|    257|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  306|    257|    }
  307|       |
  308|  9.61k|    if (retval > (PJ_MAXLONG + 1UL) && is_negative) {
  ------------------
  |  |   42|  9.61k|#define PJ_MAXLONG      LONG_MAX
  ------------------
  |  Branch (308:9): [True: 206, False: 9.41k]
  |  Branch (308:40): [True: 206, False: 0]
  ------------------
  309|    206|        *value = PJ_MINLONG;
  ------------------
  |  |   45|    206|#define PJ_MINLONG      LONG_MIN
  ------------------
  310|    206|        return PJ_ETOOSMALL;
  ------------------
  |  |  409|    206|#define PJ_ETOOSMALL        (PJ_ERRNO_START_STATUS + 19)/* 70019 */
  |  |  ------------------
  |  |  |  |  456|    206|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|    206|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|    206|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  311|    206|    }
  312|       |
  313|  9.41k|    if (is_negative && retval == PJ_MAXLONG + 1UL) {
  ------------------
  |  |   42|    922|#define PJ_MAXLONG      LONG_MAX
  ------------------
  |  Branch (313:9): [True: 922, False: 8.49k]
  |  Branch (313:24): [True: 286, False: 636]
  ------------------
  314|    286|        *value = PJ_MINLONG;
  ------------------
  |  |   45|    286|#define PJ_MINLONG      LONG_MIN
  ------------------
  315|    286|        return PJ_SUCCESS;
  316|    286|    }
  317|       |
  318|  9.12k|    *value = is_negative ? -(long)retval : retval;
  ------------------
  |  Branch (318:14): [True: 636, False: 8.49k]
  ------------------
  319|       |
  320|  9.12k|    return PJ_SUCCESS;
  321|  9.41k|}
pj_strtoul:
  324|  1.73k|{
  325|  1.73k|    unsigned long value;
  326|  1.73k|    unsigned i;
  327|       |
  328|  1.73k|    PJ_CHECK_STACK();
  329|       |
  330|  1.73k|    pj_assert(str->slen >= 0);
  ------------------
  |  |   48|  1.73k|#   define pj_assert(expr)   assert(expr)
  ------------------
  331|       |
  332|  1.73k|    value = 0;
  333|  5.99k|    for (i=0; i<(unsigned)str->slen; ++i) {
  ------------------
  |  Branch (333:15): [True: 4.51k, False: 1.48k]
  ------------------
  334|  4.51k|        if (!pj_isdigit(str->ptr[i]))
  ------------------
  |  Branch (334:13): [True: 259, False: 4.25k]
  ------------------
  335|    259|            break;
  336|  4.25k|        value = value * 10 + (str->ptr[i] - '0');
  337|  4.25k|    }
  338|  1.73k|    return value;
  339|  1.73k|}
pj_strtoul3:
  381|  10.9k|{
  382|  10.9k|    pj_str_t s;
  383|  10.9k|    unsigned i;
  384|       |
  385|  10.9k|    PJ_CHECK_STACK();
  386|       |
  387|  10.9k|    if (!str || !value) {
  ------------------
  |  Branch (387:9): [True: 0, False: 10.9k]
  |  Branch (387:17): [True: 0, False: 10.9k]
  ------------------
  388|      0|        return PJ_EINVAL;
  ------------------
  |  |  333|      0|#define PJ_EINVAL           (PJ_ERRNO_START_STATUS + 4) /* 70004 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  389|      0|    }
  390|  10.9k|    PJ_ASSERT_RETURN(str->slen >= 0, PJ_EINVAL);
  ------------------
  |  |   59|  10.9k|            do { \
  |  |   60|  10.9k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 10.9k]
  |  |  ------------------
  |  |   61|  10.9k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  391|       |    
  392|  10.9k|    s = *str;
  393|  10.9k|    pj_strltrim(&s);
  394|       |
  395|  10.9k|    if (s.slen == 0 || s.ptr[0] < '0' ||
  ------------------
  |  Branch (395:9): [True: 221, False: 10.7k]
  |  Branch (395:24): [True: 226, False: 10.5k]
  ------------------
  396|  10.9k|        (base <= 10 && (unsigned)s.ptr[0] > ('0' - 1) + base) ||
  ------------------
  |  Branch (396:10): [True: 10.5k, False: 0]
  |  Branch (396:24): [True: 213, False: 10.2k]
  ------------------
  397|  10.9k|        (base == 16 && !pj_isxdigit(s.ptr[0])))
  ------------------
  |  Branch (397:10): [True: 0, False: 10.2k]
  |  Branch (397:24): [True: 0, False: 0]
  ------------------
  398|    660|    {
  399|    660|        return PJ_EINVAL;
  ------------------
  |  |  333|    660|#define PJ_EINVAL           (PJ_ERRNO_START_STATUS + 4) /* 70004 */
  |  |  ------------------
  |  |  |  |  456|    660|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|    660|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|    660|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  400|    660|    }
  401|       |
  402|  10.2k|    *value = 0;
  403|  10.2k|    if (base <= 10) {
  ------------------
  |  Branch (403:9): [True: 10.2k, False: 0]
  ------------------
  404|  56.9k|        for (i=0; i<(unsigned)s.slen; ++i) {
  ------------------
  |  Branch (404:19): [True: 47.5k, False: 9.40k]
  ------------------
  405|  47.5k|            unsigned c = s.ptr[i] - '0';
  406|  47.5k|            if (s.ptr[i] < '0' || (unsigned)s.ptr[i] > ('0' - 1) + base) {
  ------------------
  |  Branch (406:17): [True: 205, False: 47.3k]
  |  Branch (406:35): [True: 271, False: 47.0k]
  ------------------
  407|    476|                break;
  408|    476|            }
  409|  47.0k|            if (*value > PJ_MAXULONG / base) {
  ------------------
  |  |   48|  47.0k|#define PJ_MAXULONG     ULONG_MAX
  ------------------
  |  Branch (409:17): [True: 217, False: 46.8k]
  ------------------
  410|    217|                *value = PJ_MAXULONG;
  ------------------
  |  |   48|    217|#define PJ_MAXULONG     ULONG_MAX
  ------------------
  411|    217|                return PJ_ETOOBIG;
  ------------------
  |  |  398|    217|#define PJ_ETOOBIG          (PJ_ERRNO_START_STATUS + 17)/* 70017 */
  |  |  ------------------
  |  |  |  |  456|    217|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|    217|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|    217|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  412|    217|            }
  413|       |
  414|  46.8k|            *value *= base;
  415|  46.8k|            if ((PJ_MAXULONG - *value) < c) {
  ------------------
  |  |   48|  46.8k|#define PJ_MAXULONG     ULONG_MAX
  ------------------
  |  Branch (415:17): [True: 195, False: 46.6k]
  ------------------
  416|    195|                *value = PJ_MAXULONG;
  ------------------
  |  |   48|    195|#define PJ_MAXULONG     ULONG_MAX
  ------------------
  417|    195|                return PJ_ETOOBIG;
  ------------------
  |  |  398|    195|#define PJ_ETOOBIG          (PJ_ERRNO_START_STATUS + 17)/* 70017 */
  |  |  ------------------
  |  |  |  |  456|    195|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|    195|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|    195|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  418|    195|            }
  419|  46.6k|            *value += c;
  420|  46.6k|        }
  421|  10.2k|    } else if (base == 16) {
  ------------------
  |  Branch (421:16): [True: 0, False: 0]
  ------------------
  422|      0|        for (i=0; i<(unsigned)s.slen; ++i) {
  ------------------
  |  Branch (422:19): [True: 0, False: 0]
  ------------------
  423|      0|            unsigned c = pj_hex_digit_to_val(s.ptr[i]);
  424|      0|            if (!pj_isxdigit(s.ptr[i]))
  ------------------
  |  Branch (424:17): [True: 0, False: 0]
  ------------------
  425|      0|                break;
  426|       |
  427|      0|            if (*value > PJ_MAXULONG / base) {
  ------------------
  |  |   48|      0|#define PJ_MAXULONG     ULONG_MAX
  ------------------
  |  Branch (427:17): [True: 0, False: 0]
  ------------------
  428|      0|                *value = PJ_MAXULONG;
  ------------------
  |  |   48|      0|#define PJ_MAXULONG     ULONG_MAX
  ------------------
  429|      0|                return PJ_ETOOBIG;
  ------------------
  |  |  398|      0|#define PJ_ETOOBIG          (PJ_ERRNO_START_STATUS + 17)/* 70017 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  430|      0|            }
  431|      0|            *value *= base;
  432|      0|            if ((PJ_MAXULONG - *value) < c) {
  ------------------
  |  |   48|      0|#define PJ_MAXULONG     ULONG_MAX
  ------------------
  |  Branch (432:17): [True: 0, False: 0]
  ------------------
  433|      0|                *value = PJ_MAXULONG;
  ------------------
  |  |   48|      0|#define PJ_MAXULONG     ULONG_MAX
  ------------------
  434|      0|                return PJ_ETOOBIG;
  ------------------
  |  |  398|      0|#define PJ_ETOOBIG          (PJ_ERRNO_START_STATUS + 17)/* 70017 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  435|      0|            }
  436|      0|            *value += c;
  437|      0|        }
  438|      0|    } else {
  439|      0|        pj_assert(!"Unsupported base");
  ------------------
  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  ------------------
  440|      0|        return PJ_EINVAL;
  ------------------
  |  |  333|      0|#define PJ_EINVAL           (PJ_ERRNO_START_STATUS + 4) /* 70004 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  441|      0|    }
  442|  9.87k|    return PJ_SUCCESS;
  443|  10.2k|}
pj_ansi_strxcpy:
  627|   188k|{
  628|   188k|    char *odst = dst;
  629|       |
  630|   188k|    PJ_ASSERT_RETURN(dst && src, -PJ_EINVAL);
  ------------------
  |  |   59|   188k|            do { \
  |  |   60|   377k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 188k, False: 1]
  |  |  |  Branch (60:23): [True: 188k, False: 18.4E]
  |  |  ------------------
  |  |   61|   188k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  631|       |
  632|   188k|    if (dst_size==0)
  ------------------
  |  Branch (632:9): [True: 0, False: 188k]
  ------------------
  633|      0|        return -PJ_ETOOBIG;
  ------------------
  |  |  398|      0|#define PJ_ETOOBIG          (PJ_ERRNO_START_STATUS + 17)/* 70017 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  634|       |
  635|  2.94M|    while (--dst_size && (*dst=*src) != 0) {
  ------------------
  |  Branch (635:12): [True: 2.94M, False: 3]
  |  Branch (635:26): [True: 2.75M, False: 188k]
  ------------------
  636|  2.75M|        ++dst;
  637|  2.75M|        ++src;
  638|  2.75M|    }
  639|       |
  640|   188k|    if (!*dst && !*src) {
  ------------------
  |  Branch (640:9): [True: 188k, False: 18.4E]
  |  Branch (640:18): [True: 188k, False: 0]
  ------------------
  641|   188k|        return dst-odst;
  642|  18.4E|    } else {
  643|  18.4E|        *dst = '\0';
  644|  18.4E|        return *src? -PJ_ETOOBIG : dst-odst;
  ------------------
  |  |  398|      0|#define PJ_ETOOBIG          (PJ_ERRNO_START_STATUS + 17)/* 70017 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (644:16): [True: 0, False: 18.4E]
  ------------------
  645|  18.4E|    }
  646|   188k|}

pj_timer_heap_create:
  590|  4.82k|{
  591|  4.82k|    pj_timer_heap_t *ht;
  592|  4.82k|    pj_size_t i;
  593|       |
  594|  4.82k|    PJ_ASSERT_RETURN(pool && p_heap, PJ_EINVAL);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  9.64k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 4.82k, False: 0]
  |  |  |  Branch (60:23): [True: 4.82k, False: 0]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  595|       |
  596|  4.82k|    *p_heap = NULL;
  597|       |
  598|       |    /* Magic? */
  599|  4.82k|    size += 2;
  600|       |
  601|       |    /* Allocate timer heap data structure from the pool */
  602|  4.82k|    ht = PJ_POOL_ZALLOC_T(pool, pj_timer_heap_t);
  ------------------
  |  |  520|  4.82k|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  603|  4.82k|    if (!ht)
  ------------------
  |  Branch (603:9): [True: 0, False: 4.82k]
  ------------------
  604|      0|        return PJ_ENOMEM;
  ------------------
  |  |  348|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  605|       |
  606|       |    /* Initialize timer heap sizes */
  607|  4.82k|    ht->max_size = size;
  608|  4.82k|    ht->cur_size = 0;
  609|  4.82k|    ht->max_entries_per_poll = DEFAULT_MAX_TIMED_OUT_PER_POLL;
  ------------------
  |  |   46|  4.82k|#define DEFAULT_MAX_TIMED_OUT_PER_POLL  (64)
  ------------------
  610|  4.82k|    ht->timer_ids_freelist = 1;
  611|  4.82k|    ht->pool = pool;
  612|       |
  613|       |    /* Lock. */
  614|  4.82k|    ht->lock = NULL;
  615|  4.82k|    ht->auto_delete_lock = 0;
  616|       |
  617|       |    // Create the heap array.
  618|  4.82k|    ht->heap = (pj_timer_entry_dup**)
  619|  4.82k|               pj_pool_calloc(pool, size, sizeof(pj_timer_entry_dup*));
  620|  4.82k|    if (!ht->heap)
  ------------------
  |  Branch (620:9): [True: 0, False: 4.82k]
  ------------------
  621|      0|        return PJ_ENOMEM;
  ------------------
  |  |  348|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  622|       |
  623|  4.82k|#if PJ_TIMER_USE_COPY
  624|       |    // Create the timer entry copies array.
  625|  4.82k|    ht->timer_dups = (pj_timer_entry_dup*)
  626|  4.82k|                     pj_pool_alloc(pool, sizeof(pj_timer_entry_dup) * size);
  627|  4.82k|    if (!ht->timer_dups)
  ------------------
  |  Branch (627:9): [True: 0, False: 4.82k]
  ------------------
  628|      0|        return PJ_ENOMEM;
  ------------------
  |  |  348|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  629|  4.82k|#endif
  630|       |
  631|       |    // Create the parallel
  632|  4.82k|    ht->timer_ids = (pj_timer_id_t *)
  633|  4.82k|                    pj_pool_alloc( pool, sizeof(pj_timer_id_t) * size);
  634|  4.82k|    if (!ht->timer_ids)
  ------------------
  |  Branch (634:9): [True: 0, False: 4.82k]
  ------------------
  635|      0|        return PJ_ENOMEM;
  ------------------
  |  |  348|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  636|       |
  637|       |    // Initialize the "freelist," which uses negative values to
  638|       |    // distinguish freelist elements from "pointers" into the <heap_>
  639|       |    // array.
  640|  14.8M|    for (i=0; i<size; ++i)
  ------------------
  |  Branch (640:15): [True: 14.8M, False: 4.82k]
  ------------------
  641|  14.8M|        ht->timer_ids[i] = -((pj_timer_id_t) (i + 1));
  642|       |
  643|       |#if PJ_TIMER_USE_LINKED_LIST
  644|       |    pj_list_init(&ht->head_list);
  645|       |#endif
  646|       |
  647|  4.82k|    *p_heap = ht;
  648|  4.82k|    return PJ_SUCCESS;
  649|  4.82k|}
pj_timer_heap_destroy:
  652|  4.82k|{
  653|  4.82k|    if (ht->lock && ht->auto_delete_lock) {
  ------------------
  |  Branch (653:9): [True: 4.82k, False: 0]
  |  Branch (653:21): [True: 4.82k, False: 0]
  ------------------
  654|  4.82k|        pj_lock_destroy(ht->lock);
  655|  4.82k|        ht->lock = NULL;
  656|  4.82k|    }
  657|  4.82k|}
pj_timer_heap_set_lock:
  662|  4.82k|{
  663|  4.82k|    if (ht->lock && ht->auto_delete_lock)
  ------------------
  |  Branch (663:9): [True: 0, False: 4.82k]
  |  Branch (663:21): [True: 0, False: 0]
  ------------------
  664|      0|        pj_lock_destroy(ht->lock);
  665|       |
  666|  4.82k|    ht->lock = lock;
  667|  4.82k|    ht->auto_delete_lock = auto_del;
  668|  4.82k|}
pj_timer_heap_set_max_timed_out_per_poll:
  673|  4.82k|{
  674|  4.82k|    unsigned old_count = ht->max_entries_per_poll;
  675|  4.82k|    ht->max_entries_per_poll = count;
  676|  4.82k|    return old_count;
  677|  4.82k|}
pj_timer_heap_dump:
  979|  4.82k|{
  980|  4.82k|    lock_timer_heap(ht);
  981|       |
  982|  4.82k|    PJ_LOG(3,(THIS_FILE, "Dumping timer heap:"));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  983|  4.82k|    PJ_LOG(3,(THIS_FILE, "  Cur size: %d entries, max: %d",
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  984|  4.82k|                         (int)ht->cur_size, (int)ht->max_size));
  985|       |
  986|  4.82k|    if (ht->cur_size) {
  ------------------
  |  Branch (986:9): [True: 0, False: 4.82k]
  ------------------
  987|       |#if PJ_TIMER_USE_LINKED_LIST
  988|       |        pj_timer_entry_dup *tmp_dup;
  989|       |#else
  990|      0|        unsigned i;
  991|      0|#endif
  992|      0|        pj_time_val now;
  993|       |
  994|      0|        PJ_LOG(3,(THIS_FILE, "  Entries: "));
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  995|      0|        PJ_LOG(3,(THIS_FILE, "    _id\tId\tElapsed\tSource"));
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  996|      0|        PJ_LOG(3,(THIS_FILE, "    ----------------------------------"));
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  997|       |
  998|      0|        pj_gettickcount(&now);
  999|       |
 1000|      0|#if !PJ_TIMER_USE_LINKED_LIST
 1001|      0|        for (i=0; i<(unsigned)ht->cur_size; ++i)
  ------------------
  |  Branch (1001:19): [True: 0, False: 0]
  ------------------
 1002|      0|        {
 1003|      0|            pj_timer_entry_dup *e = ht->heap[i];
 1004|       |#else
 1005|       |        for (tmp_dup = ht->head_list.next; tmp_dup != &ht->head_list;
 1006|       |             tmp_dup = tmp_dup->next)
 1007|       |        {
 1008|       |            pj_timer_entry_dup *e = tmp_dup;
 1009|       |#endif
 1010|       |
 1011|      0|            pj_time_val delta;
 1012|       |
 1013|      0|            if (PJ_TIME_VAL_LTE(e->_timer_value, now))
  ------------------
  |  |  497|      0|#define PJ_TIME_VAL_LTE(t1, t2) (!PJ_TIME_VAL_GT(t1, t2))
  |  |  ------------------
  |  |  |  |  465|      0|#define PJ_TIME_VAL_GT(t1, t2)  ((t1).sec>(t2).sec || \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (465:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  466|      0|                                ((t1).sec==(t2).sec && (t1).msec>(t2).msec))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (466:34): [True: 0, False: 0]
  |  |  |  |  |  Branch (466:56): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1014|      0|                delta.sec = delta.msec = 0;
 1015|      0|            else {
 1016|      0|                delta = e->_timer_value;
 1017|      0|                PJ_TIME_VAL_SUB(delta, now);
  ------------------
  |  |  522|      0|#define PJ_TIME_VAL_SUB(t1, t2)     do {                            \
  |  |  523|      0|                                        (t1).sec -= (t2).sec;       \
  |  |  524|      0|                                        (t1).msec -= (t2).msec;     \
  |  |  525|      0|                                        pj_time_val_normalize(&(t1)); \
  |  |  526|      0|                                    } while (0)
  |  |  ------------------
  |  |  |  Branch (526:46): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1018|      0|            }
 1019|       |
 1020|      0|            PJ_LOG(3,(THIS_FILE, "    %d\t%d\t%d.%03d\t%s:%d",
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1021|      0|                      GET_FIELD(e, _timer_id), GET_FIELD(e, id),
 1022|      0|                      (int)delta.sec, (int)delta.msec,
 1023|      0|                      e->src_file, e->src_line));
 1024|      0|        }
 1025|      0|    }
 1026|       |
 1027|  4.82k|    unlock_timer_heap(ht);
 1028|  4.82k|}
timer.c:lock_timer_heap:
  189|  4.82k|{
  190|  4.82k|    if (ht->lock) {
  ------------------
  |  Branch (190:9): [True: 4.82k, False: 0]
  ------------------
  191|  4.82k|        pj_lock_acquire(ht->lock);
  192|  4.82k|    }
  193|  4.82k|}
timer.c:unlock_timer_heap:
  196|  4.82k|{
  197|  4.82k|    if (ht->lock) {
  ------------------
  |  Branch (197:9): [True: 4.82k, False: 0]
  ------------------
  198|  4.82k|        pj_lock_release(ht->lock);
  199|  4.82k|    }
  200|  4.82k|}

sip_msg.c:init_hdr:
  150|  69.9k|{
  151|  69.9k|    pjsip_hdr *hdr = (pjsip_hdr*) hptr;
  152|  69.9k|    hdr->type = htype;
  153|  69.9k|    hdr->name.ptr = pjsip_hdr_names[htype].name;
  154|  69.9k|    hdr->name.slen = pjsip_hdr_names[htype].name_len;
  155|  69.9k|    if (pjsip_hdr_names[htype].sname) {
  ------------------
  |  Branch (155:9): [True: 55.5k, False: 14.3k]
  ------------------
  156|  55.5k|        hdr->sname.ptr = pjsip_hdr_names[htype].sname;
  157|  55.5k|        hdr->sname.slen = 1;
  158|  55.5k|    } else {
  159|  14.3k|        hdr->sname = hdr->name;
  160|  14.3k|    }
  161|  69.9k|    hdr->vptr = (pjsip_hdr_vptr*) vptr;
  162|  69.9k|    pj_list_init(hdr);
  163|  69.9k|}

sip_endpoint.c:pjsip_cfg:
  301|  4.82k|{
  302|  4.82k|    return &pjsip_sip_cfg_var;
  303|  4.82k|}
sip_transaction.c:pjsip_cfg:
  301|  48.2k|{
  302|  48.2k|    return &pjsip_sip_cfg_var;
  303|  48.2k|}

pjsip_auth_init_parser:
  295|  4.82k|{
  296|  4.82k|    pj_status_t status;
  297|       |
  298|  4.82k|    status = pjsip_register_hdr_parser( "Authorization", NULL, 
  299|  4.82k|                                        &parse_hdr_authorization);
  300|  4.82k|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  301|  4.82k|    status = pjsip_register_hdr_parser( "Proxy-Authorization", NULL, 
  302|  4.82k|                                        &parse_hdr_proxy_authorization);
  303|  4.82k|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  304|  4.82k|    status = pjsip_register_hdr_parser( "WWW-Authenticate", NULL, 
  305|  4.82k|                                        &parse_hdr_www_authenticate);
  306|  4.82k|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  307|  4.82k|    status = pjsip_register_hdr_parser( "Proxy-Authenticate", NULL, 
  308|  4.82k|                                        &parse_hdr_proxy_authenticate);
  309|  4.82k|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  310|       |
  311|  4.82k|    return PJ_SUCCESS;
  312|  4.82k|}

pjsip_endpt_register_module:
  161|  14.4k|{
  162|  14.4k|    pj_status_t status = PJ_SUCCESS;
  163|  14.4k|    pjsip_module *m;
  164|  14.4k|    unsigned i;
  165|       |
  166|  14.4k|    pj_rwmutex_lock_write(endpt->mod_mutex);
  167|       |
  168|       |    /* Make sure that this module has not been registered. */
  169|  28.9k|    PJ_ASSERT_ON_FAIL(  pj_list_find_node(&endpt->module_list, mod) == NULL,
  ------------------
  |  |   73|  14.4k|            { \
  |  |   74|  14.4k|                pj_assert(expr); \
  |  |  ------------------
  |  |  |  |   48|  14.4k|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |   75|  14.4k|                if (!(expr)) exec_on_fail; \
  |  |  ------------------
  |  |  |  Branch (75:21): [True: 0, False: 14.4k]
  |  |  ------------------
  |  |   76|  14.4k|            }
  ------------------
  170|  28.9k|                        {status = PJ_EEXISTS; goto on_return;});
  171|       |
  172|       |    /* Make sure that no module with the same name has been registered. */
  173|  28.9k|    PJ_ASSERT_ON_FAIL(  pj_list_search(&endpt->module_list, &mod->name, 
  ------------------
  |  |   73|  14.4k|            { \
  |  |   74|  14.4k|                pj_assert(expr); \
  |  |  ------------------
  |  |  |  |   48|  14.4k|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |   75|  14.4k|                if (!(expr)) exec_on_fail; \
  |  |  ------------------
  |  |  |  Branch (75:21): [True: 0, False: 14.4k]
  |  |  ------------------
  |  |   76|  14.4k|            }
  ------------------
  174|  28.9k|                                       &cmp_mod_name)==NULL,
  175|  28.9k|                        {status = PJ_EEXISTS; goto on_return; });
  176|       |
  177|       |    /* Find unused ID for this module. */
  178|  28.9k|    for (i=0; i<PJ_ARRAY_SIZE(endpt->modules); ++i) {
  ------------------
  |  |  294|  28.9k|#define PJ_ARRAY_SIZE(a)    (sizeof(a)/sizeof(a[0]))
  ------------------
  |  Branch (178:15): [True: 28.9k, False: 0]
  ------------------
  179|  28.9k|        if (endpt->modules[i] == NULL)
  ------------------
  |  Branch (179:13): [True: 14.4k, False: 14.4k]
  ------------------
  180|  14.4k|            break;
  181|  28.9k|    }
  182|  28.9k|    if (i == PJ_ARRAY_SIZE(endpt->modules)) {
  ------------------
  |  |  294|  14.4k|#define PJ_ARRAY_SIZE(a)    (sizeof(a)/sizeof(a[0]))
  ------------------
  |  Branch (182:9): [True: 0, False: 14.4k]
  ------------------
  183|      0|        pj_assert(!"Too many modules registered!");
  ------------------
  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  ------------------
  184|      0|        status = PJ_ETOOMANY;
  ------------------
  |  |  363|      0|#define PJ_ETOOMANY         (PJ_ERRNO_START_STATUS + 10)/* 70010 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  185|      0|        goto on_return;
  186|      0|    }
  187|       |
  188|       |    /* Assign the ID. */
  189|  14.4k|    mod->id = i;
  190|       |
  191|       |    /* Try to load the module. */
  192|  14.4k|    if (mod->load) {
  ------------------
  |  Branch (192:9): [True: 4.82k, False: 9.64k]
  ------------------
  193|  4.82k|        status = (*mod->load)(endpt);
  194|  4.82k|        if (status != PJ_SUCCESS)
  ------------------
  |  Branch (194:13): [True: 0, False: 4.82k]
  ------------------
  195|      0|            goto on_return;
  196|  4.82k|    }
  197|       |
  198|       |    /* Try to start the module. */
  199|  14.4k|    if (mod->start) {
  ------------------
  |  Branch (199:9): [True: 4.82k, False: 9.64k]
  ------------------
  200|  4.82k|        status = (*mod->start)();
  201|  4.82k|        if (status != PJ_SUCCESS)
  ------------------
  |  Branch (201:13): [True: 0, False: 4.82k]
  ------------------
  202|      0|            goto on_return;
  203|  4.82k|    }
  204|       |
  205|       |    /* Save the module. */
  206|  14.4k|    endpt->modules[i] = mod;
  207|       |
  208|       |    /* Put in the module list, sorted by priority. */
  209|  14.4k|    m = endpt->module_list.next;
  210|  28.9k|    while (m != &endpt->module_list) {
  ------------------
  |  Branch (210:12): [True: 14.4k, False: 14.4k]
  ------------------
  211|  14.4k|        if (m->priority > mod->priority)
  ------------------
  |  Branch (211:13): [True: 0, False: 14.4k]
  ------------------
  212|      0|            break;
  213|  14.4k|        m = m->next;
  214|  14.4k|    }
  215|  14.4k|    pj_list_insert_before(m, mod);
  216|       |
  217|       |    /* Done. */
  218|       |
  219|  14.4k|    PJ_LOG(4,(THIS_FILE, "Module \"%.*s\" registered", 
  ------------------
  |  |  106|  14.4k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  14.4k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 14.4k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  14.4k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  220|  14.4k|              (int)mod->name.slen, mod->name.ptr));
  221|       |
  222|  14.4k|on_return:
  223|  14.4k|    pj_rwmutex_unlock_write(endpt->mod_mutex);
  224|  14.4k|    return status;
  225|  14.4k|}
pjsip_endpt_create:
  431|  4.82k|{
  432|  4.82k|    pj_status_t status;
  433|  4.82k|    pj_pool_t *pool;
  434|  4.82k|    pjsip_endpoint *endpt;
  435|  4.82k|    pjsip_max_fwd_hdr *mf_hdr;
  436|  4.82k|    pj_lock_t *lock = NULL;
  437|       |
  438|       |
  439|  4.82k|    status = pj_register_strerror(PJSIP_ERRNO_START, PJ_ERRNO_SPACE_SIZE,
  ------------------
  |  |   47|  4.82k|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  ------------------
  |  |  |  |  470|  4.82k|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  463|  4.82k|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  456|  4.82k|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  444|  4.82k|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  450|  4.82k|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  450|  4.82k|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|  4.82k|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  status = pj_register_strerror(PJSIP_ERRNO_START, PJ_ERRNO_SPACE_SIZE,
  ------------------
  |  |  450|  4.82k|#define PJ_ERRNO_SPACE_SIZE     50000
  ------------------
  440|  4.82k|                                  &pjsip_strerror);
  441|  4.82k|    pj_assert(status == PJ_SUCCESS);
  ------------------
  |  |   48|  4.82k|#   define pj_assert(expr)   assert(expr)
  ------------------
  442|       |
  443|  4.82k|    PJ_LOG(5, (THIS_FILE, "Creating endpoint instance..."));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  444|       |
  445|  4.82k|    *p_endpt = NULL;
  446|       |
  447|       |    /* Create pool */
  448|  4.82k|    pool = pj_pool_create(pf, "pept%p", 
  449|  4.82k|                          PJSIP_POOL_LEN_ENDPT, PJSIP_POOL_INC_ENDPT,
  ------------------
  |  |  960|  4.82k|#   define PJSIP_POOL_LEN_ENDPT         (16000)
  ------------------
                                        PJSIP_POOL_LEN_ENDPT, PJSIP_POOL_INC_ENDPT,
  ------------------
  |  |  967|  4.82k|#   define PJSIP_POOL_INC_ENDPT         (4000)
  ------------------
  450|  4.82k|                          &pool_callback);
  451|  4.82k|    if (!pool)
  ------------------
  |  Branch (451:9): [True: 0, False: 4.82k]
  ------------------
  452|      0|        return PJ_ENOMEM;
  ------------------
  |  |  348|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  453|       |
  454|       |    /* Create endpoint. */
  455|  4.82k|    endpt = PJ_POOL_ZALLOC_T(pool, pjsip_endpoint);
  ------------------
  |  |  520|  4.82k|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  456|  4.82k|    endpt->pool = pool;
  457|  4.82k|    endpt->pf = pf;
  458|       |
  459|       |    /* Init modules list. */
  460|  4.82k|    pj_list_init(&endpt->module_list);
  461|       |
  462|       |    /* Initialize exit callback list. */
  463|  4.82k|    pj_list_init(&endpt->exit_cb_list);
  464|       |
  465|       |    /* Create R/W mutex for module manipulation. */
  466|  4.82k|    status = pj_rwmutex_create(endpt->pool, "ept%p", &endpt->mod_mutex);
  467|  4.82k|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (467:9): [True: 0, False: 4.82k]
  ------------------
  468|      0|        goto on_error;
  469|       |
  470|       |    /* Init parser. */
  471|  4.82k|    init_sip_parser();
  472|       |
  473|       |    /* Init tel: uri */
  474|  4.82k|    pjsip_tel_uri_subsys_init();
  475|       |
  476|       |    /* Get name. */
  477|  4.82k|    if (name != NULL) {
  ------------------
  |  Branch (477:9): [True: 4.82k, False: 0]
  ------------------
  478|  4.82k|        pj_str_t temp;
  479|  4.82k|        pj_strdup_with_null(endpt->pool, &endpt->name, pj_cstr(&temp, name));
  480|  4.82k|    } else {
  481|      0|        pj_strdup_with_null(endpt->pool, &endpt->name, pj_gethostname());
  482|      0|    }
  483|       |
  484|       |    /* Create mutex for the events, etc. */
  485|  4.82k|    status = pj_mutex_create_recursive( endpt->pool, "ept%p", &endpt->mutex );
  486|  4.82k|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (486:9): [True: 0, False: 4.82k]
  ------------------
  487|      0|        goto on_error;
  488|      0|    }
  489|       |
  490|       |    /* Create timer heap to manage all timers within this endpoint. */
  491|  4.82k|    status = pj_timer_heap_create( endpt->pool, PJSIP_MAX_TIMER_COUNT, 
  ------------------
  |  |  952|  4.82k|#   define PJSIP_MAX_TIMER_COUNT        (2*pjsip_cfg()->tsx.max_count + \
  |  |  953|  4.82k|                                         2*PJSIP_MAX_DIALOG_COUNT)
  |  |  ------------------
  |  |  |  |  327|  4.82k|#   define PJSIP_MAX_DIALOG_COUNT       (512-1)
  |  |  ------------------
  ------------------
  492|  4.82k|                                   &endpt->timer_heap);
  493|  4.82k|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (493:9): [True: 0, False: 4.82k]
  ------------------
  494|      0|        goto on_error;
  495|      0|    }
  496|       |
  497|       |    /* Set recursive lock for the timer heap. */
  498|  4.82k|    status = pj_lock_create_recursive_mutex( endpt->pool, "edpt%p", &lock);
  499|  4.82k|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (499:9): [True: 0, False: 4.82k]
  ------------------
  500|      0|        goto on_error;
  501|      0|    }
  502|  4.82k|    pj_timer_heap_set_lock(endpt->timer_heap, lock, PJ_TRUE);
  503|       |
  504|       |    /* Set maximum timed out entries to process in a single poll. */
  505|  4.82k|    pj_timer_heap_set_max_timed_out_per_poll(endpt->timer_heap, 
  506|  4.82k|                                             PJSIP_MAX_TIMED_OUT_ENTRIES);
  ------------------
  |  |  646|  4.82k|#   define PJSIP_MAX_TIMED_OUT_ENTRIES  10
  ------------------
  507|       |
  508|       |    /* Create ioqueue. */
  509|  4.82k|    status = pj_ioqueue_create( endpt->pool, PJSIP_MAX_TRANSPORTS, &endpt->ioqueue);
  ------------------
  |  |  337|  4.82k|#   define PJSIP_MAX_TRANSPORTS         (PJ_IOQUEUE_MAX_HANDLES)
  |  |  ------------------
  |  |  |  |  701|  4.82k|#   define PJ_IOQUEUE_MAX_HANDLES       (64)
  |  |  ------------------
  ------------------
  510|  4.82k|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (510:9): [True: 0, False: 4.82k]
  ------------------
  511|      0|        goto on_error;
  512|      0|    }
  513|       |
  514|       |    /* Create transport manager. */
  515|  4.82k|    status = pjsip_tpmgr_create( endpt->pool, endpt,
  516|  4.82k|                                 &endpt_on_rx_msg,
  517|  4.82k|                                 &endpt_on_tx_msg,
  518|  4.82k|                                 &endpt->transport_mgr);
  519|  4.82k|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (519:9): [True: 0, False: 4.82k]
  ------------------
  520|      0|        goto on_error;
  521|      0|    }
  522|       |
  523|       |    /* Create asynchronous DNS resolver. */
  524|  4.82k|    status = pjsip_resolver_create(endpt->pool, &endpt->resolver);
  525|  4.82k|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (525:9): [True: 0, False: 4.82k]
  ------------------
  526|      0|        PJ_PERROR(4, (THIS_FILE, status,
  ------------------
  |  |  175|      0|#define PJ_PERROR(level,arg)    do { \
  |  |  176|      0|                                    pj_perror_wrapper_##level(arg); \
  |  |  177|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (177:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  527|      0|                      "Error creating resolver instance"));
  528|      0|        goto on_error;
  529|      0|    }
  530|       |
  531|       |    /* Initialize request headers. */
  532|  4.82k|    pj_list_init(&endpt->req_hdr);
  533|       |
  534|       |    /* Add "Max-Forwards" for request header. */
  535|  4.82k|    mf_hdr = pjsip_max_fwd_hdr_create(endpt->pool,
  536|  4.82k|                                      PJSIP_MAX_FORWARDS_VALUE);
  ------------------
  |  | 1046|  4.82k|#define PJSIP_MAX_FORWARDS_VALUE        70
  ------------------
  537|  4.82k|    pj_list_insert_before( &endpt->req_hdr, mf_hdr);
  538|       |
  539|       |    /* Initialize capability header list. */
  540|  4.82k|    pj_list_init(&endpt->cap_hdr);
  541|       |
  542|       |
  543|       |    /* Done. */
  544|  4.82k|    *p_endpt = endpt;
  545|  4.82k|    return status;
  546|       |
  547|      0|on_error:
  548|      0|    if (endpt->transport_mgr) {
  ------------------
  |  Branch (548:9): [True: 0, False: 0]
  ------------------
  549|      0|        pjsip_tpmgr_destroy(endpt->transport_mgr);
  550|      0|        endpt->transport_mgr = NULL;
  551|      0|    }
  552|      0|    if (endpt->ioqueue) {
  ------------------
  |  Branch (552:9): [True: 0, False: 0]
  ------------------
  553|      0|        pj_ioqueue_destroy(endpt->ioqueue);
  554|      0|        endpt->ioqueue = NULL;
  555|      0|    }
  556|      0|    if (endpt->timer_heap) {
  ------------------
  |  Branch (556:9): [True: 0, False: 0]
  ------------------
  557|      0|        pj_timer_heap_destroy(endpt->timer_heap);
  558|      0|        endpt->timer_heap = NULL;
  559|      0|    }
  560|      0|    if (endpt->mutex) {
  ------------------
  |  Branch (560:9): [True: 0, False: 0]
  ------------------
  561|      0|        pj_mutex_destroy(endpt->mutex);
  562|      0|        endpt->mutex = NULL;
  563|      0|    }
  564|      0|    deinit_sip_parser();
  565|      0|    if (endpt->mod_mutex) {
  ------------------
  |  Branch (565:9): [True: 0, False: 0]
  ------------------
  566|      0|        pj_rwmutex_destroy(endpt->mod_mutex);
  567|      0|        endpt->mod_mutex = NULL;
  568|      0|    }
  569|      0|    pj_pool_release( endpt->pool );
  570|       |
  571|      0|    PJ_PERROR(4, (THIS_FILE, status, "Error creating endpoint"));
  ------------------
  |  |  175|      0|#define PJ_PERROR(level,arg)    do { \
  |  |  176|      0|                                    pj_perror_wrapper_##level(arg); \
  |  |  177|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (177:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  572|      0|    return status;
  573|  4.82k|}
pjsip_endpt_destroy:
  579|  4.82k|{
  580|  4.82k|    pjsip_module *mod;
  581|  4.82k|    exit_cb *ecb;
  582|       |
  583|  4.82k|    PJ_LOG(5, (THIS_FILE, "Destroying endpoint instance.."));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  584|       |
  585|       |    /* Phase 1: stop all modules */
  586|  4.82k|    mod = endpt->module_list.prev;
  587|  19.2k|    while (mod != &endpt->module_list) {
  ------------------
  |  Branch (587:12): [True: 14.4k, False: 4.82k]
  ------------------
  588|  14.4k|        pjsip_module *prev = mod->prev;
  589|  14.4k|        if (mod->stop) {
  ------------------
  |  Branch (589:13): [True: 4.82k, False: 9.64k]
  ------------------
  590|  4.82k|            (*mod->stop)();
  591|  4.82k|        }
  592|  14.4k|        mod = prev;
  593|  14.4k|    }
  594|       |
  595|       |    /* Phase 2: unload modules. */
  596|  4.82k|    mod = endpt->module_list.prev;
  597|  19.2k|    while (mod != &endpt->module_list) {
  ------------------
  |  Branch (597:12): [True: 14.4k, False: 4.82k]
  ------------------
  598|  14.4k|        pjsip_module *prev = mod->prev;
  599|  14.4k|        unload_module(endpt, mod);
  600|  14.4k|        mod = prev;
  601|  14.4k|    }
  602|       |
  603|       |    /* Destroy resolver */
  604|  4.82k|    pjsip_resolver_destroy(endpt->resolver);
  605|       |
  606|       |    /* Shutdown and destroy all transports. */
  607|  4.82k|    pjsip_tpmgr_destroy(endpt->transport_mgr);
  608|       |
  609|       |    /* Destroy ioqueue */
  610|  4.82k|    pj_ioqueue_destroy(endpt->ioqueue);
  611|       |
  612|       |    /* Destroy timer heap */
  613|  4.82k|#if PJ_TIMER_DEBUG
  614|  4.82k|    pj_timer_heap_dump(endpt->timer_heap);
  615|  4.82k|#endif
  616|  4.82k|    pj_timer_heap_destroy(endpt->timer_heap);
  617|       |
  618|       |    /* Call all registered exit callbacks */
  619|  4.82k|    ecb = endpt->exit_cb_list.next;
  620|  4.82k|    while (ecb != &endpt->exit_cb_list) {
  ------------------
  |  Branch (620:12): [True: 0, False: 4.82k]
  ------------------
  621|      0|        (*ecb->func)(endpt);
  622|      0|        ecb = ecb->next;
  623|      0|    }
  624|       |
  625|       |    /* Delete endpoint mutex. */
  626|  4.82k|    pj_mutex_destroy(endpt->mutex);
  627|       |
  628|       |    /* Deinit parser */
  629|  4.82k|    deinit_sip_parser();
  630|       |
  631|       |    /* Delete module's mutex */
  632|  4.82k|    pj_rwmutex_destroy(endpt->mod_mutex);
  633|       |
  634|       |    /* Finally destroy pool. */
  635|  4.82k|    pj_pool_release(endpt->pool);
  636|       |
  637|  4.82k|    PJ_LOG(4, (THIS_FILE, "Endpoint %p destroyed", endpt));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  638|  4.82k|}
pjsip_endpt_create_pool:
  656|  19.2k|{
  657|  19.2k|    pj_pool_t *pool;
  658|       |
  659|       |    /* Lock endpoint mutex. */
  660|       |    /* No need to lock mutex. Factory is thread safe.
  661|       |    pj_mutex_lock(endpt->mutex);
  662|       |     */
  663|       |
  664|       |    /* Create pool */
  665|  19.2k|    pool = pj_pool_create( endpt->pf, pool_name,
  666|  19.2k|                           initial, increment, &pool_callback);
  667|       |
  668|       |    /* Unlock mutex. */
  669|       |    /* No need to lock mutex. Factory is thread safe.
  670|       |    pj_mutex_unlock(endpt->mutex);
  671|       |     */
  672|       |
  673|  19.2k|    if (!pool) {
  ------------------
  |  Branch (673:9): [True: 0, False: 19.2k]
  ------------------
  674|      0|        PJ_LOG(4, (THIS_FILE, "Unable to create pool %s!", pool_name));
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  675|      0|    }
  676|       |
  677|  19.2k|    return pool;
  678|  19.2k|}
pjsip_endpt_release_pool:
  685|  19.2k|{
  686|  19.2k|    PJ_LOG(6, (THIS_FILE, "Releasing pool %s", pj_pool_getobjname(pool)));
  ------------------
  |  |  106|  19.2k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  19.2k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 19.2k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  19.2k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  687|       |
  688|       |    /* Don't need to acquire mutex since pool factory is thread safe
  689|       |       pj_mutex_lock(endpt->mutex);
  690|       |     */
  691|  19.2k|    pj_pool_release( pool );
  692|       |
  693|  19.2k|    PJ_UNUSED_ARG(endpt);
  ------------------
  |  | 1433|  19.2k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  694|       |    /*
  695|       |    pj_mutex_unlock(endpt->mutex);
  696|       |     */
  697|  19.2k|}
pjsip_endpt_get_tpmgr:
 1212|  4.82k|{
 1213|  4.82k|    return endpt->transport_mgr;
 1214|  4.82k|}
sip_endpoint.c:cmp_mod_name:
  149|  28.9k|{
  150|  28.9k|    return pj_stricmp((const pj_str_t*)name, &((pjsip_module*)mod)->name);
  151|  28.9k|}
sip_endpoint.c:unload_module:
  274|  14.4k|{
  275|  14.4k|    pj_status_t status;
  276|       |
  277|       |    /* Try to unload the module. */
  278|  14.4k|    if (mod->unload) {
  ------------------
  |  Branch (278:9): [True: 4.82k, False: 9.64k]
  ------------------
  279|  4.82k|        status = (*mod->unload)();
  280|  4.82k|        if (status != PJ_SUCCESS) 
  ------------------
  |  Branch (280:13): [True: 0, False: 4.82k]
  ------------------
  281|      0|            return status;
  282|  4.82k|    }
  283|       |
  284|       |    /* Module MUST NOT set module ID to -1. */
  285|  14.4k|    pj_assert(mod->id >= 0);
  ------------------
  |  |   48|  14.4k|#   define pj_assert(expr)   assert(expr)
  ------------------
  286|       |
  287|       |    /* Remove module from array. */
  288|  14.4k|    endpt->modules[mod->id] = NULL;
  289|       |
  290|       |    /* Remove module from list. */
  291|  14.4k|    pj_list_erase(mod);
  292|       |
  293|       |    /* Set module Id to -1. */
  294|  14.4k|    mod->id = -1;
  295|       |
  296|       |    /* Done. */
  297|  14.4k|    status = PJ_SUCCESS;
  298|       |
  299|  14.4k|    PJ_LOG(4,(THIS_FILE, "Module \"%.*s\" unregistered", 
  ------------------
  |  |  106|  14.4k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  14.4k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 14.4k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  14.4k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  300|  14.4k|              (int)mod->name.slen, mod->name.ptr));
  301|       |
  302|  14.4k|    return status;
  303|  14.4k|}

pjsip_method_init_np:
  271|  2.07k|{
  272|  2.07k|    unsigned i;
  273|  13.7k|    for (i=0; i<PJ_ARRAY_SIZE(method_names); ++i) {
  ------------------
  |  |  294|  13.7k|#define PJ_ARRAY_SIZE(a)    (sizeof(a)/sizeof(a[0]))
  ------------------
  |  Branch (273:15): [True: 11.8k, False: 1.88k]
  ------------------
  274|  11.8k|        if (pj_memcmp(str, method_names[i], sizeof(pj_str_t))==0 || 
  ------------------
  |  Branch (274:13): [True: 0, False: 11.8k]
  ------------------
  275|  11.8k|            pj_stricmp(str, method_names[i])==0) 
  ------------------
  |  Branch (275:13): [True: 197, False: 11.6k]
  ------------------
  276|    197|        {
  277|    197|            m->id = (pjsip_method_e)i;
  278|    197|            m->name = *method_names[i];
  279|    197|            return;
  280|    197|        }
  281|  11.8k|    }
  282|  1.88k|    m->id = PJSIP_OTHER_METHOD;
  283|  1.88k|    m->name = *str;
  284|  1.88k|}
pjsip_msg_create:
  317|  4.79k|{
  318|  4.79k|    pjsip_msg *msg = PJ_POOL_ALLOC_T(pool, pjsip_msg);
  ------------------
  |  |  506|  4.79k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
  319|  4.79k|    pj_list_init(&msg->hdr);
  320|  4.79k|    msg->type = type;
  321|  4.79k|    msg->body = NULL;
  322|  4.79k|    return msg;
  323|  4.79k|}
pjsip_media_type_cp:
  717|  1.44k|{
  718|  1.44k|    PJ_ASSERT_ON_FAIL(pool && dst && src, return);
  ------------------
  |  |   73|  1.44k|            { \
  |  |   74|  1.44k|                pj_assert(expr); \
  |  |  ------------------
  |  |  |  |   48|  1.44k|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |   75|  5.76k|                if (!(expr)) exec_on_fail; \
  |  |  ------------------
  |  |  |  Branch (75:23): [True: 1.44k, False: 0]
  |  |  |  Branch (75:23): [True: 1.44k, False: 0]
  |  |  |  Branch (75:23): [True: 1.44k, False: 0]
  |  |  ------------------
  |  |   76|  1.44k|            }
  ------------------
  719|  1.44k|    pj_strdup(pool, &dst->type,    &src->type);
  720|  1.44k|    pj_strdup(pool, &dst->subtype, &src->subtype);
  721|  1.44k|    pjsip_param_clone(pool, &dst->param, &src->param);
  722|  1.44k|}
pjsip_generic_string_hdr_init2:
  747|  3.52k|{
  748|  3.52k|    init_hdr(hdr, PJSIP_H_OTHER, &generic_hdr_vptr);
  749|  3.52k|    if (hname) {
  ------------------
  |  Branch (749:9): [True: 3.52k, False: 0]
  ------------------
  750|  3.52k|        hdr->name = *hname;
  751|  3.52k|        hdr->sname = *hname;
  752|  3.52k|    }
  753|  3.52k|    if (hvalue) {
  ------------------
  |  Branch (753:9): [True: 3.52k, False: 0]
  ------------------
  754|  3.52k|        hdr->hvalue = *hvalue;
  755|  3.52k|    } else {
  756|      0|        hdr->hvalue.ptr = NULL;
  757|      0|        hdr->hvalue.slen = 0;
  758|      0|    }
  759|  3.52k|}
pjsip_generic_string_hdr_init:
  766|  3.52k|{
  767|  3.52k|    pjsip_generic_string_hdr *hdr = (pjsip_generic_string_hdr*) mem;
  768|  3.52k|    pj_str_t dup_hname, dup_hval;
  769|       |
  770|  3.52k|    if (hnames) {
  ------------------
  |  Branch (770:9): [True: 0, False: 3.52k]
  ------------------
  771|      0|        pj_strdup(pool, &dup_hname, hnames);
  772|  3.52k|    } else {
  773|  3.52k|        pj_bzero(&dup_hname, sizeof(pj_str_t));
  774|  3.52k|    }
  775|       |
  776|  3.52k|    if (hvalue) {
  ------------------
  |  Branch (776:9): [True: 0, False: 3.52k]
  ------------------
  777|      0|        pj_strdup(pool, &dup_hval, hvalue);
  778|  3.52k|    } else {
  779|  3.52k|        pj_bzero(&dup_hval, sizeof(pj_str_t));
  780|  3.52k|    }
  781|       |
  782|  3.52k|    pjsip_generic_string_hdr_init2(hdr, &dup_hname, &dup_hval);
  783|  3.52k|    return hdr;
  784|  3.52k|}
pjsip_generic_string_hdr_create:
  789|  3.52k|{
  790|  3.52k|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_generic_string_hdr));
  791|  3.52k|    return pjsip_generic_string_hdr_init(pool, mem, hnames, hvalue);
  792|  3.52k|}
pjsip_cid_hdr_init:
 1054|    680|{
 1055|    680|    pjsip_cid_hdr *hdr = (pjsip_cid_hdr*) mem;
 1056|       |
 1057|    680|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1433|    680|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1058|       |
 1059|    680|    init_hdr(hdr, PJSIP_H_CALL_ID, &generic_hdr_vptr);
 1060|    680|    return hdr;
 1061|       |
 1062|    680|}
pjsip_cid_hdr_create:
 1065|    680|{
 1066|    680|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_cid_hdr));
 1067|    680|    return pjsip_cid_hdr_init(pool, mem);
 1068|    680|}
pjsip_clen_hdr_init:
 1088|    706|{
 1089|    706|    pjsip_clen_hdr *hdr = (pjsip_clen_hdr*) mem;
 1090|       |
 1091|    706|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1433|    706|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1092|       |
 1093|    706|    init_hdr(hdr, PJSIP_H_CONTENT_LENGTH, &clen_hdr_vptr);
 1094|    706|    hdr->len = 0;
 1095|    706|    return hdr;
 1096|    706|}
pjsip_clen_hdr_create:
 1099|    706|{
 1100|    706|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_clen_hdr));
 1101|    706|    return pjsip_clen_hdr_init(pool, mem);
 1102|    706|}
pjsip_cseq_hdr_init:
 1152|  1.08k|{
 1153|  1.08k|    pjsip_cseq_hdr *hdr = (pjsip_cseq_hdr*) mem;
 1154|       |
 1155|  1.08k|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1433|  1.08k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1156|       |
 1157|  1.08k|    init_hdr(hdr, PJSIP_H_CSEQ, &cseq_hdr_vptr);
 1158|  1.08k|    hdr->cseq = 0;
 1159|  1.08k|    hdr->method.id = PJSIP_OTHER_METHOD;
 1160|  1.08k|    hdr->method.name.ptr = NULL;
 1161|  1.08k|    hdr->method.name.slen = 0;
 1162|  1.08k|    return hdr;
 1163|  1.08k|}
pjsip_cseq_hdr_create:
 1166|  1.08k|{
 1167|  1.08k|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_cseq_hdr));
 1168|  1.08k|    return pjsip_cseq_hdr_init(pool, mem);
 1169|  1.08k|}
pjsip_contact_hdr_init:
 1232|  20.3k|{
 1233|  20.3k|    pjsip_contact_hdr *hdr = (pjsip_contact_hdr*) mem;
 1234|       |
 1235|  20.3k|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1433|  20.3k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1236|       |
 1237|  20.3k|    pj_bzero(mem, sizeof(pjsip_contact_hdr));
 1238|  20.3k|    init_hdr(hdr, PJSIP_H_CONTACT, &contact_hdr_vptr);
 1239|  20.3k|    hdr->expires = PJSIP_EXPIRES_NOT_SPECIFIED;
  ------------------
  |  | 1427|  20.3k|#define PJSIP_EXPIRES_NOT_SPECIFIED     ((pj_uint32_t)0xFFFFFFFFUL)
  ------------------
 1240|  20.3k|    pj_list_init(&hdr->other_param);
 1241|  20.3k|    return hdr;
 1242|  20.3k|}
pjsip_contact_hdr_create:
 1245|  20.3k|{
 1246|  20.3k|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_contact_hdr));
 1247|  20.3k|    return pjsip_contact_hdr_init(pool, mem);
 1248|  20.3k|}
pjsip_ctype_hdr_init:
 1373|  3.33k|{
 1374|  3.33k|    pjsip_ctype_hdr *hdr = (pjsip_ctype_hdr*) mem;
 1375|       |
 1376|  3.33k|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1433|  3.33k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1377|       |
 1378|  3.33k|    pj_bzero(mem, sizeof(pjsip_ctype_hdr));
 1379|  3.33k|    init_hdr(hdr, PJSIP_H_CONTENT_TYPE, &ctype_hdr_vptr);
 1380|  3.33k|    pj_list_init(&hdr->media.param);
 1381|  3.33k|    return hdr;
 1382|       |
 1383|  3.33k|}
pjsip_ctype_hdr_create:
 1386|  3.33k|{
 1387|  3.33k|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_ctype_hdr));
 1388|  3.33k|    return pjsip_ctype_hdr_init(pool, mem);
 1389|  3.33k|}
pjsip_expires_hdr_init:
 1467|    594|{
 1468|    594|    pjsip_expires_hdr *hdr = (pjsip_expires_hdr*) mem;
 1469|       |
 1470|    594|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1433|    594|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1471|       |
 1472|    594|    init_hdr(hdr, PJSIP_H_EXPIRES, &generic_int_hdr_vptr);
 1473|    594|    hdr->ivalue = value;
 1474|    594|    return hdr;
 1475|       |
 1476|    594|}
pjsip_expires_hdr_create:
 1480|    594|{
 1481|    594|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_expires_hdr));
 1482|    594|    return pjsip_expires_hdr_init(pool, mem, value);
 1483|    594|}
pjsip_from_hdr_init:
 1506|  1.04k|{
 1507|  1.04k|    pjsip_from_hdr *hdr = (pjsip_from_hdr*) mem;
 1508|       |
 1509|  1.04k|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1433|  1.04k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1510|       |
 1511|  1.04k|    pj_bzero(mem, sizeof(pjsip_from_hdr));
 1512|  1.04k|    init_hdr(hdr, PJSIP_H_FROM, &fromto_hdr_vptr);
 1513|  1.04k|    pj_list_init(&hdr->other_param);
 1514|  1.04k|    return hdr;
 1515|  1.04k|}
pjsip_from_hdr_create:
 1518|  1.04k|{
 1519|  1.04k|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_from_hdr));
 1520|  1.04k|    return pjsip_from_hdr_init(pool, mem);
 1521|  1.04k|}
pjsip_to_hdr_init:
 1525|  2.73k|{
 1526|  2.73k|    pjsip_to_hdr *hdr = (pjsip_to_hdr*) mem;
 1527|       |
 1528|  2.73k|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1433|  2.73k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1529|       |
 1530|  2.73k|    pj_bzero(mem, sizeof(pjsip_to_hdr));
 1531|  2.73k|    init_hdr(hdr, PJSIP_H_TO, &fromto_hdr_vptr);
 1532|  2.73k|    pj_list_init(&hdr->other_param);
 1533|  2.73k|    return hdr;
 1534|       |
 1535|  2.73k|}
pjsip_to_hdr_create:
 1538|  2.73k|{
 1539|  2.73k|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_to_hdr));
 1540|  2.73k|    return pjsip_to_hdr_init(pool, mem);
 1541|  2.73k|}
pjsip_max_fwd_hdr_init:
 1630|  5.66k|{
 1631|  5.66k|    pjsip_max_fwd_hdr *hdr = (pjsip_max_fwd_hdr*) mem;
 1632|       |
 1633|  5.66k|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1433|  5.66k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1634|       |
 1635|  5.66k|    init_hdr(hdr, PJSIP_H_MAX_FORWARDS, &generic_int_hdr_vptr);
 1636|  5.66k|    hdr->ivalue = value;
 1637|  5.66k|    return hdr;
 1638|       |
 1639|  5.66k|}
pjsip_max_fwd_hdr_create:
 1643|  5.66k|{
 1644|  5.66k|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_max_fwd_hdr));
 1645|  5.66k|    return pjsip_max_fwd_hdr_init(pool, mem, value);
 1646|  5.66k|}
pjsip_rr_hdr_init:
 1690|  1.41k|{
 1691|  1.41k|    pjsip_rr_hdr *hdr = (pjsip_rr_hdr*) mem;
 1692|       |
 1693|  1.41k|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1433|  1.41k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1694|       |
 1695|  1.41k|    init_hdr(hdr, PJSIP_H_RECORD_ROUTE, &routing_hdr_vptr);
 1696|  1.41k|    pjsip_name_addr_init(&hdr->name_addr);
 1697|  1.41k|    pj_list_init(&hdr->other_param);
 1698|  1.41k|    return hdr;
 1699|       |
 1700|  1.41k|}
pjsip_rr_hdr_create:
 1703|  1.41k|{
 1704|  1.41k|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_rr_hdr));
 1705|  1.41k|    return pjsip_rr_hdr_init(pool, mem);
 1706|  1.41k|}
pjsip_route_hdr_init:
 1710|  1.90k|{
 1711|  1.90k|    pjsip_route_hdr *hdr = (pjsip_route_hdr*) mem;
 1712|       |
 1713|  1.90k|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1433|  1.90k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1714|       |
 1715|  1.90k|    init_hdr(hdr, PJSIP_H_ROUTE, &routing_hdr_vptr);
 1716|  1.90k|    pjsip_name_addr_init(&hdr->name_addr);
 1717|  1.90k|    pj_list_init(&hdr->other_param);
 1718|  1.90k|    return hdr;
 1719|  1.90k|}
pjsip_route_hdr_create:
 1722|  1.90k|{
 1723|  1.90k|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_route_hdr));
 1724|  1.90k|    return pjsip_route_hdr_init(pool, mem);
 1725|  1.90k|}
pjsip_require_hdr_init:
 1825|    195|{
 1826|    195|    pjsip_require_hdr *hdr = (pjsip_require_hdr*) mem;
 1827|       |
 1828|    195|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1433|    195|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1829|       |
 1830|    195|    init_hdr(hdr, PJSIP_H_REQUIRE, &generic_array_hdr_vptr);
 1831|    195|    hdr->count = 0;
 1832|    195|    return hdr;
 1833|    195|}
pjsip_require_hdr_create:
 1836|    195|{
 1837|    195|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_require_hdr));
 1838|    195|    return pjsip_require_hdr_init(pool, mem);
 1839|    195|}
pjsip_supported_hdr_init:
 1958|  22.3k|{
 1959|  22.3k|    pjsip_supported_hdr *hdr = (pjsip_supported_hdr*) mem;
 1960|       |
 1961|  22.3k|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1433|  22.3k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1962|  22.3k|    init_hdr(hdr, PJSIP_H_SUPPORTED, &generic_array_hdr_vptr);
 1963|  22.3k|    hdr->count = 0;
 1964|  22.3k|    return hdr;
 1965|  22.3k|}
pjsip_supported_hdr_create:
 1968|  22.3k|{
 1969|  22.3k|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_supported_hdr));
 1970|  22.3k|    return pjsip_supported_hdr_init(pool, mem);
 1971|  22.3k|}
pjsip_via_hdr_init:
 2013|  4.34k|{
 2014|  4.34k|    pjsip_via_hdr *hdr = (pjsip_via_hdr*) mem;
 2015|       |
 2016|  4.34k|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1433|  4.34k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 2017|       |
 2018|  4.34k|    pj_bzero(mem, sizeof(pjsip_via_hdr));
 2019|  4.34k|    init_hdr(hdr, PJSIP_H_VIA, &via_hdr_vptr);
 2020|  4.34k|    hdr->ttl_param = -1;
 2021|  4.34k|    hdr->rport_param = -1;
 2022|  4.34k|    pj_list_init(&hdr->other_param);
 2023|  4.34k|    return hdr;
 2024|       |
 2025|  4.34k|}
pjsip_via_hdr_create:
 2028|  4.34k|{
 2029|  4.34k|    void *mem = pj_pool_alloc(pool, sizeof(pjsip_via_hdr));
 2030|  4.34k|    return pjsip_via_hdr_init(pool, mem);
 2031|  4.34k|}

pjsip_multipart_create:
  224|    768|{
  225|    768|    pjsip_msg_body *body;
  226|    768|    pjsip_param *ctype_param;
  227|    768|    struct multipart_data *mp_data;
  228|    768|    pj_str_t STR_BOUNDARY = { "boundary", 8 };
  229|       |
  230|    768|    PJ_ASSERT_RETURN(pool, NULL);
  ------------------
  |  |   59|    768|            do { \
  |  |   60|    768|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 768]
  |  |  ------------------
  |  |   61|    768|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  231|       |
  232|    768|    body = PJ_POOL_ZALLOC_T(pool, pjsip_msg_body);
  ------------------
  |  |  520|    768|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  233|       |
  234|       |    /* content-type */
  235|    768|    if (ctype && ctype->type.slen) {
  ------------------
  |  Branch (235:9): [True: 768, False: 0]
  |  Branch (235:18): [True: 768, False: 0]
  ------------------
  236|    768|        pjsip_media_type_cp(pool, &body->content_type, ctype);
  237|    768|    } else {
  238|      0|        pj_str_t STR_MULTIPART = {"multipart", 9};
  239|      0|        pj_str_t STR_MIXED = { "mixed", 5 };
  240|       |
  241|      0|        pjsip_media_type_init(&body->content_type,
  242|      0|                              &STR_MULTIPART, &STR_MIXED);
  243|      0|    }
  244|       |
  245|       |    /* multipart data */
  246|    768|    mp_data = PJ_POOL_ZALLOC_T(pool, struct multipart_data);
  ------------------
  |  |  520|    768|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  247|    768|    pj_list_init(&mp_data->part_head);
  248|    768|    if (boundary) {
  ------------------
  |  Branch (248:9): [True: 768, False: 0]
  ------------------
  249|    768|        pj_strdup(pool, &mp_data->boundary, boundary);
  250|    768|    } else {
  251|      0|        pj_create_unique_string(pool, &mp_data->boundary);
  252|      0|    }
  253|    768|    body->data = mp_data;
  254|       |
  255|       |    /* Add ";boundary" parameter to content_type parameter. */
  256|    768|    ctype_param = pjsip_param_find(&body->content_type.param, &STR_BOUNDARY);
  257|    768|    if (!ctype_param) {
  ------------------
  |  Branch (257:9): [True: 767, False: 1]
  ------------------
  258|    767|        ctype_param = PJ_POOL_ALLOC_T(pool, pjsip_param);
  ------------------
  |  |  506|    767|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
  259|    767|        ctype_param->name = STR_BOUNDARY;
  260|    767|        pj_list_push_back(&body->content_type.param, ctype_param);
  261|    767|    }
  262|    768|    ctype_param->value = mp_data->boundary;
  263|       |
  264|       |    /* function pointers */
  265|    768|    body->print_body = &multipart_print_body;
  266|    768|    body->clone_data = &multipart_clone_data;
  267|       |
  268|    768|    return body;
  269|    768|}
pjsip_multipart_create_part:
  275|  8.21k|{
  276|  8.21k|    pjsip_multipart_part *mp;
  277|       |
  278|  8.21k|    mp = PJ_POOL_ZALLOC_T(pool, pjsip_multipart_part);
  ------------------
  |  |  520|  8.21k|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  279|  8.21k|    pj_list_init(&mp->hdr);
  280|       |
  281|  8.21k|    return mp;
  282|  8.21k|}
pjsip_multipart_add_part:
  315|  8.21k|{
  316|  8.21k|    struct multipart_data *m_data;
  317|       |
  318|       |    /* All params must be specified */
  319|  8.21k|    PJ_ASSERT_RETURN(pool && mp && part, PJ_EINVAL);
  ------------------
  |  |   59|  8.21k|            do { \
  |  |   60|  32.8k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 8.21k, False: 0]
  |  |  |  Branch (60:23): [True: 8.21k, False: 0]
  |  |  |  Branch (60:23): [True: 8.21k, False: 0]
  |  |  ------------------
  |  |   61|  8.21k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  320|       |
  321|       |    /* mp must really point to an actual multipart msg body */
  322|  8.21k|    PJ_ASSERT_RETURN(mp->print_body==&multipart_print_body, PJ_EINVAL);
  ------------------
  |  |   59|  8.21k|            do { \
  |  |   60|  8.21k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 8.21k]
  |  |  ------------------
  |  |   61|  8.21k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  323|       |
  324|       |    /* The multipart part must contain a valid message body */
  325|  8.21k|    PJ_ASSERT_RETURN(part->body && part->body->print_body, PJ_EINVAL);
  ------------------
  |  |   59|  8.21k|            do { \
  |  |   60|  16.4k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 8.21k, False: 0]
  |  |  |  Branch (60:23): [True: 8.21k, False: 0]
  |  |  ------------------
  |  |   61|  8.21k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  326|       |
  327|  8.21k|    m_data = (struct multipart_data*)mp->data;
  328|  8.21k|    pj_list_push_back(&m_data->part_head, part);
  329|       |
  330|  8.21k|    PJ_UNUSED_ARG(pool);
  ------------------
  |  | 1433|  8.21k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  331|       |
  332|  8.21k|    return PJ_SUCCESS;
  333|  8.21k|}
pjsip_multipart_parse:
  728|    845|{
  729|    845|    pj_str_t boundary, delim;
  730|    845|    char *curptr, *endptr;
  731|    845|    const pjsip_param *ctype_param;
  732|    845|    const pj_str_t STR_BOUNDARY = { "boundary", 8 };
  733|    845|    pjsip_msg_body *body = NULL;
  734|       |
  735|    845|    PJ_ASSERT_RETURN(pool && buf && len && ctype && !options, NULL);
  ------------------
  |  |   59|    845|            do { \
  |  |   60|  6.76k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 845, False: 0]
  |  |  |  Branch (60:23): [True: 845, False: 0]
  |  |  |  Branch (60:23): [True: 845, False: 0]
  |  |  |  Branch (60:23): [True: 845, False: 0]
  |  |  |  Branch (60:23): [True: 845, False: 0]
  |  |  ------------------
  |  |   61|    845|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  736|       |
  737|    845|    TRACE_((THIS_FILE, "Started parsing multipart body"));
  738|       |
  739|       |    /* Get the boundary value in the ctype */
  740|    845|    boundary.ptr = NULL;
  741|    845|    boundary.slen = 0;
  742|    845|    ctype_param = pjsip_param_find(&ctype->param, &STR_BOUNDARY);
  743|    845|    if (ctype_param) {
  ------------------
  |  Branch (743:9): [True: 30, False: 815]
  ------------------
  744|     30|        boundary = ctype_param->value;
  745|     30|        if (boundary.slen>2 && *boundary.ptr=='"') {
  ------------------
  |  Branch (745:13): [True: 26, False: 4]
  |  Branch (745:32): [True: 4, False: 22]
  ------------------
  746|       |            /* Remove quote */
  747|      4|            boundary.ptr++;
  748|      4|            boundary.slen -= 2;
  749|      4|        }
  750|     30|        TRACE_((THIS_FILE, "Boundary is specified: '%.*s'", (int)boundary.slen,
  751|     30|                boundary.ptr));
  752|     30|    }
  753|       |
  754|    845|    if (!boundary.slen) {
  ------------------
  |  Branch (754:9): [True: 817, False: 28]
  ------------------
  755|       |        /* Boundary not found or not specified. Try to be clever, get
  756|       |         * the boundary from the body.
  757|       |         */
  758|    817|        char *p=buf, *end=buf+len;
  759|       |
  760|    817|        PJ_LOG(4,(THIS_FILE, "Warning: boundary parameter not found or "
  ------------------
  |  |  106|    817|#define PJ_LOG(level,arg)       do { \
  |  |  107|    817|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 817]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|    817|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  761|    817|                             "not specified when parsing multipart body"));
  762|       |
  763|       |        /* Find the first "--". This "--" must be right after a CRLF, unless
  764|       |         * it really appears at the start of the buffer.
  765|       |         */
  766|  1.61k|        for (;;) {
  767|  3.08k|            while (p!=end && *p!='-') ++p;
  ------------------
  |  Branch (767:20): [True: 3.03k, False: 47]
  |  Branch (767:30): [True: 1.46k, False: 1.57k]
  ------------------
  768|       |
  769|  1.61k|            if (p == end)
  ------------------
  |  Branch (769:17): [True: 47, False: 1.57k]
  ------------------
  770|     47|                break;
  771|       |
  772|  1.57k|            if ((p+1<end) && *(p+1)=='-' &&
  ------------------
  |  Branch (772:17): [True: 1.55k, False: 14]
  |  Branch (772:30): [True: 1.27k, False: 281]
  ------------------
  773|  1.57k|                ((p>buf && *(p-1)=='\n') || (p==buf)))
  ------------------
  |  Branch (773:19): [True: 560, False: 716]
  |  Branch (773:28): [True: 54, False: 506]
  |  Branch (773:45): [True: 716, False: 506]
  ------------------
  774|    770|            {
  775|    770|                p+=2;
  776|    770|                break;
  777|    801|            } else {
  778|    801|                ++p;
  779|    801|            }
  780|  1.57k|        }
  781|       |
  782|    817|        if (p==end) {
  ------------------
  |  Branch (782:13): [True: 49, False: 768]
  ------------------
  783|       |            /* Unable to determine boundary. Maybe this is not a multipart
  784|       |             * message?
  785|       |             */
  786|     49|            PJ_LOG(4,(THIS_FILE, "Error: multipart boundary not specified and"
  ------------------
  |  |  106|     49|#define PJ_LOG(level,arg)       do { \
  |  |  107|     49|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 49]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|     49|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  787|     49|                                 " unable to calculate from the body"));
  788|     49|            return NULL;
  789|     49|        }
  790|       |
  791|    768|        boundary.ptr = p;
  792|  33.4k|        while (p!=end && !pj_isspace(*p)) ++p;
  ------------------
  |  Branch (792:16): [True: 33.3k, False: 66]
  |  Branch (792:26): [True: 32.6k, False: 702]
  ------------------
  793|    768|        boundary.slen = p - boundary.ptr;
  794|       |
  795|    768|        TRACE_((THIS_FILE, "Boundary is calculated: '%.*s'",
  796|    768|                (int)boundary.slen, boundary.ptr));
  797|    768|    }
  798|       |
  799|       |
  800|       |    /* Build the delimiter:
  801|       |     *   delimiter = "--" boundary
  802|       |     */
  803|    796|    delim.slen = boundary.slen+2;
  804|    796|    delim.ptr = (char*)pj_pool_alloc(pool, (int)delim.slen);
  805|    796|    delim.ptr[0] = '-';
  806|    796|    delim.ptr[1] = '-';
  807|    796|    pj_memcpy(delim.ptr+2, boundary.ptr, boundary.slen);
  808|       |
  809|       |    /* Start parsing the body, skip until the first delimiter. */
  810|    796|    curptr = buf;
  811|    796|    endptr = buf + len;
  812|    796|    {
  813|    796|        pj_str_t strbody;
  814|       |
  815|    796|        strbody.ptr = buf; strbody.slen = len;
  816|    796|        curptr = pj_strstr(&strbody, &delim);
  817|    796|        if (!curptr)
  ------------------
  |  Branch (817:13): [True: 28, False: 768]
  ------------------
  818|     28|            return NULL;
  819|    796|    }
  820|       |
  821|    768|    body = pjsip_multipart_create(pool, ctype, &boundary);
  822|       |
  823|       |    /* Save full raw body */
  824|    768|    {
  825|    768|        struct multipart_data *mp = (struct multipart_data*)body->data;
  826|    768|        pj_strset(&mp->raw_data, buf, len);
  827|    768|    }
  828|       |
  829|  8.98k|    for (;;) {
  830|  8.98k|        char *start_body, *end_body;
  831|  8.98k|        pjsip_multipart_part *part;
  832|       |
  833|       |        /* Eat the boundary */
  834|  8.98k|        curptr += delim.slen;
  835|  8.98k|        if (*curptr=='-' && curptr<endptr-1 && *(curptr+1)=='-') {
  ------------------
  |  Branch (835:13): [True: 13, False: 8.97k]
  |  Branch (835:29): [True: 12, False: 1]
  |  Branch (835:48): [True: 1, False: 11]
  ------------------
  836|       |            /* Found the closing delimiter */
  837|      1|            curptr += 2;
  838|      1|            break;
  839|      1|        }
  840|       |        /* Optional whitespace after delimiter */
  841|  9.38k|        while (curptr!=endptr && IS_SPACE(*curptr)) ++curptr;
  ------------------
  |  |   33|  8.80k|#define IS_SPACE(c)     ((c)==' ' || (c)=='\t')
  |  |  ------------------
  |  |  |  Branch (33:26): [True: 201, False: 8.60k]
  |  |  |  Branch (33:38): [True: 194, False: 8.41k]
  |  |  ------------------
  ------------------
  |  Branch (841:16): [True: 8.80k, False: 572]
  ------------------
  842|       |        /* Mandatory CRLF */
  843|  8.98k|        if (*curptr=='\r') ++curptr;
  ------------------
  |  Branch (843:13): [True: 294, False: 8.69k]
  ------------------
  844|  8.98k|        if (*curptr!='\n') {
  ------------------
  |  Branch (844:13): [True: 641, False: 8.34k]
  ------------------
  845|       |            /* Expecting a newline here */
  846|    641|            PJ_LOG(2, (THIS_FILE, "Failed to find newline"));
  ------------------
  |  |  106|    641|#define PJ_LOG(level,arg)       do { \
  |  |  107|    641|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 641]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|    641|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  847|       |
  848|    641|            return NULL;
  849|    641|        }
  850|  8.34k|        ++curptr;
  851|       |
  852|       |        /* We now in the start of the body */
  853|  8.34k|        start_body = curptr;
  854|       |
  855|       |        /* Find the next delimiter */
  856|  8.34k|        {
  857|  8.34k|            pj_str_t subbody;
  858|       |
  859|  8.34k|            subbody.ptr = curptr; subbody.slen = endptr - curptr;
  860|  8.34k|            curptr = pj_strstr(&subbody, &delim);
  861|  8.34k|            if (!curptr) {
  ------------------
  |  Branch (861:17): [True: 126, False: 8.21k]
  ------------------
  862|       |                /* We're really expecting end delimiter to be found. */
  863|    126|                PJ_LOG(2, (THIS_FILE, "Failed to find end-delimiter"));
  ------------------
  |  |  106|    126|#define PJ_LOG(level,arg)       do { \
  |  |  107|    126|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 126]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|    126|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  864|    126|                return NULL;
  865|    126|            }
  866|  8.34k|        }
  867|       |
  868|  8.21k|        end_body = curptr;
  869|       |
  870|       |        /* Note that when body is empty, end_body will be equal
  871|       |         * to start_body.
  872|       |         */
  873|  8.21k|        if (end_body > start_body) {
  ------------------
  |  Branch (873:13): [True: 5.14k, False: 3.07k]
  ------------------
  874|       |            /* The newline preceeding the delimiter is conceptually part of
  875|       |             * the delimiter, so trim it from the body.
  876|       |             */
  877|  5.14k|            if (*(end_body-1) == '\n')
  ------------------
  |  Branch (877:17): [True: 3.56k, False: 1.57k]
  ------------------
  878|  3.56k|                --end_body;
  879|  5.14k|            if (end_body > start_body && *(end_body-1) == '\r')
  ------------------
  |  Branch (879:17): [True: 4.93k, False: 208]
  |  Branch (879:42): [True: 201, False: 4.73k]
  ------------------
  880|    201|                --end_body;
  881|  5.14k|        }
  882|       |
  883|       |        /* Now that we have determined the part's boundary, parse it
  884|       |         * to get the header and body part of the part.
  885|       |         */
  886|  8.21k|        part = parse_multipart_part(pool, start_body, end_body - start_body,
  887|  8.21k|                                    ctype);
  888|  8.21k|        if (part) {
  ------------------
  |  Branch (888:13): [True: 8.21k, False: 0]
  ------------------
  889|  8.21k|            TRACE_((THIS_FILE, "Adding part"));
  890|  8.21k|            pjsip_multipart_add_part(pool, body, part);
  891|  8.21k|        } else {
  892|      0|            PJ_LOG(2, (THIS_FILE, "Failed to add part"));
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  893|      0|        }
  894|  8.21k|    }
  895|      1|    TRACE_((THIS_FILE, "pjsip_multipart_parse finished: %p", body));
  896|       |
  897|      1|    return body;
  898|    768|}
sip_multipart.c:parse_multipart_part:
  636|  8.21k|{
  637|  8.21k|    pjsip_multipart_part *part = pjsip_multipart_create_part(pool);
  638|  8.21k|    char *p = start, *end = start+len, *end_hdr = NULL, *start_body = NULL;
  639|  8.21k|    pjsip_ctype_hdr *ctype_hdr = NULL;
  640|       |
  641|  8.21k|    TRACE_((THIS_FILE, "Parsing part: begin--\n%.*s\n--end",
  642|  8.21k|            (int)len, start));
  643|       |
  644|       |    /* Find the end of header area, by looking at an empty line */
  645|  23.1k|    for (;;) {
  646|   112k|        while (p!=end && *p!='\n') ++p;
  ------------------
  |  Branch (646:16): [True: 105k, False: 7.23k]
  |  Branch (646:26): [True: 89.4k, False: 15.9k]
  ------------------
  647|  23.1k|        if (p==end) {
  ------------------
  |  Branch (647:13): [True: 7.23k, False: 15.9k]
  ------------------
  648|  7.23k|            start_body = end;
  649|  7.23k|            break;
  650|  7.23k|        }
  651|  15.9k|        if ((p==start) || (p==start+1 && *(p-1)=='\r')) {
  ------------------
  |  Branch (651:13): [True: 200, False: 15.7k]
  |  Branch (651:28): [True: 1.77k, False: 13.9k]
  |  Branch (651:42): [True: 196, False: 1.57k]
  ------------------
  652|       |            /* Empty header section */
  653|    396|            end_hdr = start;
  654|    396|            start_body = ++p;
  655|    396|            break;
  656|  15.5k|        } else if (p==end-1) {
  ------------------
  |  Branch (656:20): [True: 3.16k, False: 12.3k]
  ------------------
  657|       |            /* Empty body section */
  658|  3.16k|            end_hdr = end;
  659|  3.16k|            start_body = ++p;
  660|  12.3k|        } else if ((p>=start+1 && *(p-1)=='\n') ||
  ------------------
  |  Branch (660:21): [True: 12.3k, False: 0]
  |  Branch (660:35): [True: 390, False: 11.9k]
  ------------------
  661|  12.3k|                   (p>=start+2 && *(p-1)=='\r' && *(p-2)=='\n'))
  ------------------
  |  Branch (661:21): [True: 10.8k, False: 1.08k]
  |  Branch (661:35): [True: 635, False: 10.2k]
  |  Branch (661:51): [True: 194, False: 441]
  ------------------
  662|    584|        {
  663|       |            /* Found it */
  664|    584|            end_hdr = (*(p-1)=='\r') ? (p-1) : p;
  ------------------
  |  Branch (664:23): [True: 194, False: 390]
  ------------------
  665|    584|            start_body = ++p;
  666|    584|            break;
  667|  11.7k|        } else {
  668|  11.7k|            ++p;
  669|  11.7k|        }
  670|  15.9k|    }
  671|       |
  672|       |    /* Parse the headers */
  673|  8.21k|    if (end_hdr-start > 0) {
  ------------------
  |  Branch (673:9): [True: 3.75k, False: 4.46k]
  ------------------
  674|  3.75k|        pjsip_hdr *hdr;
  675|  3.75k|        pj_status_t status;
  676|       |
  677|  3.75k|        status = pjsip_parse_headers(pool, start, end_hdr-start, 
  678|  3.75k|                                     &part->hdr, 0);
  679|  3.75k|        if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (679:13): [True: 0, False: 3.75k]
  ------------------
  680|      0|            PJ_PERROR(2,(THIS_FILE, status, "Warning: error parsing multipart"
  ------------------
  |  |  175|      0|#define PJ_PERROR(level,arg)    do { \
  |  |  176|      0|                                    pj_perror_wrapper_##level(arg); \
  |  |  177|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (177:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  681|      0|                                            " header"));
  682|      0|        }
  683|       |
  684|       |        /* Find Content-Type header */
  685|  3.75k|        hdr = part->hdr.next;
  686|  10.5k|        while (hdr != &part->hdr) {
  ------------------
  |  Branch (686:16): [True: 6.80k, False: 3.75k]
  ------------------
  687|  6.80k|            TRACE_((THIS_FILE, "Header parsed: %.*s", (int)hdr->name.slen,
  688|  6.80k|                    hdr->name.ptr));
  689|  6.80k|            if (hdr->type == PJSIP_H_CONTENT_TYPE) {
  ------------------
  |  Branch (689:17): [True: 772, False: 6.03k]
  ------------------
  690|    772|                ctype_hdr = (pjsip_ctype_hdr*)hdr;
  691|    772|            }
  692|  6.80k|            hdr = hdr->next;
  693|  6.80k|        }
  694|  3.75k|    }
  695|       |
  696|       |    /* Assign the body */
  697|  8.21k|    part->body = PJ_POOL_ZALLOC_T(pool, pjsip_msg_body);
  ------------------
  |  |  520|  8.21k|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  698|  8.21k|    if (ctype_hdr) {
  ------------------
  |  Branch (698:9): [True: 582, False: 7.63k]
  ------------------
  699|    582|        pjsip_media_type_cp(pool, &part->body->content_type, &ctype_hdr->media);
  700|  7.63k|    } else if (pct && pj_stricmp2(&pct->subtype, "digest")==0) {
  ------------------
  |  Branch (700:16): [True: 7.63k, False: 0]
  |  Branch (700:23): [True: 194, False: 7.44k]
  ------------------
  701|    194|        part->body->content_type.type = pj_str("message");
  702|    194|        part->body->content_type.subtype = pj_str("rfc822");
  703|  7.44k|    } else {
  704|  7.44k|        part->body->content_type.type = pj_str("text");
  705|  7.44k|        part->body->content_type.subtype = pj_str("plain");
  706|  7.44k|    }
  707|       |
  708|  8.21k|    if (start_body < end) {
  ------------------
  |  Branch (708:9): [True: 887, False: 7.33k]
  ------------------
  709|    887|        part->body->data = start_body;
  710|    887|        part->body->len = (unsigned)(end - start_body);
  711|  7.33k|    } else {
  712|  7.33k|        part->body->data = (void*)"";
  713|  7.33k|        part->body->len = 0;
  714|  7.33k|    }
  715|  8.21k|    TRACE_((THIS_FILE, "Body parsed: \"%.*s\"", (int)part->body->len,
  716|  8.21k|            part->body->data));
  717|  8.21k|    part->body->print_body = &pjsip_print_text_body;
  718|  8.21k|    part->body->clone_data = &pjsip_clone_text_data;
  719|       |
  720|  8.21k|    return part;
  721|  8.21k|}

pjsip_parser_const:
  290|  8.03k|{
  291|  8.03k|    return &pconst;
  292|  8.03k|}
init_sip_parser:
  549|  4.82k|{
  550|  4.82k|    pj_enter_critical_section();
  551|  4.82k|    if (++parser_is_initialized == 1) {
  ------------------
  |  Branch (551:9): [True: 4.82k, False: 0]
  ------------------
  552|  4.82k|        init_parser();
  553|  4.82k|    }
  554|  4.82k|    pj_leave_critical_section();
  555|  4.82k|}
deinit_sip_parser:
  558|  4.82k|{
  559|  4.82k|    pj_enter_critical_section();
  560|  4.82k|    if (--parser_is_initialized == 0) {
  ------------------
  |  Branch (560:9): [True: 4.82k, False: 0]
  ------------------
  561|       |        /* Clear header handlers */
  562|  4.82k|        pj_bzero(handler, sizeof(handler));
  563|  4.82k|        handler_count = 0;
  564|       |
  565|       |        /* Clear URI handlers */
  566|  4.82k|        pj_bzero(uri_handler, sizeof(uri_handler));
  567|  4.82k|        uri_handler_count = 0;
  568|       |
  569|       |        /* Deregister exception ID */
  570|  4.82k|        pj_exception_id_free(PJSIP_SYN_ERR_EXCEPTION);
  571|  4.82k|        PJSIP_SYN_ERR_EXCEPTION = -1;
  572|       |
  573|  4.82k|        pj_exception_id_free(PJSIP_EINVAL_ERR_EXCEPTION);
  574|  4.82k|        PJSIP_EINVAL_ERR_EXCEPTION = -2;
  575|  4.82k|    }
  576|  4.82k|    pj_leave_critical_section();
  577|  4.82k|}
pjsip_register_hdr_parser:
  665|   110k|{
  666|   110k|    unsigned i;
  667|   110k|    pj_size_t len;
  668|   110k|    char hname_lcase[PJSIP_MAX_HNAME_LEN+1];
  669|   110k|    pj_status_t status;
  670|       |
  671|       |    /* Check that name is not too long */
  672|   110k|    len = pj_ansi_strlen(hname);
  ------------------
  |  |   69|   110k|#define pj_ansi_strlen          strlen
  ------------------
  673|   110k|    if (len > PJSIP_MAX_HNAME_LEN) {
  ------------------
  |  | 1131|   110k|#define PJSIP_MAX_HNAME_LEN             64
  ------------------
  |  Branch (673:9): [True: 0, False: 110k]
  ------------------
  674|      0|        pj_assert(!"Header name is too long!");
  ------------------
  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  ------------------
  675|      0|        return PJ_ENAMETOOLONG;
  ------------------
  |  |  338|      0|#define PJ_ENAMETOOLONG     (PJ_ERRNO_START_STATUS + 5) /* 70005 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  676|      0|    }
  677|       |
  678|       |    /* Register the normal Mixed-Case name */
  679|   110k|    status = int_register_parser(hname, fptr);
  680|   110k|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (680:9): [True: 0, False: 110k]
  ------------------
  681|      0|        return status;
  682|      0|    }
  683|       |
  684|       |    /* Get the lower-case name */
  685|  1.14M|    for (i=0; i<len; ++i) {
  ------------------
  |  Branch (685:15): [True: 1.03M, False: 110k]
  ------------------
  686|  1.03M|        hname_lcase[i] = (char)pj_tolower(hname[i]);
  687|  1.03M|    }
  688|   110k|    hname_lcase[len] = '\0';
  689|       |
  690|       |    /* Register the lower-case version of the name */
  691|   110k|    status = int_register_parser(hname_lcase, fptr);
  692|   110k|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (692:9): [True: 0, False: 110k]
  ------------------
  693|      0|        return status;
  694|      0|    }
  695|       |    
  696|       |
  697|       |    /* Register the shortname version of the name */
  698|   110k|    if (hshortname) {
  ------------------
  |  Branch (698:9): [True: 38.5k, False: 72.3k]
  ------------------
  699|  38.5k|        status = int_register_parser(hshortname, fptr);
  700|  38.5k|        if (status != PJ_SUCCESS) 
  ------------------
  |  Branch (700:13): [True: 0, False: 38.5k]
  ------------------
  701|      0|            return status;
  702|  38.5k|    }
  703|   110k|    return PJ_SUCCESS;
  704|   110k|}
pjsip_register_uri_parser:
  783|  14.4k|{
  784|  14.4k|    if (uri_handler_count >= PJ_ARRAY_SIZE(uri_handler))
  ------------------
  |  |  294|  14.4k|#define PJ_ARRAY_SIZE(a)    (sizeof(a)/sizeof(a[0]))
  ------------------
  |  Branch (784:9): [True: 0, False: 14.4k]
  ------------------
  785|      0|        return PJ_ETOOMANY;
  ------------------
  |  |  363|      0|#define PJ_ETOOMANY         (PJ_ERRNO_START_STATUS + 10)/* 70010 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  786|       |
  787|  14.4k|    uri_handler[uri_handler_count].scheme = pj_str((char*)scheme);
  788|  14.4k|    uri_handler[uri_handler_count].parse = func;
  789|  14.4k|    ++uri_handler_count;
  790|       |
  791|  14.4k|    return PJ_SUCCESS;
  792|  14.4k|}
pjsip_parse_msg:
  798|  4.82k|{
  799|  4.82k|    pjsip_msg *msg = NULL;
  800|  4.82k|    pj_scanner scanner;
  801|  4.82k|    pjsip_parse_ctx context;
  802|       |
  803|  4.82k|    pj_scan_init(&scanner, buf, size, PJ_SCAN_AUTOSKIP_WS_HEADER, 
  804|  4.82k|                 &on_syntax_error);
  805|       |
  806|  4.82k|    context.scanner = &scanner;
  807|  4.82k|    context.pool = pool;
  808|  4.82k|    context.rdata = NULL;
  809|       |
  810|  4.82k|    msg = int_parse_msg(&context, err_list);
  811|       |
  812|  4.82k|    pj_scan_fini(&scanner);
  813|  4.82k|    return msg;
  814|  4.82k|}
pjsip_parse_param_imp:
 1268|  13.3k|{
 1269|  13.3k|    parse_param_imp(scanner, pool, pname, pvalue, &pconst.pjsip_TOKEN_SPEC,
 1270|       |                    // Token does not need to be unescaped.
 1271|       |                    // Refer to PR #2933.
 1272|       |                    // &pconst.pjsip_TOKEN_SPEC_ESC,
 1273|  13.3k|                    NULL, option);
 1274|  13.3k|}
pjsip_parse_uri_param_imp:
 1281|  6.85k|{
 1282|  6.85k|    parse_param_imp(scanner,pool, pname, pvalue, &pconst.pjsip_PARAM_CHAR_SPEC,
 1283|  6.85k|                    &pconst.pjsip_PARAM_CHAR_SPEC_ESC, option);
 1284|  6.85k|}
pjsip_parse_headers:
 2427|  3.75k|{
 2428|  3.75k|    enum { STOP_ON_ERROR = 1 };
 2429|  3.75k|    pj_str_t hname = {0, 0};
 2430|  3.75k|    pj_scanner scanner;
 2431|  3.75k|    pjsip_parse_ctx ctx;
 2432|       |
 2433|  3.75k|    PJ_USE_EXCEPTION;
  ------------------
  |  |  367|  3.75k|#define PJ_USE_EXCEPTION    struct pj_exception_state_t pj_x_except__; int pj_x_code__
  ------------------
 2434|       |
 2435|  3.75k|    pj_scan_init(&scanner, input, size, PJ_SCAN_AUTOSKIP_WS_HEADER,
 2436|  3.75k|                 &on_syntax_error);
 2437|       |
 2438|  3.75k|    pj_bzero(&ctx, sizeof(ctx));
 2439|  3.75k|    ctx.scanner = &scanner;
 2440|  3.75k|    ctx.pool = pool;
 2441|       |
 2442|  6.72k|retry_parse:
 2443|  6.72k|    PJ_TRY
  ------------------
  |  |  373|  6.72k|#define PJ_TRY              if (1) { \
  |  |  ------------------
  |  |  |  Branch (373:33): [Folded - Ignored]
  |  |  ------------------
  |  |  374|  6.72k|                                pj_push_exception_handler_(&pj_x_except__); \
  |  |  375|  6.72k|                                pj_x_code__ = pj_setjmp(pj_x_except__.state); \
  |  |  ------------------
  |  |  |  |   31|  6.72k|#    define pj_setjmp(buf)      setjmp(buf)
  |  |  ------------------
  |  |  376|  6.72k|                                if (pj_x_code__ == 0)
  |  |  ------------------
  |  |  |  Branch (376:37): [True: 6.72k, False: 0]
  |  |  ------------------
  ------------------
 2444|  6.72k|    {
 2445|       |        /* Parse headers. */
 2446|  11.9k|        do {
 2447|  11.9k|            pjsip_parse_hdr_func * func;
 2448|  11.9k|            pjsip_hdr *hdr = NULL;
 2449|       |
 2450|       |            /* Init hname just in case parsing fails.
 2451|       |             * Ref: PROTOS #2412
 2452|       |             */
 2453|  11.9k|            hname.slen = 0;
 2454|       |
 2455|       |            /* Get hname. */            
 2456|  11.9k|            pj_scan_get( &scanner, &pconst.pjsip_TOKEN_SPEC, &hname);
 2457|  11.9k|            if (pj_scan_get_char( &scanner ) != ':') {
  ------------------
  |  Branch (2457:17): [True: 1.12k, False: 10.8k]
  ------------------
 2458|  1.12k|                PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|  1.12k|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
 2459|  1.12k|            }
 2460|       |
 2461|       |            /* Find handler. */
 2462|  10.8k|            func = find_handler(&hname);
 2463|       |
 2464|       |            /* Call the handler if found.
 2465|       |             * If no handler is found, then treat the header as generic
 2466|       |             * hname/hvalue pair.
 2467|       |             */
 2468|  10.8k|            if (func) {
  ------------------
  |  Branch (2468:17): [True: 7.46k, False: 3.36k]
  ------------------
 2469|  7.46k|                hdr = (*func)(&ctx);
 2470|  7.46k|            } else {
 2471|  3.36k|                hdr = parse_hdr_generic_string(&ctx);
 2472|  3.36k|                hdr->name = hdr->sname = hname;
 2473|  3.36k|            }
 2474|       |
 2475|       |            /* Single parse of header line can produce multiple headers.
 2476|       |             * For example, if one Contact: header contains Contact list
 2477|       |             * separated by comma, then these Contacts will be split into
 2478|       |             * different Contact headers.
 2479|       |             * So here we must insert list instead of just insert one header.
 2480|       |             */
 2481|  10.8k|            if (hdr)
  ------------------
  |  Branch (2481:17): [True: 6.43k, False: 4.38k]
  ------------------
 2482|  6.43k|                pj_list_insert_nodes_before(hlist, hdr);
 2483|       |
 2484|       |            /* Parse until EOF or an empty line is found. */
 2485|  10.8k|        } while (!pj_scan_is_eof(&scanner) && !IS_NEWLINE(*scanner.curptr));
  ------------------
  |  |   62|  5.62k|#define IS_NEWLINE(c)   ((c)=='\r' || (c)=='\n')
  |  |  ------------------
  |  |  |  Branch (62:26): [True: 194, False: 5.43k]
  |  |  |  Branch (62:39): [True: 211, False: 5.22k]
  |  |  ------------------
  ------------------
  |  Branch (2485:18): [True: 5.62k, False: 5.19k]
  ------------------
 2486|       |
 2487|       |        /* If empty line is found, eat it. */
 2488|  5.60k|        if (!pj_scan_is_eof(&scanner)) {
  ------------------
  |  Branch (2488:13): [True: 405, False: 5.19k]
  ------------------
 2489|    405|            if (IS_NEWLINE(*scanner.curptr)) {
  ------------------
  |  |   62|    405|#define IS_NEWLINE(c)   ((c)=='\r' || (c)=='\n')
  |  |  ------------------
  |  |  |  Branch (62:26): [True: 194, False: 211]
  |  |  |  Branch (62:39): [True: 211, False: 0]
  |  |  ------------------
  ------------------
 2490|    405|                pj_scan_get_newline(&scanner);
 2491|    405|            }
 2492|    405|        }
 2493|  5.60k|    }
 2494|      0|    PJ_CATCH_ANY
 2495|      0|    {
 2496|      0|        PJ_LOG(4,(THIS_FILE, "Error parsing header: '%.*s' line %d col %d",
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2497|      0|                  (int)hname.slen, hname.ptr, scanner.line,
 2498|      0|                  pj_scan_get_col(&scanner)));
 2499|       |
 2500|       |        /* Exception was thrown during parsing. */
 2501|      0|        if ((options & STOP_ON_ERROR) == STOP_ON_ERROR) {
  ------------------
  |  Branch (2501:13): [True: 0, False: 0]
  ------------------
 2502|      0|            pj_scan_fini(&scanner);
 2503|      0|            return PJSIP_EINVALIDHDR;
  ------------------
  |  |  175|      0|#define PJSIP_EINVALIDHDR       (PJSIP_ERRNO_START_PJSIP + 51)  /* 171051 */
  |  |  ------------------
  |  |  |  |   73|      0|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  470|      0|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  463|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2504|      0|        }
 2505|       |
 2506|       |        /* Skip until newline, and parse next header. */
 2507|  4.20k|        if (!pj_scan_is_eof(&scanner)) {
  ------------------
  |  Branch (2507:13): [True: 4.20k, False: 18.4E]
  ------------------
 2508|       |            /* Skip until next line.
 2509|       |             * Watch for header continuation.
 2510|       |             */
 2511|  4.40k|            do {
 2512|  4.40k|                pj_scan_skip_line(&scanner);
 2513|  4.40k|            } while (IS_SPACE(*scanner.curptr));
  ------------------
  |  |   63|  4.40k|#define IS_SPACE(c)     ((c)==' ' || (c)=='\t')
  |  |  ------------------
  |  |  |  Branch (63:26): [True: 199, False: 4.20k]
  |  |  |  Branch (63:38): [True: 0, False: 4.20k]
  |  |  ------------------
  ------------------
 2514|  4.20k|        }
 2515|       |
 2516|       |        /* Restore flag. Flag may be set in int_parse_sip_url() */
 2517|      0|        scanner.skip_ws = PJ_SCAN_AUTOSKIP_WS_HEADER;
 2518|       |
 2519|       |        /* Continue parse next header, if any. */
 2520|  3.37k|        if (!pj_scan_is_eof(&scanner) && !IS_NEWLINE(*scanner.curptr)) {
  ------------------
  |  |   62|  3.37k|#define IS_NEWLINE(c)   ((c)=='\r' || (c)=='\n')
  |  |  ------------------
  |  |  |  Branch (62:26): [True: 194, False: 3.18k]
  |  |  |  Branch (62:39): [True: 207, False: 2.97k]
  |  |  ------------------
  ------------------
  |  Branch (2520:13): [True: 3.37k, False: 18.4E]
  ------------------
 2521|  2.97k|            goto retry_parse;
 2522|  2.97k|        }
 2523|       |
 2524|      0|    }
 2525|  2.62k|    PJ_END;
  ------------------
  |  |  394|  2.62k|#define PJ_END                  pj_pop_exception_handler_(&pj_x_except__); \
  |  |  395|  2.62k|                            } else {}
  ------------------
 2526|       |
 2527|  2.62k|    return PJ_SUCCESS;
 2528|  6.72k|}
sip_parser.c:init_parser:
  329|  4.82k|{
  330|  4.82k|    pj_status_t status;
  331|       |
  332|       |    /*
  333|       |     * Syntax error exception number.
  334|       |     */
  335|  4.82k|    pj_assert (PJSIP_SYN_ERR_EXCEPTION == -1);
  ------------------
  |  |   48|  4.82k|#   define pj_assert(expr)   assert(expr)
  ------------------
  336|  4.82k|    status = pj_exception_id_alloc("PJSIP syntax error", 
  337|  4.82k|                                   &PJSIP_SYN_ERR_EXCEPTION);
  338|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  339|       |
  340|       |    /*
  341|       |     * Invalid value exception.
  342|       |     */
  343|  4.82k|    pj_assert (PJSIP_EINVAL_ERR_EXCEPTION == -2);
  ------------------
  |  |   48|  4.82k|#   define pj_assert(expr)   assert(expr)
  ------------------
  344|  4.82k|    status = pj_exception_id_alloc("PJSIP invalid value error", 
  345|  4.82k|                                   &PJSIP_EINVAL_ERR_EXCEPTION);
  346|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  347|       |
  348|       |    /*
  349|       |     * Init character input spec (cis)
  350|       |     */
  351|       |
  352|  4.82k|    pj_cis_buf_init(&cis_buf);
  353|       |
  354|  4.82k|    status = pj_cis_init(&cis_buf, &pconst.pjsip_DIGIT_SPEC);
  355|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  356|  4.82k|    pj_cis_add_num(&pconst.pjsip_DIGIT_SPEC);
  357|       |    
  358|  4.82k|    status = pj_cis_init(&cis_buf, &pconst.pjsip_ALPHA_SPEC);
  359|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  360|  4.82k|    pj_cis_add_alpha( &pconst.pjsip_ALPHA_SPEC );
  361|       |    
  362|  4.82k|    status = pj_cis_init(&cis_buf, &pconst.pjsip_ALNUM_SPEC);
  363|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  364|  4.82k|    pj_cis_add_alpha( &pconst.pjsip_ALNUM_SPEC );
  365|  4.82k|    pj_cis_add_num( &pconst.pjsip_ALNUM_SPEC );
  366|       |
  367|  4.82k|    status = pj_cis_init(&cis_buf, &pconst.pjsip_NOT_NEWLINE);
  368|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  369|  4.82k|    pj_cis_add_str(&pconst.pjsip_NOT_NEWLINE, "\r\n");
  370|  4.82k|    pj_cis_invert(&pconst.pjsip_NOT_NEWLINE);
  371|       |
  372|  4.82k|    status = pj_cis_init(&cis_buf, &pconst.pjsip_NOT_COMMA_OR_NEWLINE);
  373|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  374|  4.82k|    pj_cis_add_str( &pconst.pjsip_NOT_COMMA_OR_NEWLINE, ",\r\n");
  375|  4.82k|    pj_cis_invert(&pconst.pjsip_NOT_COMMA_OR_NEWLINE);
  376|       |
  377|  4.82k|    status = pj_cis_dup(&pconst.pjsip_TOKEN_SPEC, &pconst.pjsip_ALNUM_SPEC);
  378|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  379|  4.82k|    pj_cis_add_str( &pconst.pjsip_TOKEN_SPEC, TOKEN);
  ------------------
  |  |   47|  4.82k|#define TOKEN               "-.!%*_`'~+"   /* '=' was removed for parsing 
  ------------------
  380|       |
  381|       |    /* Token is allowed to have '%' so we do not need this. */
  382|       |    /*
  383|       |    status = pj_cis_dup(&pconst.pjsip_TOKEN_SPEC_ESC, &pconst.pjsip_TOKEN_SPEC);
  384|       |    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  385|       |    pj_cis_del_str(&pconst.pjsip_TOKEN_SPEC_ESC, "%");
  386|       |    */
  387|       |
  388|  4.82k|    status = pj_cis_dup(&pconst.pjsip_VIA_PARAM_SPEC, &pconst.pjsip_TOKEN_SPEC);
  389|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  390|  4.82k|    pj_cis_add_str(&pconst.pjsip_VIA_PARAM_SPEC, "[:]");
  391|       |
  392|       |    /* Token is allowed to have '%' */
  393|       |    /*
  394|       |    status = pj_cis_dup(&pconst.pjsip_VIA_PARAM_SPEC_ESC, &pconst.pjsip_TOKEN_SPEC_ESC);
  395|       |    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  396|       |    pj_cis_add_str(&pconst.pjsip_VIA_PARAM_SPEC_ESC, "[:]");
  397|       |    */
  398|       |
  399|  4.82k|    status = pj_cis_dup(&pconst.pjsip_HOST_SPEC, &pconst.pjsip_ALNUM_SPEC);
  400|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  401|  4.82k|    pj_cis_add_str( &pconst.pjsip_HOST_SPEC, HOST);
  ------------------
  |  |   49|  4.82k|#define HOST                "_-."
  ------------------
  402|       |
  403|  4.82k|    status = pj_cis_dup(&pconst.pjsip_HEX_SPEC, &pconst.pjsip_DIGIT_SPEC);
  404|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  405|  4.82k|    pj_cis_add_str( &pconst.pjsip_HEX_SPEC, HEX_DIGIT);
  ------------------
  |  |   50|  4.82k|#define HEX_DIGIT           "abcdefABCDEF"
  ------------------
  406|       |
  407|  4.82k|    status = pj_cis_dup(&pconst.pjsip_PARAM_CHAR_SPEC, &pconst.pjsip_ALNUM_SPEC);
  408|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  409|  4.82k|    pj_cis_add_str(&pconst.pjsip_PARAM_CHAR_SPEC, PARAM_CHAR);
  ------------------
  |  |   51|  4.82k|#define PARAM_CHAR          "[]/:&+$" UNRESERVED ESCAPED
  |  |  ------------------
  |  |  |  |   44|  4.82k|#define ESCAPED             "%"
  |  |  ------------------
  ------------------
  410|       |
  411|  4.82k|    status = pj_cis_dup(&pconst.pjsip_PARAM_CHAR_SPEC_ESC, &pconst.pjsip_PARAM_CHAR_SPEC);
  412|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  413|  4.82k|    pj_cis_del_str(&pconst.pjsip_PARAM_CHAR_SPEC_ESC, ESCAPED);
  ------------------
  |  |   44|  4.82k|#define ESCAPED             "%"
  ------------------
  414|       |
  415|  4.82k|    status = pj_cis_dup(&pconst.pjsip_HDR_CHAR_SPEC, &pconst.pjsip_ALNUM_SPEC);
  416|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  417|  4.82k|    pj_cis_add_str(&pconst.pjsip_HDR_CHAR_SPEC, HDR_CHAR);
  ------------------
  |  |   53|  4.82k|#define HDR_CHAR            HNV_UNRESERVED UNRESERVED ESCAPED
  |  |  ------------------
  |  |  |  |   52|  4.82k|#define HNV_UNRESERVED      "[]/?:+$"
  |  |  ------------------
  |  |               #define HDR_CHAR            HNV_UNRESERVED UNRESERVED ESCAPED
  |  |  ------------------
  |  |  |  |   44|  4.82k|#define ESCAPED             "%"
  |  |  ------------------
  ------------------
  418|       |
  419|  4.82k|    status = pj_cis_dup(&pconst.pjsip_HDR_CHAR_SPEC_ESC, &pconst.pjsip_HDR_CHAR_SPEC);
  420|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  421|  4.82k|    pj_cis_del_str(&pconst.pjsip_HDR_CHAR_SPEC_ESC, ESCAPED);
  ------------------
  |  |   44|  4.82k|#define ESCAPED             "%"
  ------------------
  422|       |
  423|  4.82k|    status = pj_cis_dup(&pconst.pjsip_USER_SPEC, &pconst.pjsip_ALNUM_SPEC);
  424|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  425|  4.82k|    pj_cis_add_str( &pconst.pjsip_USER_SPEC, UNRESERVED ESCAPED USER_UNRESERVED );
  ------------------
  |  |   43|  4.82k|#define UNRESERVED          ALNUM MARK
  |  |  ------------------
  |  |  |  |   42|  4.82k|#define MARK                "-_.!~*'()"
  |  |  ------------------
  ------------------
                  pj_cis_add_str( &pconst.pjsip_USER_SPEC, UNRESERVED ESCAPED USER_UNRESERVED );
  ------------------
  |  |   45|  4.82k|#define USER_UNRESERVED     "&=+$,;?/"
  ------------------
  426|       |
  427|  4.82k|    status = pj_cis_dup(&pconst.pjsip_USER_SPEC_ESC, &pconst.pjsip_USER_SPEC);
  428|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  429|  4.82k|    pj_cis_del_str( &pconst.pjsip_USER_SPEC_ESC, ESCAPED);
  ------------------
  |  |   44|  4.82k|#define ESCAPED             "%"
  ------------------
  430|       |
  431|  4.82k|    status = pj_cis_dup(&pconst.pjsip_USER_SPEC_LENIENT, &pconst.pjsip_USER_SPEC);
  432|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  433|  4.82k|    pj_cis_add_str(&pconst.pjsip_USER_SPEC_LENIENT, "#");
  434|       |
  435|  4.82k|    status = pj_cis_dup(&pconst.pjsip_USER_SPEC_LENIENT_ESC, &pconst.pjsip_USER_SPEC_ESC);
  436|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  437|  4.82k|    pj_cis_add_str(&pconst.pjsip_USER_SPEC_LENIENT_ESC, "#");
  438|       |
  439|  4.82k|    status = pj_cis_dup(&pconst.pjsip_PASSWD_SPEC, &pconst.pjsip_ALNUM_SPEC);
  440|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  441|  4.82k|    pj_cis_add_str( &pconst.pjsip_PASSWD_SPEC, UNRESERVED ESCAPED PASS);
  ------------------
  |  |   43|  4.82k|#define UNRESERVED          ALNUM MARK
  |  |  ------------------
  |  |  |  |   42|  4.82k|#define MARK                "-_.!~*'()"
  |  |  ------------------
  ------------------
                  pj_cis_add_str( &pconst.pjsip_PASSWD_SPEC, UNRESERVED ESCAPED PASS);
  ------------------
  |  |   46|  4.82k|#define PASS                "&=+$,"
  ------------------
  442|       |
  443|  4.82k|    status = pj_cis_dup(&pconst.pjsip_PASSWD_SPEC_ESC, &pconst.pjsip_PASSWD_SPEC);
  444|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  445|  4.82k|    pj_cis_del_str( &pconst.pjsip_PASSWD_SPEC_ESC, ESCAPED);
  ------------------
  |  |   44|  4.82k|#define ESCAPED             "%"
  ------------------
  446|       |
  447|  4.82k|    status = pj_cis_init(&cis_buf, &pconst.pjsip_PROBE_USER_HOST_SPEC);
  448|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  449|  4.82k|    pj_cis_add_str( &pconst.pjsip_PROBE_USER_HOST_SPEC, "@ \n>");
  450|  4.82k|    pj_cis_invert( &pconst.pjsip_PROBE_USER_HOST_SPEC );
  451|       |
  452|  4.82k|    status = pj_cis_init(&cis_buf, &pconst.pjsip_DISPLAY_SPEC);
  453|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  454|  4.82k|    pj_cis_add_str( &pconst.pjsip_DISPLAY_SPEC, ":\r\n<");
  455|  4.82k|    pj_cis_invert(&pconst.pjsip_DISPLAY_SPEC);
  456|       |
  457|  4.82k|    status = pj_cis_dup(&pconst.pjsip_OTHER_URI_CONTENT, &pconst.pjsip_ALNUM_SPEC);
  458|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  459|  4.82k|    pj_cis_add_str( &pconst.pjsip_OTHER_URI_CONTENT, GENERIC_URI_CHARS);
  ------------------
  |  |   58|  4.82k|#define GENERIC_URI_CHARS   "#?;:@&=+-_.!~*'()%$,/" "%"
  ------------------
  460|       |
  461|       |    /*
  462|       |     * Register URI parsers.
  463|       |     */
  464|       |
  465|  4.82k|    status = pjsip_register_uri_parser("sip", &int_parse_sip_url);
  466|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  467|       |
  468|  4.82k|    status = pjsip_register_uri_parser("sips", &int_parse_sip_url);
  469|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  470|       |
  471|       |    /*
  472|       |     * Register header parsers.
  473|       |     */
  474|       |
  475|  4.82k|    status = pjsip_register_hdr_parser( "Accept", NULL, &parse_hdr_accept);
  476|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  477|       |
  478|  4.82k|    status = pjsip_register_hdr_parser( "Allow", NULL, &parse_hdr_allow);
  479|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  480|       |
  481|  4.82k|    status = pjsip_register_hdr_parser( "Call-ID", "i", &parse_hdr_call_id);
  482|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  483|       |
  484|  4.82k|    status = pjsip_register_hdr_parser( "Contact", "m", &parse_hdr_contact);
  485|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  486|       |
  487|  4.82k|    status = pjsip_register_hdr_parser( "Content-Length", "l", 
  488|  4.82k|                                        &parse_hdr_content_len);
  489|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  490|       |
  491|  4.82k|    status = pjsip_register_hdr_parser( "Content-Type", "c", 
  492|  4.82k|                                        &parse_hdr_content_type);
  493|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  494|       |
  495|  4.82k|    status = pjsip_register_hdr_parser( "CSeq", NULL, &parse_hdr_cseq);
  496|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  497|       |
  498|  4.82k|    status = pjsip_register_hdr_parser( "Expires", NULL, &parse_hdr_expires);
  499|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  500|       |
  501|  4.82k|    status = pjsip_register_hdr_parser( "From", "f", &parse_hdr_from);
  502|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  503|       |
  504|  4.82k|    status = pjsip_register_hdr_parser( "Max-Forwards", NULL, 
  505|  4.82k|                                        &parse_hdr_max_forwards);
  506|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  507|       |
  508|  4.82k|    status = pjsip_register_hdr_parser( "Min-Expires", NULL, 
  509|  4.82k|                                        &parse_hdr_min_expires);
  510|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  511|       |
  512|  4.82k|    status = pjsip_register_hdr_parser( "Record-Route", NULL, &parse_hdr_rr);
  513|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  514|       |
  515|  4.82k|    status = pjsip_register_hdr_parser( "Route", NULL, &parse_hdr_route);
  516|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  517|       |
  518|  4.82k|    status = pjsip_register_hdr_parser( "Require", NULL, &parse_hdr_require);
  519|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  520|       |
  521|  4.82k|    status = pjsip_register_hdr_parser( "Retry-After", NULL, 
  522|  4.82k|                                        &parse_hdr_retry_after);
  523|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  524|       |
  525|  4.82k|    status = pjsip_register_hdr_parser( "Supported", "k", 
  526|  4.82k|                                        &parse_hdr_supported);
  527|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  528|       |
  529|  4.82k|    status = pjsip_register_hdr_parser( "To", "t", &parse_hdr_to);
  530|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  531|       |
  532|  4.82k|    status = pjsip_register_hdr_parser( "Unsupported", NULL, 
  533|  4.82k|                                        &parse_hdr_unsupported);
  534|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  535|       |
  536|  4.82k|    status = pjsip_register_hdr_parser( "Via", "v", &parse_hdr_via);
  537|  4.82k|    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  538|       |
  539|       |    /* 
  540|       |     * Register auth parser. 
  541|       |     */
  542|       |
  543|  4.82k|    status = pjsip_auth_init_parser();
  544|       |
  545|  4.82k|    return status;
  546|  4.82k|}
sip_parser.c:int_parse_sip_url:
 1505|  4.27k|{
 1506|  4.27k|    pj_str_t scheme;
 1507|  4.27k|    pjsip_sip_uri *url = NULL;
 1508|  4.27k|    int colon;
 1509|  4.27k|    int skip_ws = scanner->skip_ws;
 1510|  4.27k|    scanner->skip_ws = 0;
 1511|       |
 1512|  4.27k|    pj_scan_get(scanner, &pconst.pjsip_TOKEN_SPEC, &scheme);
 1513|  4.27k|    colon = pj_scan_get_char(scanner);
 1514|  4.27k|    if (colon != ':') {
  ------------------
  |  Branch (1514:9): [True: 0, False: 4.27k]
  ------------------
 1515|      0|        PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|      0|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
 1516|      0|    }
 1517|       |
 1518|  4.27k|    if (parser_stricmp(scheme, pconst.pjsip_SIP_STR)==0) {
  ------------------
  |  |  207|  4.27k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|  4.07k|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 200, False: 4.07k]
  |  |  |  Branch (207:54): [True: 0, False: 4.07k]
  |  |  ------------------
  ------------------
  |  Branch (1518:9): [True: 4.07k, False: 200]
  ------------------
 1519|  4.07k|        url = pjsip_sip_uri_create(pool, 0);
 1520|       |
 1521|  4.07k|    } else if (parser_stricmp(scheme, pconst.pjsip_SIPS_STR)==0) {
  ------------------
  |  |  207|    200|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|    200|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 0, False: 200]
  |  |  |  Branch (207:54): [True: 0, False: 200]
  |  |  ------------------
  ------------------
  |  Branch (1521:16): [True: 200, False: 0]
  ------------------
 1522|    200|        url = pjsip_sip_uri_create(pool, 1);
 1523|       |
 1524|    200|    } else {
 1525|      0|        PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|      0|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
 1526|       |        /* should not reach here */
 1527|      0|        UNREACHED({
 1528|      0|            pj_assert(0);
 1529|      0|            return 0;
 1530|      0|        })
 1531|      0|    }
 1532|       |
 1533|  4.27k|    if (int_is_next_user(scanner)) {
  ------------------
  |  Branch (1533:9): [True: 483, False: 3.78k]
  ------------------
 1534|    483|        int_parse_user_pass(scanner, pool, &url->user, &url->passwd);
 1535|    483|    }
 1536|       |
 1537|       |    /* Get host:port */
 1538|  4.27k|    int_parse_uri_host_port(scanner, &url->host, &url->port);
 1539|       |
 1540|       |    /* Get URL parameters. */
 1541|  4.27k|    if (parse_params) {
  ------------------
  |  Branch (1541:9): [True: 1.75k, False: 2.51k]
  ------------------
 1542|  8.60k|      while (*scanner->curptr == ';' ) {
  ------------------
  |  Branch (1542:14): [True: 6.85k, False: 1.75k]
  ------------------
 1543|  6.85k|        pj_str_t pname, pvalue;
 1544|       |
 1545|  6.85k|        int_parse_uri_param( scanner, pool, &pname, &pvalue, 0);
 1546|       |
 1547|  6.85k|        if (!parser_stricmp(pname, pconst.pjsip_USER_STR) && pvalue.slen) {
  ------------------
  |  |  207|  13.7k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|    610|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 6.24k, False: 610]
  |  |  |  Branch (207:54): [True: 209, False: 401]
  |  |  ------------------
  ------------------
  |  Branch (1547:62): [True: 207, False: 194]
  ------------------
 1548|    207|            url->user_param = pvalue;
 1549|       |
 1550|  6.65k|        } else if (!parser_stricmp(pname, pconst.pjsip_METHOD_STR) && pvalue.slen) {
  ------------------
  |  |  207|  13.3k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|    608|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 6.04k, False: 608]
  |  |  |  Branch (207:54): [True: 216, False: 392]
  |  |  ------------------
  ------------------
  |  Branch (1550:71): [True: 196, False: 196]
  ------------------
 1551|    196|            url->method_param = pvalue;
 1552|       |
 1553|  6.45k|        } else if (!parser_stricmp(pname, pconst.pjsip_TRANSPORT_STR) && pvalue.slen) {
  ------------------
  |  |  207|  12.9k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|    611|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 5.84k, False: 611]
  |  |  |  Branch (207:54): [True: 213, False: 398]
  |  |  ------------------
  ------------------
  |  Branch (1553:74): [True: 204, False: 194]
  ------------------
 1554|    204|            url->transport_param = pvalue;
 1555|       |
 1556|  6.25k|        } else if (!parser_stricmp(pname, pconst.pjsip_TTL_STR) && pvalue.slen) {
  ------------------
  |  |  207|  12.5k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|  1.45k|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 4.79k, False: 1.45k]
  |  |  |  Branch (207:54): [True: 209, False: 1.24k]
  |  |  ------------------
  ------------------
  |  Branch (1556:68): [True: 1.04k, False: 195]
  ------------------
 1557|  1.04k|            strtoi_validate(&pvalue, PJSIP_MIN_TTL, PJSIP_MAX_TTL,
  ------------------
  |  |   47|  1.04k|#define PJSIP_MIN_TTL               0           /**< For limit checks */
  ------------------
                          strtoi_validate(&pvalue, PJSIP_MIN_TTL, PJSIP_MAX_TTL,
  ------------------
  |  |   48|  1.04k|#define PJSIP_MAX_TTL               PJ_MAXUINT8 /**< For limit checks */
  |  |  ------------------
  |  |  |  |   39|  1.04k|#define PJ_MAXUINT8     0xff
  |  |  ------------------
  ------------------
 1558|  1.04k|                            &url->ttl_param);
 1559|  5.20k|        } else if (!parser_stricmp(pname, pconst.pjsip_MADDR_STR) && pvalue.slen) {
  ------------------
  |  |  207|  10.4k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|    608|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 4.59k, False: 608]
  |  |  |  Branch (207:54): [True: 214, False: 394]
  |  |  ------------------
  ------------------
  |  Branch (1559:70): [True: 200, False: 194]
  ------------------
 1560|    200|            url->maddr_param = pvalue;
 1561|       |
 1562|  5.00k|        } else if (!parser_stricmp(pname, pconst.pjsip_LR_STR)) {
  ------------------
  |  |  207|  5.00k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|    482|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 4.52k, False: 482]
  |  |  |  Branch (207:54): [True: 288, False: 194]
  |  |  ------------------
  ------------------
 1563|    194|            url->lr_param = 1;
 1564|       |
 1565|  4.80k|        } else {
 1566|  4.80k|            pjsip_param *p = PJ_POOL_ALLOC_T(pool, pjsip_param);
  ------------------
  |  |  506|  4.80k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
 1567|  4.80k|            p->name = pname;
 1568|  4.80k|            p->value = pvalue;
 1569|  4.80k|            pj_list_insert_before(&url->other_param, p);
 1570|  4.80k|        }
 1571|  6.85k|      }
 1572|  1.75k|    }
 1573|       |
 1574|       |    /* Get header params. */
 1575|  4.27k|    if (parse_params && *scanner->curptr == '?') {
  ------------------
  |  Branch (1575:9): [True: 1.48k, False: 2.79k]
  |  Branch (1575:25): [True: 232, False: 1.24k]
  ------------------
 1576|    990|      do {
 1577|    990|        pjsip_param *param;
 1578|    990|        param = PJ_POOL_ALLOC_T(pool, pjsip_param);
  ------------------
  |  |  506|    990|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
 1579|    990|        int_parse_hparam(scanner, pool, &param->name, &param->value);
 1580|    990|        pj_list_insert_before(&url->header_param, param);
 1581|    990|      } while (*scanner->curptr == '&');
  ------------------
  |  Branch (1581:16): [True: 758, False: 232]
  ------------------
 1582|    232|    }
 1583|       |
 1584|  4.27k|    scanner->skip_ws = skip_ws;
 1585|  4.27k|    pj_scan_skip_whitespace(scanner);
 1586|  4.27k|    return url;
 1587|  4.27k|}
sip_parser.c:int_is_next_user:
 1374|  4.27k|{
 1375|  4.27k|    pj_str_t dummy;
 1376|  4.27k|    int is_user;
 1377|       |
 1378|       |    /* Find character '@'. If this character exist, then the token
 1379|       |     * must be a username.
 1380|       |     */
 1381|  4.27k|    if (pj_scan_peek( scanner, &pconst.pjsip_PROBE_USER_HOST_SPEC, &dummy) == '@')
  ------------------
  |  Branch (1381:9): [True: 483, False: 3.78k]
  ------------------
 1382|    483|        is_user = 1;
 1383|  3.78k|    else
 1384|  3.78k|        is_user = 0;
 1385|       |
 1386|  4.27k|    return is_user;
 1387|  4.27k|}
sip_parser.c:int_parse_user_pass:
 1392|    483|{
 1393|    483|    parser_get_and_unescape(scanner, pool, &pconst.pjsip_USER_SPEC_LENIENT, 
 1394|    483|                            &pconst.pjsip_USER_SPEC_LENIENT_ESC, user);
 1395|       |
 1396|    483|    if ( *scanner->curptr == ':') {
  ------------------
  |  Branch (1396:10): [True: 201, False: 282]
  ------------------
 1397|    201|        pj_scan_get_char( scanner );
 1398|    201|        parser_get_and_unescape(scanner, pool, &pconst.pjsip_PASSWD_SPEC,
 1399|    201|                                &pconst.pjsip_PASSWD_SPEC_ESC, pass);
 1400|    282|    } else {
 1401|    282|        pass->ptr = NULL;
 1402|    282|        pass->slen = 0;
 1403|    282|    }
 1404|       |
 1405|       |    /* Get the '@' */
 1406|    483|    pj_scan_get_char( scanner );
 1407|    483|}
sip_parser.c:parser_get_and_unescape:
  214|  10.8k|{
  215|       |#if defined(PJSIP_UNESCAPE_IN_PLACE) && PJSIP_UNESCAPE_IN_PLACE!=0
  216|       |    PJ_UNUSED_ARG(pool);
  217|       |    PJ_UNUSED_ARG(spec);
  218|       |    pj_scan_get_unescape(scanner, unesc_spec, token);
  219|       |#else
  220|  10.8k|    PJ_UNUSED_ARG(unesc_spec);
  ------------------
  |  | 1433|  10.8k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  221|  10.8k|    pj_scan_get(scanner, spec, token);
  222|  10.8k|    *token = pj_str_unescape(pool, token);
  223|  10.8k|#endif
  224|  10.8k|}
sip_parser.c:int_parse_uri_host_port:
 1358|  4.07k|{
 1359|  4.07k|    int_parse_host(scanner, host);
 1360|       |
 1361|       |    /* RFC3261 section 19.1.2: host don't need to be unescaped */
 1362|  4.07k|    if (*scanner->curptr == ':') {
  ------------------
  |  Branch (1362:9): [True: 214, False: 3.85k]
  ------------------
 1363|    214|        pj_str_t port;
 1364|    214|        pj_scan_get_char(scanner);
 1365|    214|        pj_scan_get(scanner, &pconst.pjsip_DIGIT_SPEC, &port);
 1366|    214|        strtoi_validate(&port, PJSIP_MIN_PORT, PJSIP_MAX_PORT, p_port);
  ------------------
  |  |   45|    214|#define PJSIP_MIN_PORT              0           /**< For limit checks */
  ------------------
                      strtoi_validate(&port, PJSIP_MIN_PORT, PJSIP_MAX_PORT, p_port);
  ------------------
  |  |   46|    214|#define PJSIP_MAX_PORT              PJ_MAXUINT16/**< For limit checks */
  |  |  ------------------
  |  |  |  |   36|    214|#define PJ_MAXUINT16    0xffff
  |  |  ------------------
  ------------------
 1367|  3.85k|    } else {
 1368|  3.85k|        *p_port = 0;
 1369|  3.85k|    }
 1370|  4.07k|}
sip_parser.c:int_parse_host:
 1344|  5.94k|{
 1345|  5.94k|    if (*scanner->curptr == '[') {
  ------------------
  |  Branch (1345:9): [True: 609, False: 5.33k]
  ------------------
 1346|       |        /* Note: the '[' and ']' characters are removed from the host */
 1347|    609|        pj_scan_get_char(scanner);
 1348|    609|        pj_scan_get_until_ch(scanner, ']', host);
 1349|    609|        pj_scan_get_char(scanner);
 1350|  5.33k|    } else {
 1351|  5.33k|        pj_scan_get( scanner, &pconst.pjsip_HOST_SPEC, host);
 1352|  5.33k|    }
 1353|  5.94k|}
sip_parser.c:int_parse_uri_param:
 1303|  6.85k|{
 1304|       |    /* Get ';' character */
 1305|  6.85k|    pj_scan_get_char(scanner);
 1306|       |
 1307|       |    /* Get pname and optionally pvalue */
 1308|  6.85k|    pjsip_parse_uri_param_imp(scanner, pool, pname, pvalue, 
 1309|  6.85k|                              option);
 1310|  6.85k|}
sip_parser.c:int_parse_hparam:
 1316|    990|{
 1317|       |    /* Get '?' or '&' character. */
 1318|    990|    pj_scan_get_char(scanner);
 1319|       |
 1320|       |    /* hname */
 1321|    990|    parser_get_and_unescape(scanner, pool, &pconst.pjsip_HDR_CHAR_SPEC, 
 1322|    990|                            &pconst.pjsip_HDR_CHAR_SPEC_ESC, hname);
 1323|       |
 1324|       |    /* Init hvalue */
 1325|    990|    hvalue->ptr = NULL;
 1326|    990|    hvalue->slen = 0;
 1327|       |
 1328|       |    /* pvalue, if any */
 1329|    990|    if (*scanner->curptr == '=') {
  ------------------
  |  Branch (1329:9): [True: 389, False: 601]
  ------------------
 1330|    389|        pj_scan_get_char(scanner);
 1331|    389|        if (!pj_scan_is_eof(scanner) && 
  ------------------
  |  Branch (1331:13): [True: 388, False: 1]
  ------------------
 1332|    389|            pj_cis_match(&pconst.pjsip_HDR_CHAR_SPEC, *scanner->curptr))
  ------------------
  |  Branch (1332:13): [True: 194, False: 194]
  ------------------
 1333|    194|        {
 1334|    194|            parser_get_and_unescape(scanner, pool, &pconst.pjsip_HDR_CHAR_SPEC,
 1335|    194|                                    &pconst.pjsip_HDR_CHAR_SPEC_ESC, hvalue);
 1336|    194|        }
 1337|    389|    }
 1338|    990|}
sip_parser.c:parse_hdr_call_id:
 1857|    680|{
 1858|    680|    pjsip_cid_hdr *hdr = pjsip_cid_hdr_create(ctx->pool);
 1859|    680|    pj_scan_get( ctx->scanner, &pconst.pjsip_NOT_NEWLINE, &hdr->id);
 1860|    680|    parse_hdr_end(ctx->scanner);
 1861|       |
 1862|    680|    if (ctx->rdata)
  ------------------
  |  Branch (1862:9): [True: 0, False: 680]
  ------------------
 1863|      0|        ctx->rdata->msg_info.cid = hdr;
 1864|       |
 1865|    680|    return (pjsip_hdr*)hdr;
 1866|    680|}
sip_parser.c:parse_hdr_contact:
 1926|  18.0k|{
 1927|  18.0k|    pjsip_contact_hdr *first = NULL;
 1928|  18.0k|    pj_scanner *scanner = ctx->scanner;
 1929|       |    
 1930|  20.3k|    do {
 1931|  20.3k|        pjsip_contact_hdr *hdr = pjsip_contact_hdr_create(ctx->pool);
 1932|  20.3k|        if (first == NULL)
  ------------------
  |  Branch (1932:13): [True: 18.0k, False: 2.28k]
  ------------------
 1933|  18.0k|            first = hdr;
 1934|  2.28k|        else
 1935|  2.28k|            pj_list_insert_before(first, hdr);
 1936|       |
 1937|  20.3k|        if (*scanner->curptr == '*') {
  ------------------
  |  Branch (1937:13): [True: 1.53k, False: 18.8k]
  ------------------
 1938|  1.53k|            pj_scan_get_char(scanner);
 1939|  1.53k|            hdr->star = 1;
 1940|       |
 1941|  18.8k|        } else {
 1942|  18.8k|            hdr->star = 0;
 1943|  18.8k|            hdr->uri = int_parse_uri_or_name_addr(scanner, ctx->pool, 
 1944|  18.8k|                                                  PJSIP_PARSE_URI_AS_NAMEADDR |
 1945|  18.8k|                                                  PJSIP_PARSE_URI_IN_FROM_TO_HDR);
 1946|       |
 1947|  18.8k|            int_parse_contact_param(hdr, scanner, ctx->pool);
 1948|  18.8k|        }
 1949|       |
 1950|  20.3k|        if (*scanner->curptr != ',')
  ------------------
  |  Branch (1950:13): [True: 1.34k, False: 19.0k]
  ------------------
 1951|  1.34k|            break;
 1952|       |
 1953|  19.0k|        pj_scan_get_char(scanner);
 1954|       |
 1955|  19.0k|    } while (1);
  ------------------
  |  Branch (1955:14): [Folded - Ignored]
  ------------------
 1956|       |
 1957|      0|    parse_hdr_end(scanner);
 1958|       |
 1959|  18.0k|    return (pjsip_hdr*)first;
 1960|  18.0k|}
sip_parser.c:int_parse_contact_param:
 1872|  3.84k|{
 1873|  9.84k|    while ( *scanner->curptr == ';' ) {
  ------------------
  |  Branch (1873:13): [True: 6.19k, False: 3.65k]
  ------------------
 1874|  6.19k|        pj_str_t pname, pvalue;
 1875|       |
 1876|  6.19k|        int_parse_param( scanner, pool, &pname, &pvalue, 0);
 1877|  6.19k|        if (!parser_stricmp(pname, pconst.pjsip_Q_STR) && pvalue.slen) {
  ------------------
  |  |  207|  12.3k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|  5.06k|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 1.12k, False: 5.06k]
  |  |  |  Branch (207:54): [True: 621, False: 4.44k]
  |  |  ------------------
  ------------------
  |  Branch (1877:59): [True: 3.92k, False: 527]
  ------------------
 1878|  3.92k|            char *dot_pos = (char*) pj_memchr(pvalue.ptr, '.', pvalue.slen);
 1879|  3.92k|            if (!dot_pos) {
  ------------------
  |  Branch (1879:17): [True: 1.93k, False: 1.98k]
  ------------------
 1880|  1.93k|                strtoi_validate(&pvalue, PJSIP_MIN_Q1000, PJSIP_MAX_Q1000,
  ------------------
  |  |   51|  1.93k|#define PJSIP_MIN_Q1000             0           /**< For limit checks */
  ------------------
                              strtoi_validate(&pvalue, PJSIP_MIN_Q1000, PJSIP_MAX_Q1000,
  ------------------
  |  |   52|  1.93k|#define PJSIP_MAX_Q1000             PJ_MAXINT32 / 1000/**< For limit checks */
  |  |  ------------------
  |  |  |  |   30|  1.93k|#define PJ_MAXINT32     0x7fffffff
  |  |  ------------------
  ------------------
 1881|  1.93k|                                &hdr->q1000);
 1882|  1.93k|                hdr->q1000 *= 1000;
 1883|  1.98k|            } else {
 1884|  1.98k|                pj_str_t tmp = pvalue;
 1885|  1.98k|                unsigned long qval_frac;
 1886|       |
 1887|  1.98k|                tmp.slen = dot_pos - pvalue.ptr;
 1888|  1.98k|                strtoi_validate(&tmp, PJSIP_MIN_Q1000, PJSIP_MAX_Q1000,
  ------------------
  |  |   51|  1.98k|#define PJSIP_MIN_Q1000             0           /**< For limit checks */
  ------------------
                              strtoi_validate(&tmp, PJSIP_MIN_Q1000, PJSIP_MAX_Q1000,
  ------------------
  |  |   52|  1.98k|#define PJSIP_MAX_Q1000             PJ_MAXINT32 / 1000/**< For limit checks */
  |  |  ------------------
  |  |  |  |   30|  1.98k|#define PJ_MAXINT32     0x7fffffff
  |  |  ------------------
  ------------------
 1889|  1.98k|                                &hdr->q1000);
 1890|  1.98k|                hdr->q1000 *= 1000;
 1891|       |
 1892|  1.98k|                pvalue.slen = (pvalue.ptr+pvalue.slen) - (dot_pos+1);
 1893|  1.98k|                pvalue.ptr = dot_pos + 1;
 1894|  1.98k|                if (pvalue.slen > 3) {
  ------------------
  |  Branch (1894:21): [True: 212, False: 1.77k]
  ------------------
 1895|    212|                    pvalue.slen = 3;
 1896|    212|                }
 1897|  1.98k|                qval_frac = pj_strtoul_mindigit(&pvalue, 3);
 1898|  1.98k|                if ((unsigned)hdr->q1000 > (PJ_MAXINT32 - qval_frac)) {
  ------------------
  |  |   30|  1.98k|#define PJ_MAXINT32     0x7fffffff
  ------------------
  |  Branch (1898:21): [True: 194, False: 1.79k]
  ------------------
 1899|    194|                    PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|    194|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
 1900|    194|                }
 1901|  1.79k|                hdr->q1000 += qval_frac;
 1902|  1.79k|            }    
 1903|  3.92k|        } else if (!parser_stricmp(pname, pconst.pjsip_EXPIRES_STR) && 
  ------------------
  |  |  207|  4.55k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|    831|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 1.44k, False: 831]
  |  |  |  Branch (207:54): [True: 208, False: 623]
  |  |  ------------------
  ------------------
 1904|  2.27k|                   pvalue.slen) 
  ------------------
  |  Branch (1904:20): [True: 429, False: 194]
  ------------------
 1905|    429|        {
 1906|    429|            hdr->expires = pj_strtoul(&pvalue);
 1907|    429|            if (hdr->expires == PJSIP_EXPIRES_NOT_SPECIFIED)
  ------------------
  |  | 1427|    429|#define PJSIP_EXPIRES_NOT_SPECIFIED     ((pj_uint32_t)0xFFFFFFFFUL)
  ------------------
  |  Branch (1907:17): [True: 194, False: 235]
  ------------------
 1908|    194|                hdr->expires--;
 1909|    429|            if (hdr->expires > PJSIP_MAX_EXPIRES)
  ------------------
  |  |   54|    429|#define PJSIP_MAX_EXPIRES           ((pj_uint32_t)0xFFFFFFFFUL)/**< for chk */
  ------------------
  |  Branch (1909:17): [True: 0, False: 429]
  ------------------
 1910|      0|                hdr->expires = PJSIP_MAX_EXPIRES;
  ------------------
  |  |   54|      0|#define PJSIP_MAX_EXPIRES           ((pj_uint32_t)0xFFFFFFFFUL)/**< for chk */
  ------------------
 1911|       |#if PJSIP_MIN_EXPIRES > 0
 1912|       |            if (hdr->expires < PJSIP_MIN_EXPIRES)
 1913|       |                hdr->expires = PJSIP_MIN_EXPIRES;
 1914|       |#endif
 1915|  1.84k|        } else {
 1916|  1.84k|            pjsip_param *p = PJ_POOL_ALLOC_T(pool, pjsip_param);
  ------------------
  |  |  506|  1.84k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
 1917|  1.84k|            p->name = pname;
 1918|  1.84k|            p->value = pvalue;
 1919|  1.84k|            pj_list_insert_before(&hdr->other_param, p);
 1920|  1.84k|        }
 1921|  6.19k|    }
 1922|  3.84k|}
sip_parser.c:int_parse_param:
 1291|  13.3k|{
 1292|       |    /* Get ';' character */
 1293|  13.3k|    pj_scan_get_char(scanner);
 1294|       |
 1295|       |    /* Get pname and optionally pvalue */
 1296|  13.3k|    pjsip_parse_param_imp(scanner, pool, pname, pvalue, option);
 1297|  13.3k|}
sip_parser.c:pj_strtoul_mindigit:
  192|  1.79k|{
  193|  1.79k|    unsigned long value;
  194|  1.79k|    unsigned i;
  195|       |
  196|  1.79k|    value = 0;
  197|  4.27k|    for (i=0; i<(unsigned)str->slen; ++i) {
  ------------------
  |  Branch (197:15): [True: 2.48k, False: 1.79k]
  ------------------
  198|  2.48k|        value = value * 10 + (str->ptr[i] - '0');
  199|  2.48k|    }
  200|  4.69k|    for (; i<mindig; ++i) {
  ------------------
  |  Branch (200:12): [True: 2.89k, False: 1.79k]
  ------------------
  201|  2.89k|        value = value * 10;
  202|  2.89k|    }
  203|  1.79k|    return value;
  204|  1.79k|}
sip_parser.c:parse_hdr_content_len:
 1964|    706|{
 1965|    706|    pj_str_t digit;
 1966|    706|    pjsip_clen_hdr *hdr;
 1967|       |
 1968|    706|    hdr = pjsip_clen_hdr_create(ctx->pool);
 1969|    706|    pj_scan_get(ctx->scanner, &pconst.pjsip_DIGIT_SPEC, &digit);
 1970|    706|    hdr->len = pj_strtoul(&digit);
 1971|    706|    parse_hdr_end(ctx->scanner);
 1972|       |
 1973|    706|    if (ctx->rdata)
  ------------------
  |  Branch (1973:9): [True: 0, False: 706]
  ------------------
 1974|      0|        ctx->rdata->msg_info.clen = hdr;
 1975|       |
 1976|    706|    return (pjsip_hdr*)hdr;
 1977|    706|}
sip_parser.c:parse_hdr_content_type:
 1981|  3.33k|{
 1982|  3.33k|    pjsip_ctype_hdr *hdr;
 1983|  3.33k|    pj_scanner *scanner = ctx->scanner;
 1984|       |
 1985|  3.33k|    hdr = pjsip_ctype_hdr_create(ctx->pool);
 1986|       |    
 1987|       |    /* Parse media type and subtype. */
 1988|  3.33k|    pj_scan_get(scanner, &pconst.pjsip_TOKEN_SPEC, &hdr->media.type);
 1989|  3.33k|    pj_scan_get_char(scanner);
 1990|  3.33k|    pj_scan_get(scanner, &pconst.pjsip_TOKEN_SPEC, &hdr->media.subtype);
 1991|       |
 1992|       |    /* Parse media parameters */
 1993|  8.70k|    while (*scanner->curptr == ';') {
  ------------------
  |  Branch (1993:12): [True: 5.37k, False: 3.33k]
  ------------------
 1994|  5.37k|        pjsip_param *param = PJ_POOL_ALLOC_T(ctx->pool, pjsip_param);
  ------------------
  |  |  506|  5.37k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
 1995|  5.37k|        int_parse_param(scanner, ctx->pool, &param->name, &param->value, 0);
 1996|  5.37k|        pj_list_push_back(&hdr->media.param, param);
 1997|  5.37k|    }
 1998|       |
 1999|  3.33k|    parse_hdr_end(ctx->scanner);
 2000|       |
 2001|  3.33k|    if (ctx->rdata)
  ------------------
  |  Branch (2001:9): [True: 0, False: 3.33k]
  ------------------
 2002|      0|        ctx->rdata->msg_info.ctype = hdr;
 2003|       |
 2004|  3.33k|    return (pjsip_hdr*)hdr;
 2005|  3.33k|}
sip_parser.c:parse_hdr_cseq:
 2009|  2.07k|{
 2010|  2.07k|    pj_str_t cseq, method;
 2011|  2.07k|    pjsip_cseq_hdr *hdr = NULL;
 2012|  2.07k|    int cseq_val = 0;
 2013|       |
 2014|  2.07k|    pj_scan_get( ctx->scanner, &pconst.pjsip_DIGIT_SPEC, &cseq);
 2015|  2.07k|    strtoi_validate(&cseq, PJSIP_MIN_CSEQ, PJSIP_MAX_CSEQ, &cseq_val);
  ------------------
  |  |   55|  2.07k|#define PJSIP_MIN_CSEQ              0           /**< For limit checks */
  ------------------
                  strtoi_validate(&cseq, PJSIP_MIN_CSEQ, PJSIP_MAX_CSEQ, &cseq_val);
  ------------------
  |  |   56|  2.07k|#define PJSIP_MAX_CSEQ              PJ_MAXINT32 /**< For limit checks */
  |  |  ------------------
  |  |  |  |   30|  2.07k|#define PJ_MAXINT32     0x7fffffff
  |  |  ------------------
  ------------------
 2016|       |
 2017|  2.07k|    hdr = pjsip_cseq_hdr_create(ctx->pool);
 2018|  2.07k|    hdr->cseq = cseq_val;
 2019|       |
 2020|  2.07k|    pj_scan_get( ctx->scanner, &pconst.pjsip_TOKEN_SPEC, &method);
 2021|  2.07k|    parse_hdr_end( ctx->scanner );
 2022|       |
 2023|  2.07k|    pjsip_method_init_np(&hdr->method, &method);
 2024|  2.07k|    if (ctx->rdata) {
  ------------------
  |  Branch (2024:9): [True: 0, False: 2.07k]
  ------------------
 2025|      0|        ctx->rdata->msg_info.cseq = hdr;
 2026|      0|    }
 2027|       |
 2028|  2.07k|    return (pjsip_hdr*)hdr;
 2029|  2.07k|}
sip_parser.c:parse_hdr_expires:
 2033|    594|{
 2034|    594|    pjsip_expires_hdr *hdr = pjsip_expires_hdr_create(ctx->pool, 0);
 2035|    594|    parse_generic_int_hdr(hdr, ctx->scanner);
 2036|    594|    return (pjsip_hdr*)hdr;
 2037|    594|}
sip_parser.c:parse_generic_int_hdr:
 1831|  1.43k|{
 1832|  1.43k|    pj_str_t tmp;
 1833|  1.43k|    pj_scan_get( scanner, &pconst.pjsip_DIGIT_SPEC, &tmp);
 1834|  1.43k|    hdr->ivalue = pj_strtoul(&tmp);
 1835|  1.43k|    parse_hdr_end(scanner);
 1836|  1.43k|}
sip_parser.c:parse_hdr_from:
 2069|  1.04k|{
 2070|  1.04k|    pjsip_from_hdr *hdr = pjsip_from_hdr_create(ctx->pool);
 2071|  1.04k|    parse_hdr_fromto(ctx->scanner, ctx->pool, hdr);
 2072|  1.04k|    if (ctx->rdata)
  ------------------
  |  Branch (2072:9): [True: 0, False: 1.04k]
  ------------------
 2073|      0|        ctx->rdata->msg_info.from = hdr;
 2074|       |
 2075|  1.04k|    return (pjsip_hdr*)hdr;
 2076|  1.04k|}
sip_parser.c:parse_hdr_fromto:
 2043|  3.78k|{
 2044|  3.78k|    hdr->uri = int_parse_uri_or_name_addr(scanner, pool, 
 2045|  3.78k|                                          PJSIP_PARSE_URI_AS_NAMEADDR |
 2046|  3.78k|                                          PJSIP_PARSE_URI_IN_FROM_TO_HDR);
 2047|       |
 2048|  4.79k|    while ( *scanner->curptr == ';' ) {
  ------------------
  |  Branch (2048:13): [True: 1.01k, False: 3.78k]
  ------------------
 2049|  1.01k|        pj_str_t pname, pvalue;
 2050|       |
 2051|  1.01k|        int_parse_param( scanner, pool, &pname, &pvalue, 0);
 2052|       |
 2053|  1.01k|        if (!parser_stricmp(pname, pconst.pjsip_TAG_STR)) {
  ------------------
  |  |  207|  1.01k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|    397|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 614, False: 397]
  |  |  |  Branch (207:54): [True: 203, False: 194]
  |  |  ------------------
  ------------------
 2054|    194|            hdr->tag = pvalue;
 2055|       |            
 2056|    817|        } else {
 2057|    817|            pjsip_param *p = PJ_POOL_ALLOC_T(pool, pjsip_param);
  ------------------
  |  |  506|    817|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
 2058|    817|            p->name = pname;
 2059|    817|            p->value = pvalue;
 2060|    817|            pj_list_insert_before(&hdr->other_param, p);
 2061|    817|        }
 2062|  1.01k|    }
 2063|       |
 2064|  3.78k|    parse_hdr_end(scanner);
 2065|  3.78k|}
sip_parser.c:parse_hdr_max_forwards:
 2227|    842|{
 2228|    842|    pjsip_max_fwd_hdr *hdr;
 2229|    842|    hdr = pjsip_max_fwd_hdr_create(ctx->pool, 0);
 2230|    842|    parse_generic_int_hdr(hdr, ctx->scanner);
 2231|       |
 2232|    842|    if (ctx->rdata)
  ------------------
  |  Branch (2232:9): [True: 0, False: 842]
  ------------------
 2233|      0|        ctx->rdata->msg_info.max_fwd = hdr;
 2234|       |
 2235|    842|    return (pjsip_hdr*)hdr;
 2236|    842|}
sip_parser.c:parse_hdr_rr:
 2265|    796|{
 2266|    796|    pjsip_rr_hdr *first = NULL;
 2267|    796|    pj_scanner *scanner = ctx->scanner;
 2268|       |
 2269|  1.41k|    do {
 2270|  1.41k|        pjsip_rr_hdr *hdr = pjsip_rr_hdr_create(ctx->pool);
 2271|  1.41k|        if (!first) {
  ------------------
  |  Branch (2271:13): [True: 796, False: 623]
  ------------------
 2272|    796|            first = hdr;
 2273|    796|        } else {
 2274|    623|            pj_list_insert_before(first, hdr);
 2275|    623|        }
 2276|  1.41k|        parse_hdr_rr_route(scanner, ctx->pool, hdr);
 2277|  1.41k|        if (*scanner->curptr == ',') {
  ------------------
  |  Branch (2277:13): [True: 623, False: 796]
  ------------------
 2278|    623|            pj_scan_get_char(scanner);
 2279|    796|        } else {
 2280|    796|            break;
 2281|    796|        }
 2282|  1.41k|    } while (1);
  ------------------
  |  Branch (2282:14): [Folded - Ignored]
  ------------------
 2283|      0|    parse_hdr_end(scanner);
 2284|       |
 2285|    796|    if (ctx->rdata && ctx->rdata->msg_info.record_route==NULL)
  ------------------
  |  Branch (2285:9): [True: 0, False: 796]
  |  Branch (2285:23): [True: 0, False: 0]
  ------------------
 2286|      0|        ctx->rdata->msg_info.record_route = first;
 2287|       |
 2288|    796|    return (pjsip_hdr*)first;
 2289|    796|}
sip_parser.c:parse_hdr_rr_route:
 2251|  3.32k|{
 2252|  3.32k|    pjsip_name_addr *temp=int_parse_name_addr(scanner, pool);
 2253|       |
 2254|  3.32k|    pj_memcpy(&hdr->name_addr, temp, sizeof(*temp));
 2255|       |
 2256|  4.12k|    while (*scanner->curptr == ';') {
  ------------------
  |  Branch (2256:12): [True: 797, False: 3.32k]
  ------------------
 2257|    797|        pjsip_param *p = PJ_POOL_ALLOC_T(pool, pjsip_param);
  ------------------
  |  |  506|    797|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
 2258|    797|        int_parse_param(scanner, pool, &p->name, &p->value, 0);
 2259|    797|        pj_list_insert_before(&hdr->other_param, p);
 2260|    797|    }
 2261|  3.32k|}
sip_parser.c:int_parse_name_addr:
 1592|  20.9k|{
 1593|  20.9k|    int has_bracket;
 1594|  20.9k|    pjsip_name_addr *name_addr;
 1595|       |
 1596|  20.9k|    name_addr = pjsip_name_addr_create(pool);
 1597|       |
 1598|  20.9k|    if (*scanner->curptr == '"') {
  ------------------
  |  Branch (1598:9): [True: 875, False: 20.0k]
  ------------------
 1599|    875|        pj_scan_get_quote( scanner, '"', '"', &name_addr->display);
 1600|       |        /* Trim the leading and ending quote */
 1601|    875|        name_addr->display.ptr++;
 1602|    875|        name_addr->display.slen -= 2;
 1603|       |
 1604|  20.0k|    } else if (*scanner->curptr != '<') {
  ------------------
  |  Branch (1604:16): [True: 15.3k, False: 4.67k]
  ------------------
 1605|  15.3k|        int next;
 1606|  15.3k|        pj_str_t dummy;
 1607|       |
 1608|       |        /* This can be either the start of display name,
 1609|       |         * the start of URL ("sip:", "sips:", "tel:", etc.), or '<' char.
 1610|       |         * We're only interested in display name, because SIP URL
 1611|       |         * will be parser later.
 1612|       |         */
 1613|  15.3k|        next = pj_scan_peek(scanner, &pconst.pjsip_DISPLAY_SPEC, &dummy);
 1614|  15.3k|        if (next == '<') {
  ------------------
  |  Branch (1614:13): [True: 340, False: 15.0k]
  ------------------
 1615|       |            /* Ok, this is what we're looking for, a display name. */
 1616|    340|            pj_scan_get_until_ch( scanner, '<', &name_addr->display);
 1617|    340|            pj_strtrim(&name_addr->display);
 1618|    340|        }
 1619|  15.3k|    }
 1620|       |
 1621|       |    /* Manually skip whitespace. */
 1622|  20.9k|    pj_scan_skip_whitespace(scanner);
 1623|       |
 1624|       |    /* Get the SIP-URL */
 1625|  20.9k|    has_bracket = (*scanner->curptr == '<');
 1626|  20.9k|    if (has_bracket) {
  ------------------
  |  Branch (1626:9): [True: 5.01k, False: 15.9k]
  ------------------
 1627|  5.01k|        pj_scan_get_char(scanner);
 1628|  15.9k|    } else if (name_addr->display.slen) {
  ------------------
  |  Branch (1628:16): [True: 346, False: 15.5k]
  ------------------
 1629|       |        /* Must have bracket now (2012-10-26).
 1630|       |         * Allowing (invalid) name-addr to pass URI verification will
 1631|       |         * cause us to send invalid URI to the wire.
 1632|       |         */
 1633|    346|        PJ_THROW( PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|    346|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
 1634|    346|    }
 1635|  20.5k|    name_addr->uri = int_parse_uri( scanner, pool, PJ_TRUE );
 1636|  20.5k|    if (has_bracket) {
  ------------------
  |  Branch (1636:9): [True: 4.13k, False: 16.4k]
  ------------------
 1637|  4.13k|        if (pj_scan_get_char(scanner) != '>')
  ------------------
  |  Branch (1637:13): [True: 596, False: 3.53k]
  ------------------
 1638|    596|            PJ_THROW( PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|    596|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
 1639|  4.13k|    }
 1640|       |
 1641|  19.9k|    return name_addr;
 1642|  20.5k|}
sip_parser.c:int_parse_uri:
 1465|  21.5k|{
 1466|       |    /* Bug:
 1467|       |     * This function should not call back int_parse_name_addr() because
 1468|       |     * it is called by that function. This would cause stack overflow
 1469|       |     * with PROTOS test #1223.
 1470|       |    if (*scanner->curptr=='"' || *scanner->curptr=='<') {
 1471|       |        return (pjsip_uri*)int_parse_name_addr( scanner, pool );
 1472|       |    } else {
 1473|       |    */
 1474|  21.5k|        pj_str_t scheme;
 1475|  21.5k|        int colon;
 1476|  21.5k|        pjsip_parse_uri_func *func;
 1477|       |
 1478|       |        /* Get scheme. */
 1479|  21.5k|        colon = pj_scan_peek(scanner, &pconst.pjsip_TOKEN_SPEC, &scheme);
 1480|  21.5k|        if (colon != ':') {
  ------------------
  |  Branch (1480:13): [True: 14.1k, False: 7.45k]
  ------------------
 1481|  14.1k|            PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|  14.1k|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
 1482|  14.1k|        }
 1483|       |
 1484|  7.45k|        func = find_uri_handler(&scheme);
 1485|  7.45k|        if (func)  {
  ------------------
  |  Branch (1485:13): [True: 7.35k, False: 94]
  ------------------
 1486|  7.35k|            return (pjsip_uri*)(*func)(scanner, pool, parse_params);
 1487|       |
 1488|  7.35k|        } else {
 1489|       |            /* Unsupported URI scheme */
 1490|     94|            PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|     94|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
 1491|     94|            UNREACHED({ return NULL; /* Not reached. */ })
 1492|     94|        }
 1493|       |
 1494|       |    /*
 1495|       |    }
 1496|       |    */
 1497|  7.45k|}
sip_parser.c:find_uri_handler:
  771|  12.3k|{
  772|  12.3k|    unsigned i;
  773|  35.1k|    for (i=0; i<uri_handler_count; ++i) {
  ------------------
  |  Branch (773:15): [True: 28.5k, False: 6.61k]
  ------------------
  774|  28.5k|        if (parser_stricmp(uri_handler[i].scheme, (*scheme))==0)
  ------------------
  |  |  207|  28.5k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|  7.19k|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 21.3k, False: 7.19k]
  |  |  |  Branch (207:54): [True: 1.50k, False: 5.69k]
  |  |  ------------------
  ------------------
  |  Branch (774:13): [True: 5.69k, False: 22.8k]
  ------------------
  775|  5.69k|            return uri_handler[i].parse;
  776|  28.5k|    }
  777|  6.61k|    return &int_parse_other_uri;
  778|  12.3k|}
sip_parser.c:int_parse_other_uri:
 1649|  6.61k|{
 1650|  6.61k|    pjsip_other_uri *uri = 0;
 1651|  6.61k|    const pjsip_parser_const_t *pc = pjsip_parser_const();
 1652|  6.61k|    int skip_ws = scanner->skip_ws;
 1653|       |
 1654|  6.61k|    PJ_UNUSED_ARG(parse_params);
  ------------------
  |  | 1433|  6.61k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
 1655|       |
 1656|  6.61k|    scanner->skip_ws = 0;
 1657|       |    
 1658|  6.61k|    uri = pjsip_other_uri_create(pool); 
 1659|       |    
 1660|  6.61k|    pj_scan_get(scanner, &pc->pjsip_TOKEN_SPEC, &uri->scheme);
 1661|  6.61k|    if (pj_scan_get_char(scanner) != ':') {
  ------------------
  |  Branch (1661:9): [True: 343, False: 6.26k]
  ------------------
 1662|    343|        PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|    343|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
 1663|    343|    }
 1664|       |    
 1665|  6.26k|    pj_scan_get(scanner, &pc->pjsip_OTHER_URI_CONTENT, &uri->content);
 1666|  6.26k|    scanner->skip_ws = skip_ws;
 1667|       |    
 1668|  6.26k|    return uri;
 1669|  6.61k|}
sip_parser.c:parse_hdr_route:
 2293|    809|{
 2294|    809|    pjsip_route_hdr *first = NULL;
 2295|    809|    pj_scanner *scanner = ctx->scanner;
 2296|       |
 2297|  1.90k|    do {
 2298|  1.90k|        pjsip_route_hdr *hdr = pjsip_route_hdr_create(ctx->pool);
 2299|  1.90k|        if (!first) {
  ------------------
  |  Branch (2299:13): [True: 809, False: 1.09k]
  ------------------
 2300|    809|            first = hdr;
 2301|  1.09k|        } else {
 2302|  1.09k|            pj_list_insert_before(first, hdr);
 2303|  1.09k|        }
 2304|  1.90k|        parse_hdr_rr_route(scanner, ctx->pool, hdr);
 2305|  1.90k|        if (*scanner->curptr == ',') {
  ------------------
  |  Branch (2305:13): [True: 1.09k, False: 809]
  ------------------
 2306|  1.09k|            pj_scan_get_char(scanner);
 2307|  1.09k|        } else {
 2308|    809|            break;
 2309|    809|        }
 2310|  1.90k|    } while (1);
  ------------------
  |  Branch (2310:14): [Folded - Ignored]
  ------------------
 2311|      0|    parse_hdr_end(scanner);
 2312|       |
 2313|    809|    if (ctx->rdata && ctx->rdata->msg_info.route==NULL)
  ------------------
  |  Branch (2313:9): [True: 0, False: 809]
  |  Branch (2313:23): [True: 0, False: 0]
  ------------------
 2314|      0|        ctx->rdata->msg_info.route = first;
 2315|       |
 2316|    809|    return (pjsip_hdr*)first;
 2317|    809|}
sip_parser.c:parse_hdr_require:
 2080|    195|{
 2081|    195|    pjsip_require_hdr *hdr;
 2082|    195|    pj_bool_t new_hdr = (ctx->rdata==NULL ||
  ------------------
  |  Branch (2082:26): [True: 195, False: 0]
  ------------------
 2083|    195|                         ctx->rdata->msg_info.require == NULL);
  ------------------
  |  Branch (2083:26): [True: 0, False: 0]
  ------------------
 2084|       |    
 2085|    195|    if (ctx->rdata && ctx->rdata->msg_info.require) {
  ------------------
  |  Branch (2085:9): [True: 0, False: 195]
  |  Branch (2085:23): [True: 0, False: 0]
  ------------------
 2086|      0|        hdr = ctx->rdata->msg_info.require;
 2087|    195|    } else {
 2088|    195|        hdr = pjsip_require_hdr_create(ctx->pool);
 2089|    195|        if (ctx->rdata)
  ------------------
  |  Branch (2089:13): [True: 0, False: 195]
  ------------------
 2090|      0|            ctx->rdata->msg_info.require = hdr;
 2091|    195|    }
 2092|       |
 2093|    195|    parse_generic_array_hdr(hdr, ctx->scanner);
 2094|       |
 2095|    195|    return new_hdr ? (pjsip_hdr*)hdr : NULL;
  ------------------
  |  Branch (2095:12): [True: 195, False: 0]
  ------------------
 2096|    195|}
sip_parser.c:parse_hdr_supported:
 2134|  22.3k|{
 2135|  22.3k|    pjsip_supported_hdr *hdr;
 2136|  22.3k|    pj_bool_t new_hdr = (ctx->rdata==NULL || 
  ------------------
  |  Branch (2136:26): [True: 22.3k, False: 0]
  ------------------
 2137|  22.3k|                         ctx->rdata->msg_info.supported == NULL);
  ------------------
  |  Branch (2137:26): [True: 0, False: 0]
  ------------------
 2138|       |
 2139|  22.3k|    if (ctx->rdata && ctx->rdata->msg_info.supported) {
  ------------------
  |  Branch (2139:9): [True: 0, False: 22.3k]
  |  Branch (2139:23): [True: 0, False: 0]
  ------------------
 2140|      0|        hdr = ctx->rdata->msg_info.supported;
 2141|  22.3k|    } else {
 2142|  22.3k|        hdr = pjsip_supported_hdr_create(ctx->pool);
 2143|  22.3k|        if (ctx->rdata)
  ------------------
  |  Branch (2143:13): [True: 0, False: 22.3k]
  ------------------
 2144|      0|            ctx->rdata->msg_info.supported = hdr;
 2145|  22.3k|    }
 2146|       |
 2147|  22.3k|    parse_generic_array_hdr(hdr, ctx->scanner);
 2148|  22.3k|    return new_hdr ? (pjsip_hdr*)hdr : NULL;
  ------------------
  |  Branch (2148:12): [True: 22.2k, False: 152]
  ------------------
 2149|  22.3k|}
sip_parser.c:parse_hdr_to:
 2153|  2.73k|{
 2154|  2.73k|    pjsip_to_hdr *hdr = pjsip_to_hdr_create(ctx->pool);
 2155|  2.73k|    parse_hdr_fromto(ctx->scanner, ctx->pool, hdr);
 2156|       |
 2157|  2.73k|    if (ctx->rdata)
  ------------------
  |  Branch (2157:9): [True: 0, False: 2.73k]
  ------------------
 2158|      0|        ctx->rdata->msg_info.to = hdr;
 2159|       |
 2160|  2.73k|    return (pjsip_hdr*)hdr;
 2161|  2.73k|}
sip_parser.c:parse_hdr_via:
 2321|  4.05k|{
 2322|  4.05k|    pjsip_via_hdr *first = NULL;
 2323|  4.05k|    pj_scanner *scanner = ctx->scanner;
 2324|       |
 2325|  4.34k|    do {
 2326|  4.34k|        pjsip_via_hdr *hdr = pjsip_via_hdr_create(ctx->pool);
 2327|  4.34k|        if (!first)
  ------------------
  |  Branch (2327:13): [True: 4.05k, False: 293]
  ------------------
 2328|  4.05k|            first = hdr;
 2329|    293|        else
 2330|    293|            pj_list_insert_before(first, hdr);
 2331|       |
 2332|  4.34k|        parse_sip_version(scanner);
 2333|  4.34k|        if (pj_scan_get_char(scanner) != '/')
  ------------------
  |  Branch (2333:13): [True: 389, False: 3.95k]
  ------------------
 2334|    389|            on_syntax_error(scanner);
 2335|       |
 2336|  4.34k|        pj_scan_get( scanner, &pconst.pjsip_TOKEN_SPEC, &hdr->transport);
 2337|  4.34k|        int_parse_host(scanner, &hdr->sent_by.host);
 2338|       |
 2339|  4.34k|        if (*scanner->curptr==':') {
  ------------------
  |  Branch (2339:13): [True: 194, False: 4.15k]
  ------------------
 2340|    194|            pj_str_t digit;
 2341|    194|            pj_scan_get_char(scanner);
 2342|    194|            pj_scan_get(scanner, &pconst.pjsip_DIGIT_SPEC, &digit);
 2343|    194|            strtoi_validate(&digit, PJSIP_MIN_PORT, PJSIP_MAX_PORT,
  ------------------
  |  |   45|    194|#define PJSIP_MIN_PORT              0           /**< For limit checks */
  ------------------
                          strtoi_validate(&digit, PJSIP_MIN_PORT, PJSIP_MAX_PORT,
  ------------------
  |  |   46|    194|#define PJSIP_MAX_PORT              PJ_MAXUINT16/**< For limit checks */
  |  |  ------------------
  |  |  |  |   36|    194|#define PJ_MAXUINT16    0xffff
  |  |  ------------------
  ------------------
 2344|    194|                            &hdr->sent_by.port);
 2345|    194|        }
 2346|       |        
 2347|  4.34k|        int_parse_via_param(hdr, scanner, ctx->pool);
 2348|       |
 2349|  4.34k|        if (*scanner->curptr == '(') {
  ------------------
  |  Branch (2349:13): [True: 197, False: 4.14k]
  ------------------
 2350|    197|            pj_scan_get_char(scanner);
 2351|    197|            pj_scan_get_until_ch( scanner, ')', &hdr->comment);
 2352|    197|            pj_scan_get_char( scanner );
 2353|    197|        }
 2354|       |
 2355|  4.34k|        if (*scanner->curptr != ',')
  ------------------
  |  Branch (2355:13): [True: 1.30k, False: 3.04k]
  ------------------
 2356|  1.30k|            break;
 2357|       |
 2358|  3.04k|        pj_scan_get_char(scanner);
 2359|       |
 2360|  3.04k|    } while (1);
  ------------------
  |  Branch (2360:14): [Folded - Ignored]
  ------------------
 2361|       |
 2362|      0|    parse_hdr_end(scanner);
 2363|       |
 2364|  4.05k|    if (ctx->rdata && ctx->rdata->msg_info.via == NULL)
  ------------------
  |  Branch (2364:9): [True: 0, False: 4.05k]
  |  Branch (2364:23): [True: 0, False: 0]
  ------------------
 2365|      0|        ctx->rdata->msg_info.via = first;
 2366|       |
 2367|  4.05k|    return (pjsip_hdr*)first;
 2368|  4.05k|}
sip_parser.c:parse_sip_version:
  990|  8.63k|{
  991|  8.63k|    pj_str_t SIP = { "SIP", 3 };
  992|  8.63k|    pj_str_t V2 = { "2.0", 3 };
  993|  8.63k|    pj_str_t sip, version;
  994|       |
  995|  8.63k|    pj_scan_get( scanner, &pconst.pjsip_ALPHA_SPEC, &sip);
  996|  8.63k|    if (pj_scan_get_char(scanner) != '/')
  ------------------
  |  Branch (996:9): [True: 235, False: 8.40k]
  ------------------
  997|    235|        on_syntax_error(scanner);
  998|  8.63k|    pj_scan_get_n( scanner, 3, &version);
  999|  8.63k|    if (pj_stricmp(&sip, &SIP) || pj_stricmp(&version, &V2))
  ------------------
  |  Branch (999:9): [True: 2.47k, False: 6.15k]
  |  Branch (999:35): [True: 229, False: 5.92k]
  ------------------
 1000|  1.23k|        on_syntax_error(scanner);
 1001|  8.63k|}
sip_parser.c:int_parse_via_param:
 2174|  1.66k|{
 2175|  6.16k|    while ( *scanner->curptr == ';' ) {
  ------------------
  |  Branch (2175:13): [True: 4.50k, False: 1.66k]
  ------------------
 2176|  4.50k|        pj_str_t pname, pvalue;
 2177|       |
 2178|       |        //Parse with PARAM_CHAR instead, to allow IPv6
 2179|       |        //No, back to using int_parse_param() for the "`" character!
 2180|       |        //int_parse_param( scanner, pool, &pname, &pvalue, 0);
 2181|       |        //parse_param_imp(scanner, pool, &pname, &pvalue, 
 2182|       |        //              &pconst.pjsip_TOKEN_SPEC,
 2183|       |        //              &pconst.pjsip_TOKEN_SPEC_ESC, 0);
 2184|       |        //int_parse_param(scanner, pool, &pname, &pvalue, 0);
 2185|       |        // This should be the correct one:
 2186|       |        //  added special spec for Via parameter, basically token plus
 2187|       |        //  ":" to allow IPv6 address in the received param.
 2188|  4.50k|        pj_scan_get_char(scanner);
 2189|  4.50k|        parse_param_imp(scanner, pool, &pname, &pvalue,
 2190|  4.50k|                        &pconst.pjsip_VIA_PARAM_SPEC,
 2191|       |                        // Token does not need to be unescaped.
 2192|       |                        // Refer to PR #2933.
 2193|       |                        // &pconst.pjsip_VIA_PARAM_SPEC_ESC,
 2194|  4.50k|                        NULL,
 2195|  4.50k|                        0);
 2196|       |
 2197|  4.50k|        if (!parser_stricmp(pname, pconst.pjsip_BRANCH_STR) && pvalue.slen) {
  ------------------
  |  |  207|  9.00k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|    608|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 3.89k, False: 608]
  |  |  |  Branch (207:54): [True: 217, False: 391]
  |  |  ------------------
  ------------------
  |  Branch (2197:64): [True: 197, False: 194]
  ------------------
 2198|    197|            hdr->branch_param = pvalue;
 2199|       |
 2200|  4.30k|        } else if (!parser_stricmp(pname, pconst.pjsip_TTL_STR) && pvalue.slen) {
  ------------------
  |  |  207|  8.61k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|    626|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 3.68k, False: 626]
  |  |  |  Branch (207:54): [True: 210, False: 416]
  |  |  ------------------
  ------------------
  |  Branch (2200:68): [True: 220, False: 196]
  ------------------
 2201|    220|            strtoi_validate(&pvalue, PJSIP_MIN_TTL, PJSIP_MAX_TTL,
  ------------------
  |  |   47|    220|#define PJSIP_MIN_TTL               0           /**< For limit checks */
  ------------------
                          strtoi_validate(&pvalue, PJSIP_MIN_TTL, PJSIP_MAX_TTL,
  ------------------
  |  |   48|    220|#define PJSIP_MAX_TTL               PJ_MAXUINT8 /**< For limit checks */
  |  |  ------------------
  |  |  |  |   39|    220|#define PJ_MAXUINT8     0xff
  |  |  ------------------
  ------------------
 2202|    220|                            &hdr->ttl_param);
 2203|       |            
 2204|  4.08k|        } else if (!parser_stricmp(pname, pconst.pjsip_MADDR_STR) && pvalue.slen) {
  ------------------
  |  |  207|  8.17k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|  1.23k|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 2.85k, False: 1.23k]
  |  |  |  Branch (207:54): [True: 839, False: 398]
  |  |  ------------------
  ------------------
  |  Branch (2204:70): [True: 204, False: 194]
  ------------------
 2205|    204|            hdr->maddr_param = pvalue;
 2206|       |
 2207|  3.88k|        } else if (!parser_stricmp(pname, pconst.pjsip_RECEIVED_STR) && pvalue.slen) {
  ------------------
  |  |  207|  7.76k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|    609|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 3.27k, False: 609]
  |  |  |  Branch (207:54): [True: 210, False: 399]
  |  |  ------------------
  ------------------
  |  Branch (2207:73): [True: 205, False: 194]
  ------------------
 2208|    205|            hdr->recvd_param = pvalue;
 2209|       |
 2210|  3.67k|        } else if (!parser_stricmp(pname, pconst.pjsip_RPORT_STR)) {
  ------------------
  |  |  207|  3.67k|#define parser_stricmp(s1, s2)  (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2))
  |  |  ------------------
  |  |  |  |  408|  1.03k|#define pj_stricmp_alnum    pj_stricmp
  |  |  ------------------
  |  |  |  Branch (207:34): [True: 2.64k, False: 1.03k]
  |  |  |  Branch (207:54): [True: 285, False: 748]
  |  |  ------------------
  ------------------
 2211|    748|            if (pvalue.slen) {
  ------------------
  |  Branch (2211:17): [True: 538, False: 210]
  ------------------
 2212|    538|                strtoi_validate(&pvalue, PJSIP_MIN_PORT, PJSIP_MAX_PORT,
  ------------------
  |  |   45|    538|#define PJSIP_MIN_PORT              0           /**< For limit checks */
  ------------------
                              strtoi_validate(&pvalue, PJSIP_MIN_PORT, PJSIP_MAX_PORT,
  ------------------
  |  |   46|    538|#define PJSIP_MAX_PORT              PJ_MAXUINT16/**< For limit checks */
  |  |  ------------------
  |  |  |  |   36|    538|#define PJ_MAXUINT16    0xffff
  |  |  ------------------
  ------------------
 2213|    538|                                &hdr->rport_param);
 2214|    538|            } else
 2215|    210|                hdr->rport_param = 0;
 2216|  2.93k|        } else {
 2217|  2.93k|            pjsip_param *p = PJ_POOL_ALLOC_T(pool, pjsip_param);
  ------------------
  |  |  506|  2.93k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
 2218|  2.93k|            p->name = pname;
 2219|  2.93k|            p->value = pvalue;
 2220|  2.93k|            pj_list_insert_before(&hdr->other_param, p);
 2221|  2.93k|        }
 2222|  4.50k|    }
 2223|  1.66k|}
sip_parser.c:int_register_parser:
  610|   260k|{
  611|   260k|    unsigned    pos;
  612|   260k|    handler_rec rec;
  613|       |
  614|   260k|    if (handler_count >= PJ_ARRAY_SIZE(handler)) {
  ------------------
  |  |  294|   260k|#define PJ_ARRAY_SIZE(a)    (sizeof(a)/sizeof(a[0]))
  ------------------
  |  Branch (614:9): [True: 0, False: 260k]
  ------------------
  615|      0|        pj_assert(!"Too many handlers!");
  ------------------
  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  ------------------
  616|      0|        return PJ_ETOOMANY;
  ------------------
  |  |  363|      0|#define PJ_ETOOMANY         (PJ_ERRNO_START_STATUS + 10)/* 70010 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  617|      0|    }
  618|       |
  619|       |    /* Initialize temporary handler. */
  620|   260k|    rec.handler = fptr;
  621|   260k|    rec.hname_len = strlen(name);
  622|   260k|    if (rec.hname_len >= sizeof(rec.hname)) {
  ------------------
  |  Branch (622:9): [True: 0, False: 260k]
  ------------------
  623|      0|        pj_assert(!"Header name is too long!");
  ------------------
  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  ------------------
  624|      0|        return PJ_ENAMETOOLONG;
  ------------------
  |  |  338|      0|#define PJ_ENAMETOOLONG     (PJ_ERRNO_START_STATUS + 5) /* 70005 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  625|      0|    }
  626|       |    /* Copy name. */
  627|   260k|    pj_memcpy(rec.hname, name, rec.hname_len);
  628|   260k|    rec.hname[rec.hname_len] = '\0';
  629|       |
  630|       |    /* Calculate hash value. */
  631|   260k|    rec.hname_hash = pj_hash_calc(0, rec.hname, (unsigned)rec.hname_len);
  632|       |
  633|       |    /* Get the pos to insert the new handler. */
  634|  3.72M|    for (pos=0; pos < handler_count; ++pos) {
  ------------------
  |  Branch (634:17): [True: 3.71M, False: 14.4k]
  ------------------
  635|  3.71M|        int d;
  636|  3.71M|        d = compare_handler(&handler[pos], rec.hname, rec.hname_len, 
  637|  3.71M|                            rec.hname_hash);
  638|  3.71M|        if (d == 0) {
  ------------------
  |  Branch (638:13): [True: 0, False: 3.71M]
  ------------------
  639|      0|            pj_assert(0);
  ------------------
  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  ------------------
  640|      0|            return PJ_EEXISTS;
  ------------------
  |  |  388|      0|#define PJ_EEXISTS          (PJ_ERRNO_START_STATUS + 15)/* 70015 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  641|      0|        }
  642|  3.71M|        if (d > 0) {
  ------------------
  |  Branch (642:13): [True: 246k, False: 3.46M]
  ------------------
  643|   246k|            break;
  644|   246k|        }
  645|  3.71M|    }
  646|       |
  647|       |    /* Shift handlers. */
  648|   260k|    if (pos != handler_count) {
  ------------------
  |  Branch (648:9): [True: 246k, False: 14.4k]
  ------------------
  649|   246k|        pj_memmove( &handler[pos+1], &handler[pos], 
  650|   246k|                    (handler_count-pos)*sizeof(handler_rec));
  651|   246k|    }
  652|       |    /* Add new handler. */
  653|   260k|    pj_memcpy( &handler[pos], &rec, sizeof(handler_rec));
  654|   260k|    ++handler_count;
  655|       |
  656|   260k|    return PJ_SUCCESS;
  657|   260k|}
sip_parser.c:compare_handler:
  588|  4.20M|{
  589|  4.20M|    PJ_UNUSED_ARG(name_len);
  ------------------
  |  | 1433|  4.20M|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  590|       |
  591|       |    /* Compare hashed value. */
  592|  4.20M|    if (r1->hname_hash < hash)
  ------------------
  |  Branch (592:9): [True: 3.51M, False: 687k]
  ------------------
  593|  3.51M|        return -1;
  594|   687k|    if (r1->hname_hash > hash)
  ------------------
  |  Branch (594:9): [True: 628k, False: 59.1k]
  ------------------
  595|   628k|        return 1;
  596|       |
  597|       |    /* Compare length. */
  598|  59.1k|    if (r1->hname_len < name_len)
  ------------------
  |  Branch (598:9): [True: 403, False: 58.7k]
  ------------------
  599|    403|        return -1;
  600|  58.7k|    if (r1->hname_len > name_len)
  ------------------
  |  Branch (600:9): [True: 389, False: 58.3k]
  ------------------
  601|    389|        return 1;
  602|       |
  603|       |    /* Equal length and equal hash. compare the strings. */
  604|  58.3k|    return pj_memcmp(r1->hname, name, name_len);
  605|  58.7k|}
sip_parser.c:on_syntax_error:
  228|  13.2k|{
  229|  13.2k|    PJ_UNUSED_ARG(scanner);
  ------------------
  |  | 1433|  13.2k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  230|  13.2k|    PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|  13.2k|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
  231|  13.2k|}
sip_parser.c:strtoi_validate:
  264|  11.1k|{ 
  265|  11.1k|    long retval;
  266|  11.1k|    pj_status_t status;
  267|       |
  268|  11.1k|    if (!str || !value) {
  ------------------
  |  Branch (268:9): [True: 0, False: 11.1k]
  |  Branch (268:17): [True: 0, False: 11.1k]
  ------------------
  269|      0|        on_str_parse_error(str, PJ_EINVAL);
  ------------------
  |  |  333|      0|#define PJ_EINVAL           (PJ_ERRNO_START_STATUS + 4) /* 70004 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  270|      0|        return;
  271|      0|    }
  272|  11.1k|    status = pj_strtol2(str, &retval);
  273|  11.1k|    if (status != PJ_EINVAL) {
  ------------------
  |  |  333|  11.1k|#define PJ_EINVAL           (PJ_ERRNO_START_STATUS + 4) /* 70004 */
  |  |  ------------------
  |  |  |  |  456|  11.1k|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|  11.1k|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|  11.1k|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (273:9): [True: 10.2k, False: 864]
  ------------------
  274|  10.2k|        if (min_val > retval) {
  ------------------
  |  Branch (274:13): [True: 882, False: 9.40k]
  ------------------
  275|    882|            *value = min_val;
  276|    882|            status = PJ_ETOOSMALL;
  ------------------
  |  |  409|    882|#define PJ_ETOOSMALL        (PJ_ERRNO_START_STATUS + 19)/* 70019 */
  |  |  ------------------
  |  |  |  |  456|    882|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|    882|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|    882|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  277|  9.40k|        } else if (retval > max_val) {
  ------------------
  |  Branch (277:20): [True: 1.04k, False: 8.35k]
  ------------------
  278|  1.04k|            *value = max_val;
  279|  1.04k|            status = PJ_ETOOBIG;
  ------------------
  |  |  398|  1.04k|#define PJ_ETOOBIG          (PJ_ERRNO_START_STATUS + 17)/* 70017 */
  |  |  ------------------
  |  |  |  |  456|  1.04k|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|  1.04k|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|  1.04k|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  280|  1.04k|        } else
  281|  8.35k|            *value = (int)retval;
  282|  10.2k|    }
  283|       |
  284|  11.1k|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (284:9): [True: 2.79k, False: 8.35k]
  ------------------
  285|  2.79k|        on_str_parse_error(str, status);
  286|  11.1k|}
sip_parser.c:on_str_parse_error:
  235|  2.79k|{
  236|  2.79k|    char *s;
  237|       |
  238|  2.79k|    switch(rc) {
  239|    864|    case PJ_EINVAL:
  ------------------
  |  |  333|    864|#define PJ_EINVAL           (PJ_ERRNO_START_STATUS + 4) /* 70004 */
  |  |  ------------------
  |  |  |  |  456|    864|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|    864|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|    864|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (239:5): [True: 864, False: 1.93k]
  ------------------
  240|    864|        s = "NULL input string, invalid input string, or NULL return "\
  241|    864|            "value pointer";
  242|    864|        break;
  243|    882|    case PJ_ETOOSMALL:
  ------------------
  |  |  409|    882|#define PJ_ETOOSMALL        (PJ_ERRNO_START_STATUS + 19)/* 70019 */
  |  |  ------------------
  |  |  |  |  456|    882|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|    882|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|    882|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (243:5): [True: 882, False: 1.91k]
  ------------------
  244|    882|        s = "String value was less than the minimum allowed value.";
  245|    882|        break;
  246|  1.04k|    case PJ_ETOOBIG:
  ------------------
  |  |  398|  1.04k|#define PJ_ETOOBIG          (PJ_ERRNO_START_STATUS + 17)/* 70017 */
  |  |  ------------------
  |  |  |  |  456|  1.04k|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|  1.04k|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|  1.04k|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (246:5): [True: 1.04k, False: 1.74k]
  ------------------
  247|  1.04k|        s = "String value was greater than the maximum allowed value.";
  248|  1.04k|        break;
  249|      0|    default:
  ------------------
  |  Branch (249:5): [True: 0, False: 2.79k]
  ------------------
  250|      0|        s = "Unknown error";
  251|  2.79k|    }
  252|       |
  253|  2.79k|    if (str) {
  ------------------
  |  Branch (253:9): [True: 2.79k, False: 0]
  ------------------
  254|  2.79k|        PJ_LOG(1, (THIS_FILE, "Error parsing '%.*s': %s",
  ------------------
  |  |  106|  2.79k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  2.79k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 2.79k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  2.79k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  255|  2.79k|                   (int)str->slen, str->ptr, s));
  256|  2.79k|    } else {
  257|      0|        PJ_LOG(1, (THIS_FILE, "Can't parse input string: %s", s));
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  258|      0|    }
  259|  2.79k|    PJ_THROW(PJSIP_EINVAL_ERR_EXCEPTION);
  ------------------
  |  |  402|  2.79k|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
  260|  2.79k|}
sip_parser.c:int_parse_msg:
 1021|  4.82k|{
 1022|       |    /* These variables require "volatile" so their values get
 1023|       |     * preserved when re-entering the PJ_TRY block after an error.
 1024|       |     */
 1025|  4.82k|    volatile pj_bool_t parsing_headers;
 1026|  4.82k|    pjsip_msg *volatile msg = NULL;
 1027|  4.82k|    pjsip_ctype_hdr *volatile ctype_hdr = NULL;
 1028|       |
 1029|  4.82k|    pj_str_t hname;
 1030|  4.82k|    pj_scanner *scanner = ctx->scanner;
 1031|  4.82k|    pj_pool_t *pool = ctx->pool;
 1032|  4.82k|    PJ_USE_EXCEPTION;
  ------------------
  |  |  367|  4.82k|#define PJ_USE_EXCEPTION    struct pj_exception_state_t pj_x_except__; int pj_x_code__
  ------------------
 1033|       |
 1034|  4.82k|    parsing_headers = PJ_FALSE;
 1035|       |
 1036|  30.4k|retry_parse:
 1037|  30.4k|    PJ_TRY 
  ------------------
  |  |  373|  30.4k|#define PJ_TRY              if (1) { \
  |  |  ------------------
  |  |  |  Branch (373:33): [Folded - Ignored]
  |  |  ------------------
  |  |  374|  30.4k|                                pj_push_exception_handler_(&pj_x_except__); \
  |  |  375|  30.4k|                                pj_x_code__ = pj_setjmp(pj_x_except__.state); \
  |  |  ------------------
  |  |  |  |   31|  30.4k|#    define pj_setjmp(buf)      setjmp(buf)
  |  |  ------------------
  |  |  376|  30.4k|                                if (pj_x_code__ == 0)
  |  |  ------------------
  |  |  |  Branch (376:37): [True: 30.4k, False: 0]
  |  |  ------------------
  ------------------
 1038|  30.4k|    {
 1039|  30.4k|        if (parsing_headers)
  ------------------
  |  Branch (1039:13): [True: 25.6k, False: 4.82k]
  ------------------
 1040|  25.6k|            goto parse_headers;
 1041|       |
 1042|       |        /* Skip leading newlines. */
 1043|  5.59k|        while (IS_NEWLINE(*scanner->curptr)) {
  ------------------
  |  |   62|  5.59k|#define IS_NEWLINE(c)   ((c)=='\r' || (c)=='\n')
  |  |  ------------------
  |  |  |  Branch (62:26): [True: 390, False: 5.20k]
  |  |  |  Branch (62:39): [True: 381, False: 4.82k]
  |  |  ------------------
  ------------------
 1044|    771|            pj_scan_get_newline(scanner);
 1045|    771|        }
 1046|       |
 1047|       |        /* Check if we still have valid packet.
 1048|       |         * Sometimes endpoints just send blank (CRLF) packets just to keep
 1049|       |         * NAT bindings open.
 1050|       |         */
 1051|  4.82k|        if (pj_scan_is_eof(scanner))
  ------------------
  |  Branch (1051:13): [True: 28, False: 4.79k]
  ------------------
 1052|     28|            return NULL;
 1053|       |
 1054|       |        /* Parse request or status line */
 1055|  4.79k|        if (is_next_sip_version(scanner)) {
  ------------------
  |  Branch (1055:13): [True: 3.56k, False: 1.23k]
  ------------------
 1056|  3.56k|            msg = pjsip_msg_create(pool, PJSIP_RESPONSE_MSG);
 1057|  3.56k|            int_parse_status_line( scanner, &msg->line.status );
 1058|  3.56k|        } else {
 1059|  1.23k|            msg = pjsip_msg_create(pool, PJSIP_REQUEST_MSG);
 1060|  1.23k|            int_parse_req_line(scanner, pool, &msg->line.req );
 1061|  1.23k|        }
 1062|       |
 1063|  4.79k|        parsing_headers = PJ_TRUE;
 1064|       |
 1065|  28.9k|parse_headers:
 1066|       |        /* Parse headers. */
 1067|  55.5k|        do {
 1068|  55.5k|            pjsip_parse_hdr_func * func;
 1069|  55.5k|            pjsip_hdr *hdr = NULL;
 1070|       |
 1071|       |            /* Init hname just in case parsing fails.
 1072|       |             * Ref: PROTOS #2412
 1073|       |             */
 1074|  55.5k|            hname.slen = 0;
 1075|       |            
 1076|       |            /* Get hname. */
 1077|  55.5k|            pj_scan_get( scanner, &pconst.pjsip_TOKEN_SPEC, &hname);
 1078|  55.5k|            if (pj_scan_get_char( scanner ) != ':') {
  ------------------
  |  Branch (1078:17): [True: 771, False: 54.8k]
  ------------------
 1079|    771|                PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|    771|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
 1080|    771|            }
 1081|       |            
 1082|       |            /* Find handler. */
 1083|  54.8k|            func = find_handler(&hname);
 1084|       |            
 1085|       |            /* Call the handler if found.
 1086|       |             * If no handler is found, then treat the header as generic
 1087|       |             * hname/hvalue pair.
 1088|       |             */
 1089|  54.8k|            if (func) {
  ------------------
  |  Branch (1089:17): [True: 50.8k, False: 3.95k]
  ------------------
 1090|  50.8k|                hdr = (*func)(ctx);
 1091|       |
 1092|       |                /* Note:
 1093|       |                 *  hdr MAY BE NULL, if parsing does not yield a new header
 1094|       |                 *  instance, e.g. the values have been added to existing
 1095|       |                 *  header. See https://github.com/pjsip/pjproject/issues/940
 1096|       |                 */
 1097|       |
 1098|       |                /* Check if we've just parsed a Content-Type header. 
 1099|       |                 * We will check for a message body if we've got Content-Type 
 1100|       |                 * header.
 1101|       |                 */
 1102|  50.8k|                if (hdr && hdr->type == PJSIP_H_CONTENT_TYPE) {
  ------------------
  |  Branch (1102:21): [True: 26.9k, False: 23.9k]
  |  Branch (1102:28): [True: 1.73k, False: 25.2k]
  ------------------
 1103|  1.73k|                    ctype_hdr = (pjsip_ctype_hdr*)hdr;
 1104|  1.73k|                }
 1105|       |
 1106|  50.8k|            } else {
 1107|  3.95k|                hdr = parse_hdr_generic_string(ctx);
 1108|  3.95k|                hdr->name = hdr->sname = hname;
 1109|  3.95k|            }
 1110|       |            
 1111|       |            /* Single parse of header line can produce multiple headers.
 1112|       |             * For example, if one Contact: header contains Contact list
 1113|       |             * separated by comma, then these Contacts will be split into
 1114|       |             * different Contact headers.
 1115|       |             * So here we must insert list instead of just insert one header.
 1116|       |             */
 1117|  54.8k|            if (hdr)
  ------------------
  |  Branch (1117:17): [True: 28.9k, False: 25.8k]
  ------------------
 1118|  28.9k|                pj_list_insert_nodes_before(&msg->hdr, hdr);
 1119|       |            
 1120|       |            /* Parse until EOF or an empty line is found. */
 1121|  54.8k|        } while (!pj_scan_is_eof(scanner) && !IS_NEWLINE(*scanner->curptr));
  ------------------
  |  |   62|  27.5k|#define IS_NEWLINE(c)   ((c)=='\r' || (c)=='\n')
  |  |  ------------------
  |  |  |  Branch (62:26): [True: 33, False: 27.5k]
  |  |  |  Branch (62:39): [True: 918, False: 26.6k]
  |  |  ------------------
  ------------------
  |  Branch (1121:18): [True: 27.5k, False: 27.2k]
  ------------------
 1122|       |        
 1123|  28.2k|        parsing_headers = PJ_FALSE;
 1124|       |
 1125|       |        /* If empty line is found, eat it. */
 1126|  28.2k|        if (!pj_scan_is_eof(scanner)) {
  ------------------
  |  Branch (1126:13): [True: 951, False: 27.2k]
  ------------------
 1127|    951|            if (IS_NEWLINE(*scanner->curptr)) {
  ------------------
  |  |   62|    951|#define IS_NEWLINE(c)   ((c)=='\r' || (c)=='\n')
  |  |  ------------------
  |  |  |  Branch (62:26): [True: 33, False: 918]
  |  |  |  Branch (62:39): [True: 918, False: 0]
  |  |  ------------------
  ------------------
 1128|    951|                pj_scan_get_newline(scanner);
 1129|    951|            }
 1130|    951|        }
 1131|       |
 1132|       |        /* If we have Content-Type header, treat the rest of the message 
 1133|       |         * as body.
 1134|       |         */
 1135|  28.2k|        if (ctype_hdr && scanner->curptr!=scanner->end) {
  ------------------
  |  Branch (1135:13): [True: 979, False: 27.2k]
  |  Branch (1135:26): [True: 936, False: 43]
  ------------------
 1136|       |            /* New: if Content-Type indicates that this is a multipart
 1137|       |             * message body, parse it.
 1138|       |             */
 1139|    936|            const pj_str_t STR_MULTIPART = { "multipart", 9 };
 1140|    936|            pjsip_msg_body *body;
 1141|       |
 1142|    936|            if (pj_stricmp(&ctype_hdr->media.type, &STR_MULTIPART)==0) {
  ------------------
  |  Branch (1142:17): [True: 845, False: 91]
  ------------------
 1143|    845|                body = pjsip_multipart_parse(pool, scanner->curptr,
 1144|    845|                                             scanner->end - scanner->curptr,
 1145|    845|                                             &ctype_hdr->media, 0);
 1146|    845|            } else {
 1147|     91|                body = PJ_POOL_ALLOC_T(pool, pjsip_msg_body);
  ------------------
  |  |  506|     91|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
 1148|     91|                pjsip_media_type_cp(pool, &body->content_type,
 1149|     91|                                    &ctype_hdr->media);
 1150|       |
 1151|     91|                body->data = scanner->curptr;
 1152|     91|                body->len = (unsigned)(scanner->end - scanner->curptr);
 1153|     91|                body->print_body = &pjsip_print_text_body;
 1154|     91|                body->clone_data = &pjsip_clone_text_data;
 1155|     91|            }
 1156|       |
 1157|    936|            msg->body = body;
 1158|    936|        }
 1159|  28.2k|    }
 1160|      0|    PJ_CATCH_ANY 
 1161|      0|    {
 1162|       |        /* Exception was thrown during parsing. 
 1163|       |         * Skip until newline, and parse next header. 
 1164|       |         */
 1165|  28.0k|        if (err_list) {
  ------------------
  |  Branch (1165:13): [True: 28.0k, False: 18.4E]
  ------------------
 1166|  28.0k|            pjsip_parser_err_report *err_info;
 1167|       |            
 1168|  28.0k|            err_info = PJ_POOL_ALLOC_T(pool, pjsip_parser_err_report);
  ------------------
  |  |  506|  28.0k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
 1169|  28.0k|            err_info->except_code = PJ_GET_EXCEPTION();
  ------------------
  |  |  409|  28.0k|#define PJ_GET_EXCEPTION()      (pj_x_code__)
  ------------------
 1170|  28.0k|            err_info->line = scanner->line;
 1171|       |            /* Scanner's column is zero based, so add 1 */
 1172|  28.0k|            err_info->col = pj_scan_get_col(scanner) + 1;
 1173|  28.0k|            if (parsing_headers)
  ------------------
  |  Branch (1173:17): [True: 26.6k, False: 1.41k]
  ------------------
 1174|  26.6k|                err_info->hname = hname;
 1175|  1.41k|            else if (msg && msg->type == PJSIP_REQUEST_MSG)
  ------------------
  |  Branch (1175:22): [True: 1.41k, False: 0]
  |  Branch (1175:29): [True: 1.11k, False: 302]
  ------------------
 1176|  1.11k|                err_info->hname = pj_str("Request Line");
 1177|    302|            else if (msg && msg->type == PJSIP_RESPONSE_MSG)
  ------------------
  |  Branch (1177:22): [True: 302, False: 0]
  |  Branch (1177:29): [True: 302, False: 0]
  ------------------
 1178|    302|                err_info->hname = pj_str("Status Line");
 1179|      0|            else
 1180|      0|                err_info->hname.slen = 0;
 1181|       |            
 1182|  28.0k|            pj_list_insert_before(err_list, err_info);
 1183|  28.0k|        }
 1184|       |        
 1185|  26.6k|        if (parsing_headers) {
  ------------------
  |  Branch (1185:13): [True: 26.6k, False: 18.4E]
  ------------------
 1186|  26.6k|            if (!pj_scan_is_eof(scanner)) {
  ------------------
  |  Branch (1186:17): [True: 26.0k, False: 596]
  ------------------
 1187|       |                /* Skip until next line.
 1188|       |                 * Watch for header continuation.
 1189|       |                 */
 1190|  26.2k|                do {
 1191|  26.2k|                    pj_scan_skip_line(scanner);
 1192|  26.2k|                } while (IS_SPACE(*scanner->curptr));
  ------------------
  |  |   63|  26.2k|#define IS_SPACE(c)     ((c)==' ' || (c)=='\t')
  |  |  ------------------
  |  |  |  Branch (63:26): [True: 213, False: 26.0k]
  |  |  |  Branch (63:38): [True: 2, False: 26.0k]
  |  |  ------------------
  ------------------
 1193|  26.0k|            }
 1194|       |
 1195|       |            /* Restore flag. Flag may be set in int_parse_sip_url() */
 1196|  26.6k|            scanner->skip_ws = PJ_SCAN_AUTOSKIP_WS_HEADER;
 1197|       |
 1198|       |            /* Continue parse next header, if any. */
 1199|  26.6k|            if (!pj_scan_is_eof(scanner) && !IS_NEWLINE(*scanner->curptr)) {
  ------------------
  |  |   62|  25.6k|#define IS_NEWLINE(c)   ((c)=='\r' || (c)=='\n')
  |  |  ------------------
  |  |  |  Branch (62:26): [True: 1, False: 25.6k]
  |  |  |  Branch (62:39): [True: 1, False: 25.6k]
  |  |  ------------------
  ------------------
  |  Branch (1199:17): [True: 25.6k, False: 999]
  ------------------
 1200|  25.6k|                goto retry_parse;
 1201|  25.6k|            }
 1202|  26.6k|        }
 1203|       |
 1204|  18.4E|        msg = NULL;
 1205|  18.4E|    }
 1206|  2.61k|    PJ_END;
  ------------------
  |  |  394|  2.61k|#define PJ_END                  pj_pop_exception_handler_(&pj_x_except__); \
  |  |  395|  2.61k|                            } else {}
  ------------------
 1207|       |
 1208|  2.61k|    return msg;
 1209|  30.4k|}
sip_parser.c:is_next_sip_version:
 1004|  4.79k|{
 1005|  4.79k|    pj_str_t SIP = { "SIP", 3 };
 1006|  4.79k|    pj_str_t sip;
 1007|  4.79k|    int c;
 1008|       |
 1009|  4.79k|    c = pj_scan_peek(scanner, &pconst.pjsip_ALPHA_SPEC, &sip);
 1010|       |    /* return TRUE if it is "SIP" followed by "/" or space.
 1011|       |     * we include space since the "/" may be separated by space,
 1012|       |     * although this would mean it would return TRUE if it is a
 1013|       |     * request and the method is "SIP"!
 1014|       |     */
 1015|  4.79k|    return c && (c=='/' || c==' ' || c=='\t') && pj_stricmp(&sip, &SIP)==0;
  ------------------
  |  Branch (1015:12): [True: 4.78k, False: 8]
  |  Branch (1015:18): [True: 3.55k, False: 1.23k]
  |  Branch (1015:28): [True: 953, False: 277]
  |  Branch (1015:38): [True: 3, False: 274]
  |  Branch (1015:50): [True: 3.56k, False: 954]
  ------------------
 1016|  4.79k|}
sip_parser.c:int_parse_req_line:
 1675|  1.23k|{
 1676|  1.23k|    pj_str_t token;
 1677|       |
 1678|  1.23k|    pj_scan_get( scanner, &pconst.pjsip_TOKEN_SPEC, &token);
 1679|  1.23k|    pjsip_method_init_np( &req_line->method, &token);
 1680|       |
 1681|  1.23k|    req_line->uri = int_parse_uri(scanner, pool, PJ_TRUE);
 1682|  1.23k|    parse_sip_version(scanner);
 1683|  1.23k|    pj_scan_get_newline( scanner );
 1684|  1.23k|}
sip_parser.c:parse_param_imp:
 1217|  24.7k|{
 1218|       |    /* pname */
 1219|  24.7k|    if (!esc_spec) {
  ------------------
  |  Branch (1219:9): [True: 17.8k, False: 6.85k]
  ------------------
 1220|  17.8k|        pj_scan_get(scanner, spec, pname);
 1221|  17.8k|    } else {
 1222|  6.85k|        parser_get_and_unescape(scanner, pool, spec, esc_spec, pname);
 1223|  6.85k|    }
 1224|       |
 1225|       |    /* init pvalue */
 1226|  24.7k|    pvalue->ptr = NULL;
 1227|  24.7k|    pvalue->slen = 0;
 1228|       |
 1229|       |    /* pvalue, if any */
 1230|  24.7k|    if (*scanner->curptr == '=') {
  ------------------
  |  Branch (1230:9): [True: 11.2k, False: 13.4k]
  ------------------
 1231|  11.2k|        pj_scan_get_char(scanner);
 1232|  11.2k|        if (!pj_scan_is_eof(scanner)) {
  ------------------
  |  Branch (1232:13): [True: 11.2k, False: 6]
  ------------------
 1233|       |            /* pvalue can be a quoted string. */
 1234|  11.2k|            if (*scanner->curptr == '"') {
  ------------------
  |  Branch (1234:17): [True: 1.15k, False: 10.0k]
  ------------------
 1235|  1.15k|                pj_scan_get_quote( scanner, '"', '"', pvalue);
 1236|  1.15k|                if (option & PJSIP_PARSE_REMOVE_QUOTE) {
  ------------------
  |  Branch (1236:21): [True: 0, False: 1.15k]
  ------------------
 1237|      0|                    pvalue->ptr++;
 1238|      0|                    pvalue->slen -= 2;
 1239|      0|                }
 1240|       |            // } else if (*scanner->curptr == '[') {
 1241|       |                /* pvalue can be a quoted IPv6; in this case, the
 1242|       |                 * '[' and ']' quote characters are to be removed
 1243|       |                 * from the pvalue.
 1244|       |                 *
 1245|       |                 * Update: this seems to be unnecessary and may cause
 1246|       |                 * parsing error for cases such as IPv6 reference with
 1247|       |                 * port number.
 1248|       |                 */
 1249|       |                // pj_scan_get_char(scanner);
 1250|       |                // pj_scan_get_until_ch(scanner, ']', pvalue);
 1251|       |                // pj_scan_get_char(scanner);
 1252|  10.0k|            } else if(pj_cis_match(spec, *scanner->curptr)) {
  ------------------
  |  Branch (1252:23): [True: 9.33k, False: 760]
  ------------------
 1253|  9.33k|                if (!esc_spec) {
  ------------------
  |  Branch (1253:21): [True: 7.19k, False: 2.14k]
  ------------------
 1254|  7.19k|                    pj_scan_get(scanner, spec, pvalue);
 1255|  7.19k|                } else {
 1256|  2.14k|                    parser_get_and_unescape(scanner, pool, spec, esc_spec,
 1257|  2.14k|                                            pvalue);
 1258|  2.14k|                }
 1259|  9.33k|            }
 1260|  11.2k|        }
 1261|  11.2k|    }
 1262|  24.7k|}
sip_parser.c:int_parse_uri_or_name_addr:
 1412|  22.6k|{
 1413|  22.6k|    pjsip_uri *uri;
 1414|  22.6k|    int is_name_addr = 0;
 1415|       |
 1416|       |    /* Exhaust any whitespaces. */
 1417|  22.6k|    pj_scan_skip_whitespace(scanner);
 1418|       |
 1419|  22.6k|    if (*scanner->curptr=='"' || *scanner->curptr=='<') {
  ------------------
  |  Branch (1419:9): [True: 875, False: 21.7k]
  |  Branch (1419:34): [True: 3.27k, False: 18.4k]
  ------------------
 1420|  4.14k|        uri = (pjsip_uri*)int_parse_name_addr( scanner, pool );
 1421|  4.14k|        is_name_addr = 1;
 1422|  18.4k|    } else {
 1423|  18.4k|        pj_str_t scheme;
 1424|  18.4k|        int next_ch;
 1425|       |
 1426|  18.4k|        next_ch = pj_scan_peek( scanner, &pconst.pjsip_DISPLAY_SPEC, &scheme);
 1427|       |
 1428|  18.4k|        if (next_ch==':') {
  ------------------
  |  Branch (1428:13): [True: 4.94k, False: 13.5k]
  ------------------
 1429|  4.94k|            pjsip_parse_uri_func *func = find_uri_handler(&scheme);
 1430|       |
 1431|  4.94k|            if (func == NULL) {
  ------------------
  |  Branch (1431:17): [True: 0, False: 4.94k]
  ------------------
 1432|       |                /* Unsupported URI scheme */
 1433|      0|                PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|      0|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
 1434|      0|            }
 1435|       |
 1436|  4.94k|            uri = (pjsip_uri*)
 1437|  4.94k|                  (*func)(scanner, pool, 
 1438|  4.94k|                          (opt & PJSIP_PARSE_URI_IN_FROM_TO_HDR)==0);
 1439|       |
 1440|       |
 1441|  13.5k|        } else {
 1442|  13.5k|            uri = (pjsip_uri*)int_parse_name_addr( scanner, pool );
 1443|  13.5k|            is_name_addr = 1;
 1444|  13.5k|        }
 1445|  18.4k|    }
 1446|       |
 1447|       |    /* Should we return the URI object as name address? */
 1448|  22.6k|    if (opt & PJSIP_PARSE_URI_AS_NAMEADDR) {
  ------------------
  |  Branch (1448:9): [True: 5.07k, False: 17.5k]
  ------------------
 1449|  5.07k|        if (is_name_addr == 0) {
  ------------------
  |  Branch (1449:13): [True: 2.71k, False: 2.35k]
  ------------------
 1450|  2.71k|            pjsip_name_addr *name_addr;
 1451|       |
 1452|  2.71k|            name_addr = pjsip_name_addr_create(pool);
 1453|  2.71k|            name_addr->uri = uri;
 1454|       |
 1455|  2.71k|            uri = (pjsip_uri*)name_addr;
 1456|  2.71k|        }
 1457|  5.07k|    }
 1458|       |
 1459|  22.6k|    return uri;
 1460|  22.6k|}
sip_parser.c:int_parse_status_line:
 1689|  3.56k|{
 1690|  3.56k|    pj_str_t token;
 1691|       |
 1692|  3.56k|    parse_sip_version(scanner);
 1693|  3.56k|    pj_scan_get( scanner, &pconst.pjsip_DIGIT_SPEC, &token);
 1694|  3.56k|    strtoi_validate(&token, PJSIP_MIN_STATUS_CODE, PJSIP_MAX_STATUS_CODE,
  ------------------
  |  |   49|  3.56k|#define PJSIP_MIN_STATUS_CODE       100         /**< For limit checks */
  ------------------
                  strtoi_validate(&token, PJSIP_MIN_STATUS_CODE, PJSIP_MAX_STATUS_CODE,
  ------------------
  |  |   50|  3.56k|#define PJSIP_MAX_STATUS_CODE       999         /**< For limit checks */
  ------------------
 1695|  3.56k|                    &status_line->code);
 1696|  3.56k|    if (*scanner->curptr != '\r' && *scanner->curptr != '\n')
  ------------------
  |  Branch (1696:9): [True: 2.85k, False: 702]
  |  Branch (1696:37): [True: 72, False: 2.78k]
  ------------------
 1697|     72|        pj_scan_get( scanner, &pconst.pjsip_NOT_NEWLINE, &status_line->reason);
 1698|  3.48k|    else
 1699|  3.48k|        status_line->reason.slen=0, status_line->reason.ptr=NULL;
 1700|  3.56k|    pj_scan_get_newline( scanner );
 1701|  3.56k|}
sip_parser.c:parse_hdr_end:
 1736|  36.0k|{
 1737|  36.0k|    if (pj_scan_is_eof(scanner)) {
  ------------------
  |  Branch (1737:9): [True: 1.21k, False: 34.8k]
  ------------------
 1738|  1.21k|        ;   /* Do nothing. */
 1739|  34.8k|    } else if (*scanner->curptr == '&') {
  ------------------
  |  Branch (1739:16): [True: 3.09k, False: 31.7k]
  ------------------
 1740|  3.09k|        pj_scan_get_char(scanner);
 1741|  31.7k|    } else {
 1742|  31.7k|        pj_scan_get_newline(scanner);
 1743|  31.7k|    }
 1744|  36.0k|}
sip_parser.c:parse_generic_array_hdr:
 1755|  22.5k|{
 1756|       |    /* Some header fields allow empty elements in the value:
 1757|       |     *   Accept, Allow, Supported
 1758|       |     */
 1759|  22.5k|    if (pj_scan_is_eof(scanner) || 
  ------------------
  |  Branch (1759:9): [True: 41, False: 22.5k]
  ------------------
 1760|  22.5k|        *scanner->curptr == '\r' || *scanner->curptr == '\n') 
  ------------------
  |  Branch (1760:9): [True: 595, False: 21.9k]
  |  Branch (1760:37): [True: 21.0k, False: 929]
  ------------------
 1761|  21.6k|    {
 1762|  21.6k|        goto end;
 1763|  21.6k|    }
 1764|       |
 1765|    929|    if (hdr->count >= PJ_ARRAY_SIZE(hdr->values)) {
  ------------------
  |  |  294|    929|#define PJ_ARRAY_SIZE(a)    (sizeof(a)/sizeof(a[0]))
  ------------------
  |  Branch (1765:9): [True: 0, False: 929]
  ------------------
 1766|       |        /* Too many elements */
 1767|      0|        on_syntax_error(scanner);
 1768|      0|        return;
 1769|      0|    }
 1770|       |
 1771|    929|    pj_scan_get( scanner, &pconst.pjsip_NOT_COMMA_OR_NEWLINE, 
 1772|    929|                 &hdr->values[hdr->count]);
 1773|    929|    hdr->count++;
 1774|       |
 1775|  3.35k|    while ((hdr->count < PJSIP_GENERIC_ARRAY_MAX_COUNT) &&
  ------------------
  |  | 1191|  3.35k|#define PJSIP_GENERIC_ARRAY_MAX_COUNT   32
  ------------------
  |  Branch (1775:12): [True: 3.16k, False: 190]
  ------------------
 1776|  3.35k|           (*scanner->curptr == ','))
  ------------------
  |  Branch (1776:12): [True: 2.42k, False: 739]
  ------------------
 1777|  2.42k|    {
 1778|  2.42k|        pj_scan_get_char(scanner);
 1779|  2.42k|        pj_scan_get( scanner, &pconst.pjsip_NOT_COMMA_OR_NEWLINE, 
 1780|  2.42k|                     &hdr->values[hdr->count]);
 1781|  2.42k|        hdr->count++;
 1782|  2.42k|    }
 1783|       |
 1784|  22.4k|end:
 1785|  22.4k|    parse_hdr_end(scanner);
 1786|  22.4k|}
sip_parser.c:find_handler:
  741|  61.8k|{
  742|  61.8k|    pj_uint32_t hash;
  743|  61.8k|    char hname_copy[PJSIP_MAX_HNAME_LEN];
  744|  61.8k|    pj_str_t tmp;
  745|  61.8k|    pjsip_parse_hdr_func *func;
  746|       |
  747|  61.8k|    if (hname->slen >= PJSIP_MAX_HNAME_LEN) {
  ------------------
  |  | 1131|  61.8k|#define PJSIP_MAX_HNAME_LEN             64
  ------------------
  |  Branch (747:9): [True: 72, False: 61.7k]
  ------------------
  748|       |        /* Guaranteed not to be able to find handler. */
  749|     72|        return NULL;
  750|     72|    }
  751|       |
  752|       |    /* First, common case, try to find handler with exact name */
  753|  61.7k|    hash = pj_hash_calc(0, hname->ptr, (unsigned)hname->slen);
  754|  61.7k|    func = find_handler_imp(hash, hname);
  755|  61.7k|    if (func)
  ------------------
  |  Branch (755:9): [True: 29.5k, False: 32.2k]
  ------------------
  756|  29.5k|        return func;
  757|       |
  758|       |
  759|       |    /* If not found, try converting the header name to lowercase and
  760|       |     * search again.
  761|       |     */
  762|  32.2k|    hash = pj_hash_calc_tolower(0, hname_copy, hname);
  763|  32.2k|    tmp.ptr = hname_copy;
  764|  32.2k|    tmp.slen = hname->slen;
  765|  32.2k|    return find_handler_imp(hash, &tmp);
  766|  61.7k|}
sip_parser.c:find_handler_imp:
  710|  94.0k|{
  711|  94.0k|    handler_rec *first;
  712|  94.0k|    int          comp;
  713|  94.0k|    unsigned     n;
  714|       |
  715|       |    /* Binary search for the handler. */
  716|  94.0k|    comp = -1;
  717|  94.0k|    first = &handler[0];
  718|  94.0k|    n = handler_count;
  719|   522k|    for (; n > 0; ) {
  ------------------
  |  Branch (719:12): [True: 486k, False: 35.7k]
  ------------------
  720|   486k|        unsigned half = n / 2;
  721|   486k|        handler_rec *mid = first + half;
  722|       |
  723|   486k|        comp = compare_handler(mid, hname->ptr, hname->slen, hash);
  724|   486k|        if (comp < 0) {
  ------------------
  |  Branch (724:13): [True: 45.9k, False: 440k]
  ------------------
  725|  45.9k|            first = ++mid;
  726|  45.9k|            n -= half + 1;
  727|   440k|        } else if (comp==0) {
  ------------------
  |  Branch (727:20): [True: 58.3k, False: 382k]
  ------------------
  728|  58.3k|            first = mid;
  729|  58.3k|            break;
  730|   382k|        } else {
  731|   382k|            n = half;
  732|   382k|        }
  733|   486k|    }
  734|       |
  735|  94.0k|    return comp==0 ? first->handler : NULL;
  ------------------
  |  Branch (735:12): [True: 58.3k, False: 35.7k]
  ------------------
  736|  94.0k|}
sip_parser.c:parse_hdr_generic_string:
 2372|  3.52k|{
 2373|  3.52k|    pjsip_generic_string_hdr *hdr;
 2374|       |
 2375|  3.52k|    hdr = pjsip_generic_string_hdr_create(ctx->pool, NULL, NULL);
 2376|  3.52k|    parse_generic_string_hdr(hdr, ctx);
 2377|  3.52k|    return (pjsip_hdr*)hdr;
 2378|       |
 2379|  3.52k|}
sip_parser.c:parse_generic_string_hdr:
 1799|  3.52k|{
 1800|  3.52k|    pj_scanner *scanner = ctx->scanner;
 1801|       |
 1802|  3.52k|    hdr->hvalue.slen = 0;
 1803|       |
 1804|       |    /* header may be mangled hence the loop */
 1805|  4.22k|    while (pj_cis_match(&pconst.pjsip_NOT_NEWLINE, *scanner->curptr)) {
  ------------------
  |  Branch (1805:12): [True: 1.32k, False: 2.90k]
  ------------------
 1806|  1.32k|        pj_str_t next, tmp;
 1807|       |
 1808|  1.32k|        pj_scan_get( scanner, &pconst.pjsip_NOT_NEWLINE, &hdr->hvalue);
 1809|  1.32k|        if (pj_scan_is_eof(scanner) || IS_NEWLINE(*scanner->curptr))
  ------------------
  |  |   62|  1.30k|#define IS_NEWLINE(c)   ((c)=='\r' || (c)=='\n')
  |  |  ------------------
  |  |  |  Branch (62:26): [True: 237, False: 1.07k]
  |  |  |  Branch (62:39): [True: 373, False: 698]
  |  |  ------------------
  ------------------
  |  Branch (1809:13): [True: 16, False: 1.30k]
  ------------------
 1810|    626|            break;
 1811|       |        /* mangled, get next fraction */
 1812|    698|        pj_scan_get( scanner, &pconst.pjsip_NOT_NEWLINE, &next);
 1813|       |        /* concatenate */
 1814|    698|        tmp.ptr = (char*)pj_pool_alloc(ctx->pool, 
 1815|    698|                                       hdr->hvalue.slen + next.slen + 2);
 1816|    698|        tmp.slen = 0;
 1817|    698|        pj_strcpy(&tmp, &hdr->hvalue);
 1818|    698|        pj_strcat2(&tmp, " ");
 1819|    698|        pj_strcat(&tmp, &next);
 1820|    698|        tmp.ptr[tmp.slen] = '\0';
 1821|       |
 1822|    698|        hdr->hvalue = tmp;
 1823|    698|    }
 1824|       |
 1825|  3.52k|    parse_hdr_end(scanner);
 1826|  3.52k|}

pjsip_resolver_create:
   96|  4.82k|{
   97|  4.82k|    pjsip_resolver_t *resolver;
   98|  4.82k|    pj_status_t status;
   99|       |
  100|  4.82k|    PJ_ASSERT_RETURN(pool && p_res, PJ_EINVAL);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  9.64k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 4.82k, False: 0]
  |  |  |  Branch (60:23): [True: 4.82k, False: 0]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  101|  4.82k|    resolver = PJ_POOL_ZALLOC_T(pool, pjsip_resolver_t);
  ------------------
  |  |  520|  4.82k|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  102|       |
  103|       |    /* Create group lock */
  104|  4.82k|    status = pj_grp_lock_create(pool, NULL, &resolver->grp_lock);
  105|  4.82k|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (105:9): [True: 0, False: 4.82k]
  ------------------
  106|      0|        return status;
  107|       |
  108|  4.82k|    pj_grp_lock_add_ref(resolver->grp_lock);
  109|       |
  110|  4.82k|    *p_res = resolver;
  111|       |
  112|  4.82k|    return PJ_SUCCESS;
  113|  4.82k|}
pjsip_resolver_destroy:
  167|  4.82k|{
  168|  4.82k|    if (resolver->res) {
  ------------------
  |  Branch (168:9): [True: 0, False: 4.82k]
  ------------------
  169|      0|#if PJSIP_HAS_RESOLVER
  170|      0|        pj_dns_resolver_destroy(resolver->res, PJ_FALSE);
  171|      0|#endif
  172|      0|        resolver->res = NULL;
  173|      0|    }
  174|       |
  175|  4.82k|    if (resolver->grp_lock) {
  ------------------
  |  Branch (175:9): [True: 4.82k, False: 0]
  ------------------
  176|  4.82k|        pj_grp_lock_dec_ref(resolver->grp_lock);
  177|  4.82k|        resolver->grp_lock = NULL;
  178|  4.82k|    }
  179|  4.82k|}

pjsip_tel_uri_create:
   97|  1.42k|{
   98|  1.42k|    pjsip_tel_uri *uri = PJ_POOL_ZALLOC_T(pool, pjsip_tel_uri);
  ------------------
  |  |  520|  1.42k|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
   99|  1.42k|    uri->vptr = &tel_uri_vptr;
  100|  1.42k|    pj_list_init(&uri->other_param);
  101|  1.42k|    return uri;
  102|  1.42k|}
pjsip_tel_uri_subsys_init:
  118|  4.82k|{
  119|  4.82k|    pj_status_t status;
  120|       |
  121|  4.82k|    pj_cis_buf_init(&cis_buf);
  122|       |
  123|  4.82k|    status = pj_cis_init(&cis_buf, &pjsip_TEL_EXT_VALUE_SPEC);
  124|  4.82k|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  125|  4.82k|    pj_cis_add_str(&pjsip_TEL_EXT_VALUE_SPEC, PHONE_DIGITS);
  ------------------
  |  |   36|  4.82k|#define PHONE_DIGITS        DIGITS VISUAL_SEP
  |  |  ------------------
  |  |  |  |   32|  4.82k|#define DIGITS              "0123456789"
  |  |  ------------------
  |  |               #define PHONE_DIGITS        DIGITS VISUAL_SEP
  |  |  ------------------
  |  |  |  |   35|  4.82k|#define VISUAL_SEP          "-.()"
  |  |  ------------------
  ------------------
  126|       |
  127|  4.82k|    status = pj_cis_init(&cis_buf, &pjsip_TEL_NUMBER_SPEC);
  128|  4.82k|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  129|  4.82k|    pj_cis_add_str(&pjsip_TEL_NUMBER_SPEC, NUMBER_SPEC);
  ------------------
  |  |   39|  4.82k|#define NUMBER_SPEC         LOCAL_DIGITS GLOBAL_DIGITS
  |  |  ------------------
  |  |  |  |   38|  4.82k|#define LOCAL_DIGITS        HEX_DIGITS "*#" VISUAL_SEP
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|  4.82k|#define HEX_DIGITS          DIGITS HEX
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|  4.82k|#define DIGITS              "0123456789"
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define NUMBER_SPEC         LOCAL_DIGITS GLOBAL_DIGITS
  |  |  ------------------
  |  |  |  |   37|  4.82k|#define GLOBAL_DIGITS       "+" PHONE_DIGITS
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|  4.82k|#define PHONE_DIGITS        DIGITS VISUAL_SEP
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   35|  4.82k|#define VISUAL_SEP          "-.()"
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  130|       |
  131|  4.82k|    status = pj_cis_init(&cis_buf, &pjsip_TEL_VISUAL_SEP_SPEC);
  132|  4.82k|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  133|  4.82k|    pj_cis_add_str(&pjsip_TEL_VISUAL_SEP_SPEC, VISUAL_SEP);
  ------------------
  |  |   35|  4.82k|#define VISUAL_SEP          "-.()"
  ------------------
  134|       |
  135|  4.82k|    status = pj_cis_init(&cis_buf, &pjsip_TEL_PHONE_CONTEXT_SPEC);
  136|  4.82k|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  137|  4.82k|    pj_cis_add_alpha(&pjsip_TEL_PHONE_CONTEXT_SPEC);
  138|  4.82k|    pj_cis_add_num(&pjsip_TEL_PHONE_CONTEXT_SPEC);
  139|  4.82k|    pj_cis_add_str(&pjsip_TEL_PHONE_CONTEXT_SPEC, PHONE_CONTEXT);
  ------------------
  |  |   40|  4.82k|#define PHONE_CONTEXT       ALPHA GLOBAL_DIGITS
  |  |  ------------------
  |  |  |  |   37|  4.82k|#define GLOBAL_DIGITS       "+" PHONE_DIGITS
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|  4.82k|#define PHONE_DIGITS        DIGITS VISUAL_SEP
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   35|  4.82k|#define VISUAL_SEP          "-.()"
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  140|       |
  141|  4.82k|    status = pj_cis_init(&cis_buf, &pjsip_TEL_URIC_SPEC);
  142|  4.82k|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  143|  4.82k|    pj_cis_add_alpha(&pjsip_TEL_URIC_SPEC);
  144|  4.82k|    pj_cis_add_num(&pjsip_TEL_URIC_SPEC);
  145|  4.82k|    pj_cis_add_str(&pjsip_TEL_URIC_SPEC, URIC);
  ------------------
  |  |   46|  4.82k|#define URIC                RESERVED UNRESERVED ESCAPED "[]+"
  |  |  ------------------
  |  |  |  |   42|  4.82k|#define RESERVED            "/:@&$,+"
  |  |  ------------------
  ------------------
  146|       |
  147|  4.82k|    status = pj_cis_init(&cis_buf, &pjsip_TEL_PNAME_SPEC);
  148|  4.82k|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  149|  4.82k|    pj_cis_add_alpha(&pjsip_TEL_PNAME_SPEC);
  150|  4.82k|    pj_cis_add_num(&pjsip_TEL_PNAME_SPEC);
  151|  4.82k|    pj_cis_add_str(&pjsip_TEL_PNAME_SPEC, "-");
  152|       |
  153|  4.82k|    status = pj_cis_init(&cis_buf, &pjsip_TEL_PVALUE_SPEC);
  154|  4.82k|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  155|  4.82k|    pj_cis_add_alpha(&pjsip_TEL_PVALUE_SPEC);
  156|  4.82k|    pj_cis_add_num(&pjsip_TEL_PVALUE_SPEC);
  157|  4.82k|    pj_cis_add_str(&pjsip_TEL_PVALUE_SPEC, PARAM_CHAR);
  ------------------
  |  |   48|  4.82k|#define PARAM_CHAR          PARAM_UNRESERVED UNRESERVED ESCAPED
  |  |  ------------------
  |  |  |  |   47|  4.82k|#define PARAM_UNRESERVED    "[]/:&+$"
  |  |  ------------------
  |  |               #define PARAM_CHAR          PARAM_UNRESERVED UNRESERVED ESCAPED
  |  |  ------------------
  |  |  |  |   45|  4.82k|#define ESCAPED             "%"
  |  |  ------------------
  ------------------
  158|       |
  159|  4.82k|    status = pj_cis_dup(&pjsip_TEL_PVALUE_SPEC_ESC, &pjsip_TEL_PVALUE_SPEC);
  160|  4.82k|    pj_cis_del_str(&pjsip_TEL_PVALUE_SPEC_ESC, "%");
  161|       |
  162|  4.82k|    status = pj_cis_dup(&pjsip_TEL_PARSING_PVALUE_SPEC, &pjsip_TEL_URIC_SPEC);
  163|  4.82k|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  164|  4.82k|    pj_cis_add_cis(&pjsip_TEL_PARSING_PVALUE_SPEC, &pjsip_TEL_PVALUE_SPEC);
  165|  4.82k|    pj_cis_add_str(&pjsip_TEL_PARSING_PVALUE_SPEC, "=");
  166|       |
  167|  4.82k|    status = pj_cis_dup(&pjsip_TEL_PARSING_PVALUE_SPEC_ESC, 
  168|  4.82k|                        &pjsip_TEL_PARSING_PVALUE_SPEC);
  169|  4.82k|    pj_cis_del_str(&pjsip_TEL_PARSING_PVALUE_SPEC_ESC, "%");
  170|       |
  171|  4.82k|    status = pjsip_register_uri_parser("tel", &tel_uri_parse);
  172|  4.82k|    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  173|       |
  174|  4.82k|    return PJ_SUCCESS;
  175|  4.82k|}
sip_tel_uri.c:tel_uri_parse:
  372|  1.42k|{
  373|  1.42k|    pjsip_tel_uri *uri;
  374|  1.42k|    pj_str_t token;
  375|  1.42k|    int skip_ws = scanner->skip_ws;
  376|  1.42k|    const pjsip_parser_const_t *pc = pjsip_parser_const();
  377|       |
  378|  1.42k|    scanner->skip_ws = 0;
  379|       |
  380|       |    /* Parse scheme. */
  381|  1.42k|    pj_scan_get(scanner, &pc->pjsip_TOKEN_SPEC, &token);
  382|  1.42k|    if (pj_scan_get_char(scanner) != ':')
  ------------------
  |  Branch (382:9): [True: 0, False: 1.42k]
  ------------------
  383|      0|        PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|      0|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
  384|  1.42k|    if (pj_stricmp_alnum(&token, &pc->pjsip_TEL_STR) != 0)
  ------------------
  |  |  408|  1.42k|#define pj_stricmp_alnum    pj_stricmp
  ------------------
  |  Branch (384:9): [True: 0, False: 1.42k]
  ------------------
  385|      0|        PJ_THROW(PJSIP_SYN_ERR_EXCEPTION);
  ------------------
  |  |  402|      0|#define PJ_THROW(exception_id)  pj_throw_exception_(exception_id)
  ------------------
  386|       |
  387|       |    /* Create URI */
  388|  1.42k|    uri = pjsip_tel_uri_create(pool);
  389|       |
  390|       |    /* Get the phone number. */
  391|       |#if defined(PJSIP_UNESCAPE_IN_PLACE) && PJSIP_UNESCAPE_IN_PLACE!=0
  392|       |    pj_scan_get_unescape(scanner, &pjsip_TEL_NUMBER_SPEC, &uri->number);
  393|       |#else
  394|  1.42k|    pj_scan_get(scanner, &pjsip_TEL_NUMBER_SPEC, &uri->number);
  395|  1.42k|    uri->number = pj_str_unescape(pool, &uri->number);
  396|  1.42k|#endif
  397|       |
  398|       |    /* Get all parameters. */
  399|  1.42k|    if (parse_params && *scanner->curptr==';') {
  ------------------
  |  Branch (399:9): [True: 781, False: 640]
  |  Branch (399:25): [True: 301, False: 480]
  ------------------
  400|    301|        pj_str_t pname, pvalue;
  401|       |
  402|  2.01k|        do {
  403|       |            /* Eat the ';' separator. */
  404|  2.01k|            pj_scan_get_char(scanner);
  405|       |
  406|       |            /* Get pname. */
  407|  2.01k|            pj_scan_get(scanner, &pc->pjsip_PARAM_CHAR_SPEC, &pname);
  408|       |
  409|  2.01k|            if (*scanner->curptr == '=') {
  ------------------
  |  Branch (409:17): [True: 203, False: 1.81k]
  ------------------
  410|    203|                pj_scan_get_char(scanner);
  411|       |
  412|       |#               if defined(PJSIP_UNESCAPE_IN_PLACE) && PJSIP_UNESCAPE_IN_PLACE!=0
  413|       |                    pj_scan_get_unescape(scanner, 
  414|       |                                         &pjsip_TEL_PARSING_PVALUE_SPEC_ESC,
  415|       |                                         &pvalue);
  416|       |#               else
  417|    203|                    pj_scan_get(scanner, &pjsip_TEL_PARSING_PVALUE_SPEC, 
  418|    203|                                &pvalue);
  419|    203|                    pvalue = pj_str_unescape(pool, &pvalue);
  420|    203|#               endif
  421|       |
  422|  1.81k|            } else {
  423|  1.81k|                pvalue.slen = 0;
  424|  1.81k|                pvalue.ptr = NULL;
  425|  1.81k|            }
  426|       |
  427|       |            /* Save the parameters. */
  428|  2.01k|            if (pj_stricmp_alnum(&pname, &pjsip_ISUB_STR)==0) {
  ------------------
  |  |  408|  2.01k|#define pj_stricmp_alnum    pj_stricmp
  ------------------
  |  Branch (428:17): [True: 194, False: 1.82k]
  ------------------
  429|    194|                uri->isub_param = pvalue;
  430|  1.82k|            } else if (pj_stricmp_alnum(&pname, &pjsip_EXT_STR)==0) {
  ------------------
  |  |  408|  1.82k|#define pj_stricmp_alnum    pj_stricmp
  ------------------
  |  Branch (430:24): [True: 195, False: 1.62k]
  ------------------
  431|    195|                uri->ext_param = pvalue;
  432|  1.62k|            } else if (pj_stricmp_alnum(&pname, &pjsip_PH_CTX_STR)==0) {
  ------------------
  |  |  408|  1.62k|#define pj_stricmp_alnum    pj_stricmp
  ------------------
  |  Branch (432:24): [True: 194, False: 1.43k]
  ------------------
  433|    194|                uri->context = pvalue;
  434|  1.43k|            } else {
  435|  1.43k|                pjsip_param *param = PJ_POOL_ALLOC_T(pool, pjsip_param);
  ------------------
  |  |  506|  1.43k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
  436|  1.43k|                param->name = pname;
  437|  1.43k|                param->value = pvalue;
  438|  1.43k|                pj_list_insert_before(&uri->other_param, param);
  439|  1.43k|            }
  440|       |
  441|  2.01k|        } while (*scanner->curptr==';');
  ------------------
  |  Branch (441:18): [True: 1.71k, False: 301]
  ------------------
  442|    301|    }
  443|       |
  444|  1.42k|    scanner->skip_ws = skip_ws;
  445|  1.42k|    pj_scan_skip_whitespace(scanner);
  446|  1.42k|    return uri;
  447|  1.42k|}

pjsip_tsx_initialize_timer_values:
  472|  4.82k|{
  473|  4.82k|    t1_timer_val.sec  = pjsip_cfg()->tsx.t1 / 1000;
  474|  4.82k|    t1_timer_val.msec = pjsip_cfg()->tsx.t1 % 1000;
  475|  4.82k|    t2_timer_val.sec  = pjsip_cfg()->tsx.t2 / 1000;
  476|  4.82k|    t2_timer_val.msec = pjsip_cfg()->tsx.t2 % 1000;
  477|  4.82k|    t4_timer_val.sec  = pjsip_cfg()->tsx.t4 / 1000;
  478|  4.82k|    t4_timer_val.msec = pjsip_cfg()->tsx.t4 % 1000;
  479|  4.82k|    td_timer_val.sec  = pjsip_cfg()->tsx.td / 1000;
  480|  4.82k|    td_timer_val.msec = pjsip_cfg()->tsx.td % 1000;
  481|  4.82k|    timeout_timer_val = td_timer_val;
  482|  4.82k|}
pjsip_tsx_layer_init_module:
  501|  4.82k|{
  502|  4.82k|    pj_pool_t *pool;
  503|  4.82k|    pj_status_t status;
  504|       |
  505|       |
  506|  4.82k|    PJ_ASSERT_RETURN(mod_tsx_layer.endpt==NULL, PJ_EINVALIDOP);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  507|       |
  508|       |    /* Initialize timer values */
  509|  4.82k|    pjsip_tsx_initialize_timer_values();
  510|       |
  511|       |    /* Reset max retrans count (for library restart scenario) */
  512|  4.82k|    max_retrans_count = -1;
  513|       |
  514|       |    /*
  515|       |     * Initialize transaction layer structure.
  516|       |     */
  517|       |
  518|       |    /* Create pool for the module. */
  519|  4.82k|    pool = pjsip_endpt_create_pool(endpt, "tsxlayer", 
  520|  4.82k|                                   PJSIP_POOL_TSX_LAYER_LEN,
  ------------------
  |  | 1067|  4.82k|#   define PJSIP_POOL_TSX_LAYER_LEN     512
  ------------------
  521|  4.82k|                                   PJSIP_POOL_TSX_LAYER_INC );
  ------------------
  |  | 1077|  4.82k|#   define PJSIP_POOL_TSX_LAYER_INC     512
  ------------------
  522|  4.82k|    if (!pool)
  ------------------
  |  Branch (522:9): [True: 0, False: 4.82k]
  ------------------
  523|      0|        return PJ_ENOMEM;
  ------------------
  |  |  348|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  524|       |
  525|       |    
  526|       |    /* Initialize some attributes. */
  527|  4.82k|    mod_tsx_layer.pool = pool;
  528|  4.82k|    mod_tsx_layer.endpt = endpt;
  529|       |
  530|       |
  531|       |    /* Create hash table. */
  532|  4.82k|    mod_tsx_layer.htable = pj_hash_create( pool, pjsip_cfg()->tsx.max_count );
  533|  4.82k|    mod_tsx_layer.htable2 = pj_hash_create(pool, pjsip_cfg()->tsx.max_count);
  534|  4.82k|    if (!mod_tsx_layer.htable || !mod_tsx_layer.htable2) {
  ------------------
  |  Branch (534:9): [True: 0, False: 4.82k]
  |  Branch (534:34): [True: 0, False: 4.82k]
  ------------------
  535|      0|        pjsip_endpt_release_pool(endpt, pool);
  536|      0|        return PJ_ENOMEM;
  ------------------
  |  |  348|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  537|      0|    }
  538|       |
  539|       |    /* Create group lock. */
  540|  4.82k|    status = pj_mutex_create_recursive(pool, "tsxlayer", &mod_tsx_layer.mutex);
  541|  4.82k|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (541:9): [True: 0, False: 4.82k]
  ------------------
  542|      0|        pjsip_endpt_release_pool(endpt, pool);
  543|      0|        return status;
  544|      0|    }
  545|       |
  546|       |    /*
  547|       |     * Register transaction layer module to endpoint.
  548|       |     */
  549|  4.82k|    status = pjsip_endpt_register_module( endpt, &mod_tsx_layer.mod );
  550|  4.82k|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (550:9): [True: 0, False: 4.82k]
  ------------------
  551|      0|        pj_mutex_destroy(mod_tsx_layer.mutex);
  552|      0|        pjsip_endpt_release_pool(endpt, pool);
  553|      0|        return status;
  554|      0|    }
  555|       |
  556|       |    /* Register mod_stateful_util module (sip_util_statefull.c) */
  557|  4.82k|    status = pjsip_endpt_register_module(endpt, &mod_stateful_util);
  558|  4.82k|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (558:9): [True: 0, False: 4.82k]
  ------------------
  559|      0|        return status;
  560|      0|    }
  561|       |
  562|  4.82k|    return PJ_SUCCESS;
  563|  4.82k|}
sip_transaction.c:mod_tsx_layer_load:
  784|  4.82k|{
  785|  4.82k|    PJ_UNUSED_ARG(endpt);
  ------------------
  |  | 1433|  4.82k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  786|  4.82k|    return PJ_SUCCESS;
  787|  4.82k|}
sip_transaction.c:mod_tsx_layer_start:
  794|  4.82k|{
  795|  4.82k|    return PJ_SUCCESS;
  796|  4.82k|}
sip_transaction.c:mod_tsx_layer_stop:
  803|  4.82k|{
  804|  4.82k|    pj_hash_iterator_t it_buf, *it;
  805|       |
  806|  4.82k|    PJ_LOG(4,(THIS_FILE, "Stopping transaction layer module"));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  807|       |
  808|  4.82k|    pj_mutex_lock(mod_tsx_layer.mutex);
  809|       |
  810|       |    /* Destroy all transactions. */
  811|  4.82k|    it = pj_hash_first(mod_tsx_layer.htable, &it_buf);
  812|  4.82k|    while (it) {
  ------------------
  |  Branch (812:12): [True: 0, False: 4.82k]
  ------------------
  813|      0|        pjsip_transaction *tsx = (pjsip_transaction*) 
  814|      0|                                 pj_hash_this(mod_tsx_layer.htable, it);
  815|      0|        pj_hash_iterator_t *next = pj_hash_next(mod_tsx_layer.htable, it);
  816|      0|        if (tsx) {
  ------------------
  |  Branch (816:13): [True: 0, False: 0]
  ------------------
  817|      0|            pjsip_tsx_terminate(tsx, PJSIP_SC_SERVICE_UNAVAILABLE);
  818|      0|            mod_tsx_layer_unregister_tsx(tsx);
  819|      0|            tsx_shutdown(tsx);
  820|      0|        }
  821|      0|        it = next;
  822|      0|    }
  823|       |
  824|  4.82k|    pj_mutex_unlock(mod_tsx_layer.mutex);
  825|       |
  826|  4.82k|    PJ_LOG(4,(THIS_FILE, "Stopped transaction layer module"));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  827|       |
  828|  4.82k|    return PJ_SUCCESS;
  829|  4.82k|}
sip_transaction.c:mod_tsx_layer_unload:
  854|  4.82k|{
  855|       |    /* Only self destroy when there's no transaction in the table.
  856|       |     * Transaction may refuse to destroy when it has pending
  857|       |     * transmission. If we destroy the module now, application will
  858|       |     * crash when the pending transaction finally got error response
  859|       |     * from transport and when it tries to unregister itself.
  860|       |     */
  861|  4.82k|    if (pj_hash_count(mod_tsx_layer.htable) != 0) {
  ------------------
  |  Branch (861:9): [True: 0, False: 4.82k]
  ------------------
  862|      0|        pj_status_t status;
  863|      0|        status = pjsip_endpt_atexit(mod_tsx_layer.endpt, &tsx_layer_destroy);
  864|      0|        if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (864:13): [True: 0, False: 0]
  ------------------
  865|      0|            PJ_PERROR(3,(THIS_FILE, status,
  ------------------
  |  |  175|      0|#define PJ_PERROR(level,arg)    do { \
  |  |  176|      0|                                    pj_perror_wrapper_##level(arg); \
  |  |  177|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (177:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  866|      0|                    "Failed to register transaction layer module destroy."));
  867|      0|        }
  868|      0|        return PJ_EBUSY;
  ------------------
  |  |  368|      0|#define PJ_EBUSY            (PJ_ERRNO_START_STATUS + 11)/* 70011 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  869|      0|    }
  870|       |
  871|  4.82k|    tsx_layer_destroy(mod_tsx_layer.endpt);
  872|       |
  873|  4.82k|    return PJ_SUCCESS;
  874|  4.82k|}
sip_transaction.c:tsx_layer_destroy:
  834|  4.82k|{
  835|  4.82k|    PJ_UNUSED_ARG(endpt);
  ------------------
  |  | 1433|  4.82k|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  836|       |
  837|       |    /* Destroy mutex. */
  838|  4.82k|    pj_mutex_destroy(mod_tsx_layer.mutex);
  839|       |
  840|       |    /* Release pool. */
  841|  4.82k|    pjsip_endpt_release_pool(mod_tsx_layer.endpt, mod_tsx_layer.pool);
  842|       |
  843|       |    /* Mark as unregistered. */
  844|  4.82k|    mod_tsx_layer.endpt = NULL;
  845|       |
  846|  4.82k|    PJ_LOG(4,(THIS_FILE, "Transaction layer module destroyed"));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
  847|  4.82k|}

pjsip_transport_get_default_port_for_type:
  413|  4.82k|{
  414|       |    /* Return the port. */
  415|  4.82k|    return get_tpname(type)->port;
  416|  4.82k|}
pjsip_transport_register:
 1270|  4.82k|{
 1271|  4.82k|    int key_len;
 1272|  4.82k|    pj_uint32_t hval;
 1273|  4.82k|    transport *tp_ref = NULL;
 1274|  4.82k|    transport *tp_add = NULL;
 1275|       |
 1276|       |    /* Init. */
 1277|  4.82k|    tp->tpmgr = mgr;
 1278|  4.82k|    pj_bzero(&tp->idle_timer, sizeof(tp->idle_timer));
 1279|  4.82k|    tp->idle_timer.user_data = tp;
 1280|  4.82k|    tp->idle_timer.cb = &transport_idle_callback;
 1281|       |
 1282|       |    /*
 1283|       |     * Register to hash table (see Trac ticket #42).
 1284|       |     */
 1285|  4.82k|    key_len = sizeof(tp->key.type) + tp->addr_len;
 1286|  4.82k|    pj_lock_acquire(mgr->lock);
 1287|       |
 1288|  4.82k|    hval = 0;
 1289|  4.82k|    tp_ref = (transport *)pj_hash_get(mgr->table, &tp->key, key_len, &hval);
 1290|       |
 1291|       |    /* Get an empty entry from the freelist. */
 1292|  4.82k|    if (pj_list_empty(&mgr->tp_entry_freelist)) {
  ------------------
  |  Branch (1292:9): [True: 0, False: 4.82k]
  ------------------
 1293|      0|        unsigned i = 0;
 1294|       |
 1295|      0|        TRACE_((THIS_FILE, "Transport list is full, allocate new entry"));
 1296|       |        /* Allocate new entry for the freelist. */
 1297|      0|        for (; i < PJSIP_TRANSPORT_ENTRY_ALLOC_CNT; ++i) {
  ------------------
  |  |   90|      0|#   define PJSIP_TRANSPORT_ENTRY_ALLOC_CNT  16
  ------------------
  |  Branch (1297:16): [True: 0, False: 0]
  ------------------
 1298|      0|            tp_add = PJ_POOL_ZALLOC_T(mgr->pool, transport);
  ------------------
  |  |  520|      0|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
 1299|      0|            if (!tp_add){
  ------------------
  |  Branch (1299:17): [True: 0, False: 0]
  ------------------
 1300|      0|                pj_lock_release(mgr->lock);
 1301|      0|                return PJ_ENOMEM;
  ------------------
  |  |  348|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1302|      0|            }  
 1303|      0|            pj_list_init(tp_add);
 1304|      0|            pj_list_push_back(&mgr->tp_entry_freelist, tp_add);
 1305|      0|        }
 1306|      0|    }
 1307|  4.82k|    tp_add = mgr->tp_entry_freelist.next;
 1308|  4.82k|    tp_add->tp = tp;
 1309|  4.82k|    pj_list_erase(tp_add);
 1310|       |
 1311|  4.82k|    if (tp_ref) {
  ------------------
  |  Branch (1311:9): [True: 0, False: 4.82k]
  ------------------
 1312|       |        /* There'a already a transport list from the hash table. Add the 
 1313|       |         * new transport to the list.
 1314|       |         */
 1315|      0|        pj_list_push_back(tp_ref, tp_add);
 1316|      0|        TRACE_((THIS_FILE, "Remote address already registered, "
 1317|      0|                           "appended the transport to the list"));
 1318|  4.82k|    } else {
 1319|       |        /* Transport list not found, add it to the hash table. */
 1320|  4.82k|        pj_hash_set_np(mgr->table, &tp->key, key_len, hval, tp_add->tp_buf,
 1321|  4.82k|                       tp_add);
 1322|  4.82k|        TRACE_((THIS_FILE, "Remote address not registered, "
 1323|  4.82k|                           "added the transport to the hash"));
 1324|  4.82k|    }
 1325|       |
 1326|       |    /* Add ref transport group lock, if any */
 1327|  4.82k|    if (tp->grp_lock)
  ------------------
  |  Branch (1327:9): [True: 0, False: 4.82k]
  ------------------
 1328|      0|        pj_grp_lock_add_ref(tp->grp_lock);
 1329|       |
 1330|  4.82k|    pj_lock_release(mgr->lock);
 1331|       |
 1332|  4.82k|    TRACE_((THIS_FILE, "Transport %s registered: type=%s, remote=%s:%d",
 1333|  4.82k|            tp->obj_name,
 1334|  4.82k|            pjsip_transport_get_type_name(tp->key.type),
 1335|  4.82k|            pj_sockaddr_has_addr(&tp->key.rem_addr)?
 1336|  4.82k|                                addr_string(&tp->key.rem_addr):"",
 1337|  4.82k|            pj_sockaddr_has_addr(&tp->key.rem_addr)?
 1338|  4.82k|                                pj_sockaddr_get_port(&tp->key.rem_addr):0));
 1339|       |
 1340|  4.82k|    return PJ_SUCCESS;
 1341|  4.82k|}
pjsip_tpmgr_create:
 1615|  4.82k|{
 1616|  4.82k|    pjsip_tpmgr *mgr;
 1617|  4.82k|    pj_status_t status;
 1618|  4.82k|    unsigned i = 0;
 1619|  4.82k|    pj_pool_t *mgr_pool;
 1620|       |
 1621|  4.82k|    PJ_ASSERT_RETURN(pool && endpt && rx_cb && p_mgr, PJ_EINVAL);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  28.9k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 4.82k, False: 0]
  |  |  |  Branch (60:23): [True: 4.82k, False: 0]
  |  |  |  Branch (60:23): [True: 4.82k, False: 0]
  |  |  |  Branch (60:23): [True: 4.82k, False: 0]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1622|       |
 1623|       |    /* Register mod_msg_print module. */
 1624|  4.82k|    status = pjsip_endpt_register_module(endpt, &mod_msg_print);
 1625|  4.82k|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (1625:9): [True: 0, False: 4.82k]
  ------------------
 1626|      0|        return status;
 1627|       |
 1628|       |    /* Create and initialize transport manager. */
 1629|  4.82k|    mgr_pool = pjsip_endpt_create_pool(endpt, "tpmgr",
 1630|  4.82k|                                       TPMGR_POOL_INIT_SIZE,
  ------------------
  |  |   76|  4.82k|#   define TPMGR_POOL_INIT_SIZE 1000
  ------------------
 1631|  4.82k|                                       TPMGR_POOL_INC_SIZE);
  ------------------
  |  |   81|  4.82k|    #define TPMGR_POOL_INC_SIZE 1000
  ------------------
 1632|  4.82k|    mgr = PJ_POOL_ZALLOC_T(mgr_pool, pjsip_tpmgr);
  ------------------
  |  |  520|  4.82k|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
 1633|  4.82k|    mgr->endpt = endpt;
 1634|  4.82k|    mgr->on_rx_msg = rx_cb;
 1635|  4.82k|    mgr->on_tx_msg = tx_cb;
 1636|  4.82k|    mgr->pool = mgr_pool;
 1637|       |
 1638|  4.82k|    if (!mgr->pool)
  ------------------
  |  Branch (1638:9): [True: 0, False: 4.82k]
  ------------------
 1639|      0|        return PJ_ENOMEM;
  ------------------
  |  |  348|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1640|       |
 1641|  4.82k|    pj_list_init(&mgr->factory_list);
 1642|  4.82k|    pj_list_init(&mgr->tdata_list);
 1643|  4.82k|    pj_list_init(&mgr->tp_entry_freelist);
 1644|       |
 1645|  4.82k|    mgr->table = pj_hash_create(mgr->pool, PJSIP_TPMGR_HTABLE_SIZE);
  ------------------
  |  |  346|  4.82k|#   define PJSIP_TPMGR_HTABLE_SIZE      31
  ------------------
 1646|  4.82k|    if (!mgr->table)
  ------------------
  |  Branch (1646:9): [True: 0, False: 4.82k]
  ------------------
 1647|      0|        return PJ_ENOMEM;
  ------------------
  |  |  348|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1648|       |
 1649|  4.82k|    status = pj_lock_create_recursive_mutex(mgr->pool, "tmgr%p", &mgr->lock);
 1650|  4.82k|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (1650:9): [True: 0, False: 4.82k]
  ------------------
 1651|      0|        return status;
 1652|       |
 1653|  82.0k|    for (; i < PJSIP_TRANSPORT_ENTRY_ALLOC_CNT; ++i) {
  ------------------
  |  |   90|  82.0k|#   define PJSIP_TRANSPORT_ENTRY_ALLOC_CNT  16
  ------------------
  |  Branch (1653:12): [True: 77.1k, False: 4.82k]
  ------------------
 1654|  77.1k|        transport *tp_add = NULL;
 1655|       |
 1656|  77.1k|        tp_add = PJ_POOL_ZALLOC_T(mgr->pool, transport);
  ------------------
  |  |  520|  77.1k|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
 1657|  77.1k|        if (!tp_add)
  ------------------
  |  Branch (1657:13): [True: 0, False: 77.1k]
  ------------------
 1658|      0|            return PJ_ENOMEM;
  ------------------
  |  |  348|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1659|  77.1k|        pj_list_init(tp_add);
 1660|  77.1k|        pj_list_push_back(&mgr->tp_entry_freelist, tp_add);
 1661|  77.1k|    }
 1662|       |
 1663|  4.82k|#if defined(PJ_DEBUG) && PJ_DEBUG!=0
 1664|  4.82k|    status = pj_atomic_create(mgr->pool, 0, &mgr->tdata_counter);
 1665|  4.82k|    if (status != PJ_SUCCESS) {
  ------------------
  |  Branch (1665:9): [True: 0, False: 4.82k]
  ------------------
 1666|      0|        pj_lock_destroy(mgr->lock);
 1667|      0|        return status;
 1668|      0|    }
 1669|  4.82k|#endif
 1670|       |
 1671|       |    /* Set transport state callback */
 1672|  4.82k|    pjsip_tpmgr_set_state_cb(mgr, &tp_state_callback);
 1673|       |
 1674|  4.82k|    PJ_LOG(5, (THIS_FILE, "Transport manager created."));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1675|       |
 1676|  4.82k|    *p_mgr = mgr;
 1677|  4.82k|    return PJ_SUCCESS;
 1678|  4.82k|}
pjsip_tpmgr_destroy:
 1925|  4.82k|{
 1926|  4.82k|    pj_hash_iterator_t itr_val;
 1927|  4.82k|    pj_hash_iterator_t *itr;
 1928|  4.82k|    pjsip_tpfactory *factory;
 1929|  4.82k|    pjsip_endpoint *endpt = mgr->endpt;
 1930|       |
 1931|  4.82k|    PJ_LOG(5, (THIS_FILE, "Destroying transport manager"));
  ------------------
  |  |  106|  4.82k|#define PJ_LOG(level,arg)       do { \
  |  |  107|  4.82k|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|  4.82k|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1932|       |
 1933|  4.82k|    pj_lock_acquire(mgr->lock);
 1934|       |
 1935|       |    /*
 1936|       |     * Destroy all transports in the hash table.
 1937|       |     */
 1938|  9.64k|    for (itr = pj_hash_first(mgr->table, &itr_val); itr;
  ------------------
  |  Branch (1938:53): [True: 4.82k, False: 4.82k]
  ------------------
 1939|  4.82k|         itr = pj_hash_first(mgr->table, &itr_val))
 1940|  4.82k|    {
 1941|  4.82k|        transport *tp_ref;
 1942|  4.82k|        tp_ref = pj_hash_this(mgr->table, itr);
 1943|  4.82k|        destroy_transport(mgr, tp_ref->tp);
 1944|  4.82k|    }
 1945|       |
 1946|       |    /*
 1947|       |     * Destroy all factories/listeners.
 1948|       |     */
 1949|  4.82k|    factory = mgr->factory_list.next;
 1950|  4.82k|    while (factory != &mgr->factory_list) {
  ------------------
  |  Branch (1950:12): [True: 0, False: 4.82k]
  ------------------
 1951|      0|        pjsip_tpfactory *next = factory->next;
 1952|       |
 1953|      0|        factory->destroy(factory);
 1954|       |
 1955|      0|        factory = next;
 1956|      0|    }
 1957|       |
 1958|  4.82k|    pj_lock_release(mgr->lock);
 1959|       |
 1960|  4.82k|#if defined(PJ_DEBUG) && PJ_DEBUG!=0
 1961|       |    /* If you encounter assert error on this line, it means there are
 1962|       |     * leakings in transmit data (i.e. some transmit data have not been
 1963|       |     * destroyed).
 1964|       |     */
 1965|       |    //pj_assert(pj_atomic_get(mgr->tdata_counter) == 0);
 1966|  4.82k|    if (pj_atomic_get(mgr->tdata_counter) != 0) {
  ------------------
  |  Branch (1966:9): [True: 0, False: 4.82k]
  ------------------
 1967|      0|        PJ_LOG(3,(THIS_FILE, "Warning: %ld transmit buffer(s) not freed!",
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1968|      0|                  pj_atomic_get(mgr->tdata_counter)));
 1969|      0|    }
 1970|  4.82k|#endif
 1971|       |
 1972|       |    /*
 1973|       |     * Destroy any dangling transmit buffer.
 1974|       |     */
 1975|  4.82k|    if (!pj_list_empty(&mgr->tdata_list)) {
  ------------------
  |  Branch (1975:9): [True: 0, False: 4.82k]
  ------------------
 1976|      0|        pjsip_tx_data *tdata = mgr->tdata_list.next;
 1977|      0|        while (tdata != &mgr->tdata_list) {
  ------------------
  |  Branch (1977:16): [True: 0, False: 0]
  ------------------
 1978|      0|            pjsip_tx_data *next = tdata->next;
 1979|      0|            tx_data_destroy(tdata);
 1980|      0|            tdata = next;
 1981|      0|        }
 1982|      0|        PJ_LOG(3,(THIS_FILE, "Cleaned up dangling transmit buffer(s)."));
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1983|      0|    }
 1984|       |
 1985|  4.82k|#if defined(PJ_DEBUG) && PJ_DEBUG!=0
 1986|  4.82k|    pj_atomic_destroy(mgr->tdata_counter);
 1987|  4.82k|#endif
 1988|       |
 1989|  4.82k|    pj_lock_destroy(mgr->lock);
 1990|       |
 1991|       |    /* Unregister mod_msg_print. */
 1992|  4.82k|    if (mod_msg_print.id != -1) {
  ------------------
  |  Branch (1992:9): [True: 0, False: 4.82k]
  ------------------
 1993|      0|        pjsip_endpt_unregister_module(endpt, &mod_msg_print);
 1994|      0|    }
 1995|       |
 1996|  4.82k|    if (mgr->pool) {
  ------------------
  |  Branch (1996:9): [True: 4.82k, False: 0]
  ------------------
 1997|  4.82k|        pjsip_endpt_release_pool( mgr->endpt, mgr->pool );
 1998|  4.82k|    }
 1999|       |
 2000|  4.82k|    return PJ_SUCCESS;
 2001|  4.82k|}
pjsip_tpmgr_set_state_cb:
 2755|  4.82k|{
 2756|  4.82k|    PJ_ASSERT_RETURN(mgr, PJ_EINVAL);
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  4.82k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:21): [True: 0, False: 4.82k]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2757|       |
 2758|  4.82k|    mgr->tp_state_cb = cb;
 2759|       |
 2760|  4.82k|    return PJ_SUCCESS;
 2761|  4.82k|}
sip_transport.c:get_tpname:
  291|  4.82k|{
  292|  4.82k|    unsigned i;
  293|  38.5k|    for (i=0; i<PJ_ARRAY_SIZE(transport_names); ++i) {
  ------------------
  |  |  294|  38.5k|#define PJ_ARRAY_SIZE(a)    (sizeof(a)/sizeof(a[0]))
  ------------------
  |  Branch (293:15): [True: 38.5k, False: 0]
  ------------------
  294|  38.5k|        if (transport_names[i].type == type)
  ------------------
  |  Branch (294:13): [True: 4.82k, False: 33.7k]
  ------------------
  295|  4.82k|            return &transport_names[i];
  296|  38.5k|    }
  297|      0|    pj_assert(!"Invalid transport type!");
  ------------------
  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  ------------------
  298|      0|    return NULL;
  299|      0|}
sip_transport.c:destroy_transport:
 1346|  4.82k|{
 1347|  4.82k|    int key_len;
 1348|  4.82k|    pj_uint32_t hval;
 1349|  4.82k|    void *entry;
 1350|       |
 1351|  4.82k|    tp->is_destroying = PJ_TRUE;
 1352|       |
 1353|  4.82k|    TRACE_((THIS_FILE, "Transport %s is being destroyed", tp->obj_name));
 1354|       |
 1355|  4.82k|    pj_lock_acquire(tp->lock);
 1356|  4.82k|    pj_lock_acquire(mgr->lock);
 1357|       |
 1358|       |    /*
 1359|       |     * Unregister timer, if any.
 1360|       |     */
 1361|       |    //pj_assert(tp->idle_timer.id == PJ_FALSE);
 1362|  4.82k|    if (tp->idle_timer.id != PJ_FALSE) {
  ------------------
  |  Branch (1362:9): [True: 0, False: 4.82k]
  ------------------
 1363|      0|        tp->idle_timer.id = PJ_FALSE;
 1364|      0|        pjsip_endpt_cancel_timer(mgr->endpt, &tp->idle_timer);
 1365|      0|    }
 1366|       |
 1367|       |    /*
 1368|       |     * Unregister from hash table (see Trac ticket #42).
 1369|       |     */
 1370|  4.82k|    key_len = sizeof(tp->key.type) + tp->addr_len;
 1371|  4.82k|    hval = 0;
 1372|  4.82k|    entry = pj_hash_get(mgr->table, &tp->key, key_len, &hval);
 1373|  4.82k|    if (entry) {
  ------------------
  |  Branch (1373:9): [True: 4.82k, False: 0]
  ------------------
 1374|  4.82k|        transport *tp_ref = (transport *)entry;
 1375|  4.82k|        transport *tp_iter = tp_ref;
 1376|       |        /* Search the matching entry from the transport list. */
 1377|  4.82k|        do {
 1378|  4.82k|            if (tp_iter->tp == tp) {
  ------------------
  |  Branch (1378:17): [True: 4.82k, False: 0]
  ------------------
 1379|  4.82k|                transport *tp_next = tp_iter->next;
 1380|       |
 1381|       |                /* Update hash table :
 1382|       |                 * - transport list only contain single element, or
 1383|       |                 * - the entry is the first element of the transport list.
 1384|       |                 */
 1385|  4.82k|                if (tp_iter == tp_ref) {
  ------------------
  |  Branch (1385:21): [True: 4.82k, False: 0]
  ------------------
 1386|  4.82k|                    pj_hash_set(NULL, mgr->table, &tp->key, key_len, hval,
 1387|  4.82k|                                NULL);
 1388|       |
 1389|  4.82k|                    if (tp_ref->next != tp_ref) {
  ------------------
  |  Branch (1389:25): [True: 0, False: 4.82k]
  ------------------
 1390|       |                        /* The transport list has multiple entry. */
 1391|      0|                        pj_hash_set_np(mgr->table, &tp_next->tp->key, key_len,
 1392|      0|                                       hval, tp_next->tp_buf, tp_next);
 1393|      0|                        TRACE_((THIS_FILE, "Hash entry updated after "
 1394|      0|                                           "transport %s being destroyed",
 1395|      0|                                           tp->obj_name));
 1396|  4.82k|                    } else {
 1397|  4.82k|                        TRACE_((THIS_FILE, "Hash entry deleted after "
 1398|  4.82k|                                           "transport %s being destroyed",
 1399|  4.82k|                                           tp->obj_name));
 1400|  4.82k|                    }
 1401|  4.82k|                }
 1402|       |
 1403|  4.82k|                pj_list_erase(tp_iter);
 1404|       |                /* Put back to the transport freelist. */
 1405|  4.82k|                pj_list_push_back(&mgr->tp_entry_freelist, tp_iter);
 1406|       |
 1407|  4.82k|                break;
 1408|  4.82k|            }
 1409|      0|            tp_iter = tp_iter->next;
 1410|      0|        } while (tp_iter != tp_ref);
  ------------------
  |  Branch (1410:18): [True: 0, False: 0]
  ------------------
 1411|       |
 1412|  4.82k|        if (tp_iter->tp != tp) {
  ------------------
  |  Branch (1412:13): [True: 0, False: 4.82k]
  ------------------
 1413|      0|            PJ_LOG(3, (THIS_FILE, "Warning: transport %s being destroyed is "
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1414|      0|                                  "not registered", tp->obj_name));
 1415|      0|        }
 1416|  4.82k|    } else {
 1417|      0|        PJ_LOG(3, (THIS_FILE, "Warning: transport %s being destroyed is "
  ------------------
  |  |  106|      0|#define PJ_LOG(level,arg)       do { \
  |  |  107|      0|                                    if (level <= pj_log_get_level()) { \
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 0, False: 0]
  |  |  ------------------
  |  |  108|      0|                                        pj_log_wrapper_##level(arg); \
  |  |  109|      0|                                    } \
  |  |  110|      0|                                } while (0)
  |  |  ------------------
  |  |  |  Branch (110:42): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1418|      0|                              "not found in the hash table", tp->obj_name));
 1419|      0|    }
 1420|       |
 1421|      0|    pj_lock_release(mgr->lock);
 1422|  4.82k|    pj_lock_release(tp->lock);
 1423|       |
 1424|       |    /* Dec ref transport group lock, if any */
 1425|  4.82k|    if (tp->grp_lock) {
  ------------------
  |  Branch (1425:9): [True: 0, False: 4.82k]
  ------------------
 1426|      0|        pj_grp_lock_dec_ref(tp->grp_lock);
 1427|      0|    }
 1428|       |
 1429|       |    /* Destroy. */
 1430|  4.82k|    return tp->destroy(tp);
 1431|  4.82k|}

pjsip_loop_start:
  356|  4.82k|{
  357|  4.82k|    pj_pool_t *pool;
  358|  4.82k|    struct loop_transport *loop;
  359|  4.82k|    pj_status_t status;
  360|       |
  361|       |    /* Create pool. */
  362|  4.82k|    pool = pjsip_endpt_create_pool(endpt, "loop", 4000, 4000);
  363|  4.82k|    if (!pool)
  ------------------
  |  Branch (363:9): [True: 0, False: 4.82k]
  ------------------
  364|      0|        return PJ_ENOMEM;
  ------------------
  |  |  348|      0|#define PJ_ENOMEM           (PJ_ERRNO_START_STATUS + 7) /* 70007 */
  |  |  ------------------
  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  ------------------
  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  365|       |
  366|       |    /* Create the loop structure. */
  367|  4.82k|    loop = PJ_POOL_ZALLOC_T(pool, struct loop_transport);
  ------------------
  |  |  520|  4.82k|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  368|       |    
  369|       |    /* Initialize transport properties. */
  370|  4.82k|    pj_ansi_snprintf(loop->base.obj_name, sizeof(loop->base.obj_name), 
  ------------------
  |  |  114|  4.82k|#define pj_ansi_snprintf        snprintf
  ------------------
  371|  4.82k|                     "loop%p", loop);
  372|  4.82k|    loop->base.pool = pool;
  373|  4.82k|    status = pj_atomic_create(pool, 0, &loop->base.ref_cnt);
  374|  4.82k|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (374:9): [True: 0, False: 4.82k]
  ------------------
  375|      0|        goto on_error;
  376|  4.82k|    status = pj_lock_create_recursive_mutex(pool, "loop", &loop->base.lock);
  377|  4.82k|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (377:9): [True: 0, False: 4.82k]
  ------------------
  378|      0|        goto on_error;
  379|  4.82k|    loop->base.key.type = PJSIP_TRANSPORT_LOOP_DGRAM;
  380|       |    //loop->base.key.rem_addr.addr.sa_family = pj_AF_INET();
  381|  4.82k|    loop->base.type_name = "LOOP-DGRAM";
  382|  4.82k|    loop->base.info = "LOOP-DGRAM";
  383|  4.82k|    loop->base.flag = PJSIP_TRANSPORT_DATAGRAM;
  384|  4.82k|    loop->base.local_name.host = pj_str(ADDR_LOOP_DGRAM);
  ------------------
  |  |   31|  4.82k|#define ADDR_LOOP_DGRAM "129.0.0.1"
  ------------------
  385|  4.82k|    loop->base.local_name.port = 
  386|  4.82k|        pjsip_transport_get_default_port_for_type((pjsip_transport_type_e)
  387|  4.82k|                                                  loop->base.key.type);
  388|  4.82k|    loop->base.addr_len = sizeof(pj_sockaddr_in);
  389|  4.82k|    loop->base.dir = PJSIP_TP_DIR_NONE;
  390|  4.82k|    loop->base.endpt = endpt;
  391|  4.82k|    loop->base.tpmgr = pjsip_endpt_get_tpmgr(endpt);
  392|  4.82k|    loop->base.send_msg = &loop_send_msg;
  393|  4.82k|    loop->base.destroy = &loop_destroy;
  394|       |
  395|  4.82k|    pj_list_init(&loop->recv_list);
  396|  4.82k|    pj_list_init(&loop->send_list);
  397|       |
  398|       |    /* Create worker thread. */
  399|  4.82k|    status = pj_thread_create(pool, "loop", 
  400|  4.82k|                              &loop_transport_worker_thread, loop, 0, 
  401|  4.82k|                              PJ_THREAD_SUSPENDED, &loop->thread);
  402|  4.82k|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (402:9): [True: 0, False: 4.82k]
  ------------------
  403|      0|        goto on_error;
  404|       |
  405|       |    /* Register to transport manager. */
  406|  4.82k|    status = pjsip_transport_register( loop->base.tpmgr, &loop->base);
  407|  4.82k|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (407:9): [True: 0, False: 4.82k]
  ------------------
  408|      0|        goto on_error;
  409|       |
  410|       |    /* Start the thread. */
  411|  4.82k|    status = pj_thread_resume(loop->thread);
  412|  4.82k|    if (status != PJ_SUCCESS)
  ------------------
  |  Branch (412:9): [True: 0, False: 4.82k]
  ------------------
  413|      0|        goto on_error;
  414|       |
  415|       |    /*
  416|       |     * Done.
  417|       |     */
  418|       |
  419|  4.82k|    if (transport)
  ------------------
  |  Branch (419:9): [True: 0, False: 4.82k]
  ------------------
  420|      0|        *transport = &loop->base;
  421|       |
  422|  4.82k|    return PJ_SUCCESS;
  423|       |
  424|      0|on_error:
  425|      0|    if (loop->base.lock)
  ------------------
  |  Branch (425:9): [True: 0, False: 0]
  ------------------
  426|      0|        pj_lock_destroy(loop->base.lock);
  427|      0|    if (loop->thread)
  ------------------
  |  Branch (427:9): [True: 0, False: 0]
  ------------------
  428|      0|        pj_thread_destroy(loop->thread);
  429|      0|    if (loop->base.ref_cnt)
  ------------------
  |  Branch (429:9): [True: 0, False: 0]
  ------------------
  430|      0|        pj_atomic_destroy(loop->base.ref_cnt);
  431|      0|    pjsip_endpt_release_pool(endpt, loop->pool);
  432|      0|    return status;
  433|  4.82k|}
sip_transport_loop.c:loop_destroy:
  219|  4.82k|{
  220|  4.82k|    struct loop_transport *loop = (struct loop_transport*)tp;
  221|       |    
  222|  4.82k|    PJ_ASSERT_RETURN(tp && (tp->key.type == PJSIP_TRANSPORT_LOOP ||
  ------------------
  |  |   59|  4.82k|            do { \
  |  |   60|  19.2k|                if (!(expr)) { pj_assert(expr); return retval; } \
  |  |  ------------------
  |  |  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 0, False: 4.82k]
  |  |  |  Branch (60:23): [True: 4.82k, False: 0]
  |  |  |  Branch (60:23): [True: 4.82k, False: 0]
  |  |  ------------------
  |  |   61|  4.82k|            } while (0)
  |  |  ------------------
  |  |  |  Branch (61:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  223|  4.82k|                     tp->key.type == PJSIP_TRANSPORT_LOOP_DGRAM), PJ_EINVAL);
  224|       |    
  225|  4.82k|    loop->thread_quit_flag = 1;
  226|       |    /* Unlock transport mutex before joining thread. */
  227|       |    /// This raised assertion failed "mutex->owner == pj_thread_this()",
  228|       |    /// where mutex->owner==NULL
  229|       |    //pj_lock_release(tp->lock);
  230|  4.82k|    pj_thread_join(loop->thread);
  231|  4.82k|    pj_thread_destroy(loop->thread);
  232|       |
  233|       |    /* Clear pending send notifications. */
  234|  4.82k|    while (!pj_list_empty(&loop->send_list)) {
  ------------------
  |  Branch (234:12): [True: 0, False: 4.82k]
  ------------------
  235|      0|        struct send_list *node = loop->send_list.next;
  236|       |        /* Notify callback. */
  237|      0|        if (node->callback) {
  ------------------
  |  Branch (237:13): [True: 0, False: 0]
  ------------------
  238|      0|            (*node->callback)(&loop->base, node->token, -PJSIP_ESHUTDOWN);
  ------------------
  |  |   92|      0|#define PJSIP_ESHUTDOWN         (PJSIP_ERRNO_START_PJSIP + 3)   /* 171003 */
  |  |  ------------------
  |  |  |  |   73|      0|#define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define PJSIP_ERRNO_START       (PJ_ERRNO_START_USER)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  470|      0|#define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  463|      0|#define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  456|      0|#define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  444|      0|#define PJ_ERRNO_START          20000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_STATUS   (PJ_ERRNO_START + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_SYS      (PJ_ERRNO_START_STATUS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define PJ_ERRNO_START_USER     (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  450|      0|#define PJ_ERRNO_SPACE_SIZE     50000
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  239|      0|        }
  240|      0|        pj_list_erase(node);
  241|      0|        pjsip_tx_data_dec_ref(node->tdata);
  242|      0|    }
  243|       |
  244|       |    /* Clear "incoming" packets in the queue. */
  245|  4.82k|    while (!pj_list_empty(&loop->recv_list)) {
  ------------------
  |  Branch (245:12): [True: 0, False: 4.82k]
  ------------------
  246|      0|        struct recv_list *node = loop->recv_list.next;
  247|      0|        pj_list_erase(node);
  248|      0|        pjsip_endpt_release_pool(loop->base.endpt,
  249|      0|                                 node->rdata.tp_info.pool);
  250|      0|    }
  251|       |
  252|       |    /* Self destruct.. heheh.. */
  253|  4.82k|    pj_lock_destroy(loop->base.lock);
  254|  4.82k|    pj_atomic_destroy(loop->base.ref_cnt);
  255|  4.82k|    pjsip_endpt_release_pool(loop->base.endpt, loop->base.pool);
  256|       |
  257|  4.82k|    return PJ_SUCCESS;
  258|  4.82k|}
sip_transport_loop.c:loop_transport_worker_thread:
  262|  4.82k|{
  263|  4.82k|    struct loop_transport *loop = (struct loop_transport*) arg;
  264|  4.82k|    struct recv_list r;
  265|  4.82k|    struct send_list s;
  266|       |
  267|  4.82k|    pj_list_init(&r);
  268|  4.82k|    pj_list_init(&s);
  269|       |
  270|  5.41k|    while (!loop->thread_quit_flag) {
  ------------------
  |  Branch (270:12): [True: 587, False: 4.82k]
  ------------------
  271|    587|        pj_time_val now;
  272|       |
  273|    587|        pj_thread_sleep(1);
  274|    587|        pj_gettimeofday(&now);
  275|       |
  276|    587|        pj_lock_acquire(loop->base.lock);
  277|       |
  278|       |        /* Move expired send notification to local list. */
  279|    587|        while (!pj_list_empty(&loop->send_list)) {
  ------------------
  |  Branch (279:16): [True: 0, False: 587]
  ------------------
  280|      0|            struct send_list *node = loop->send_list.next;
  281|       |
  282|       |            /* Break when next node time is greater than now. */
  283|      0|            if (PJ_TIME_VAL_GTE(node->sent_time, now))
  ------------------
  |  |  476|      0|#define PJ_TIME_VAL_GTE(t1, t2) (PJ_TIME_VAL_GT(t1,t2) || \
  |  |  ------------------
  |  |  |  |  465|      0|#define PJ_TIME_VAL_GT(t1, t2)  ((t1).sec>(t2).sec || \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (465:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  466|      0|                                ((t1).sec==(t2).sec && (t1).msec>(t2).msec))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (466:34): [True: 0, False: 0]
  |  |  |  |  |  Branch (466:56): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  477|      0|                                 PJ_TIME_VAL_EQ(t1,t2))
  |  |  ------------------
  |  |  |  |  455|      0|#define PJ_TIME_VAL_EQ(t1, t2)  ((t1).sec==(t2).sec && (t1).msec==(t2).msec)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:34): [True: 0, False: 0]
  |  |  |  |  |  Branch (455:56): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  284|      0|                break;
  285|       |
  286|       |            /* Delete this from the list. */
  287|      0|            pj_list_erase(node);
  288|       |
  289|       |            /* Add to local list. */
  290|      0|            pj_list_push_back(&s, node);
  291|      0|        }
  292|       |
  293|       |        /* Move expired "incoming" packet to local list. */
  294|    587|        while (!pj_list_empty(&loop->recv_list)) {
  ------------------
  |  Branch (294:16): [True: 0, False: 587]
  ------------------
  295|      0|            struct recv_list *node = loop->recv_list.next;
  296|       |
  297|       |            /* Break when next node time is greater than now. */
  298|      0|            if (PJ_TIME_VAL_GTE(node->rdata.pkt_info.timestamp, now))
  ------------------
  |  |  476|      0|#define PJ_TIME_VAL_GTE(t1, t2) (PJ_TIME_VAL_GT(t1,t2) || \
  |  |  ------------------
  |  |  |  |  465|      0|#define PJ_TIME_VAL_GT(t1, t2)  ((t1).sec>(t2).sec || \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (465:34): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  466|      0|                                ((t1).sec==(t2).sec && (t1).msec>(t2).msec))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (466:34): [True: 0, False: 0]
  |  |  |  |  |  Branch (466:56): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  477|      0|                                 PJ_TIME_VAL_EQ(t1,t2))
  |  |  ------------------
  |  |  |  |  455|      0|#define PJ_TIME_VAL_EQ(t1, t2)  ((t1).sec==(t2).sec && (t1).msec==(t2).msec)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:34): [True: 0, False: 0]
  |  |  |  |  |  Branch (455:56): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  299|      0|                break;
  300|       |
  301|       |            /* Delete this from the list. */
  302|      0|            pj_list_erase(node);
  303|       |
  304|       |            /* Add to local list. */
  305|      0|            pj_list_push_back(&r, node);
  306|       |
  307|      0|        }
  308|       |
  309|    587|        pj_lock_release(loop->base.lock);
  310|       |
  311|       |        /* Process send notification and incoming packet notification
  312|       |         * without holding down the loop's mutex.
  313|       |         */
  314|    587|        while (!pj_list_empty(&s)) {
  ------------------
  |  Branch (314:16): [True: 0, False: 587]
  ------------------
  315|      0|            struct send_list *node = s.next;
  316|       |
  317|      0|            pj_list_erase(node);
  318|       |
  319|       |            /* Notify callback. */
  320|      0|            if (node->callback) {
  ------------------
  |  Branch (320:17): [True: 0, False: 0]
  ------------------
  321|      0|                (*node->callback)(&loop->base, node->token, node->sent);
  322|      0|            }
  323|       |
  324|       |            /* Decrement tdata reference counter. */
  325|      0|            pjsip_tx_data_dec_ref(node->tdata);
  326|      0|        }
  327|       |
  328|       |        /* Process "incoming" packet. */
  329|    587|        while (!pj_list_empty(&r)) {
  ------------------
  |  Branch (329:16): [True: 0, False: 587]
  ------------------
  330|      0|            struct recv_list *node = r.next;
  331|      0|            pj_ssize_t size_eaten;
  332|       |
  333|      0|            pj_list_erase(node);
  334|       |
  335|       |            /* Notify transport manager about the "incoming packet" */
  336|      0|            size_eaten = pjsip_tpmgr_receive_packet(loop->base.tpmgr,
  337|      0|                                                    &node->rdata);
  338|       |
  339|       |            /* Must "eat" all the packets. */
  340|      0|            pj_assert(size_eaten == node->rdata.pkt_info.len);
  ------------------
  |  |   48|      0|#   define pj_assert(expr)   assert(expr)
  ------------------
  341|      0|            PJ_UNUSED_ARG(size_eaten);
  ------------------
  |  | 1433|      0|#define PJ_UNUSED_ARG(arg)  (void)arg
  ------------------
  342|       |
  343|       |            /* Done. */
  344|      0|            pjsip_endpt_release_pool(loop->base.endpt,
  345|      0|                                     node->rdata.tp_info.pool);
  346|      0|        }
  347|    587|    }
  348|       |
  349|  4.82k|    return 0;
  350|  4.82k|}

pjsip_param_find:
   34|  1.61k|{
   35|  1.61k|    pjsip_param *p = (pjsip_param*)param_list->next;
   36|  2.18k|    while (p != param_list) {
  ------------------
  |  Branch (36:12): [True: 607, False: 1.58k]
  ------------------
   37|    607|        if (pj_stricmp(&p->name, name)==0)
  ------------------
  |  Branch (37:13): [True: 31, False: 576]
  ------------------
   38|     31|            return p;
   39|    576|        p = p->next;
   40|    576|    }
   41|  1.58k|    return NULL;
   42|  1.61k|}
pjsip_param_clone:
   72|  1.44k|{
   73|  1.44k|    const pjsip_param *p = src_list->next;
   74|       |
   75|  1.44k|    pj_list_init(dst_list);
   76|  5.69k|    while (p && p != src_list) {
  ------------------
  |  Branch (76:12): [True: 5.69k, False: 0]
  |  Branch (76:17): [True: 4.24k, False: 1.44k]
  ------------------
   77|  4.24k|        pjsip_param *new_param = PJ_POOL_ALLOC_T(pool, pjsip_param);
  ------------------
  |  |  506|  4.24k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
   78|  4.24k|        pj_strdup(pool, &new_param->name, &p->name);
   79|  4.24k|        pj_strdup(pool, &new_param->value, &p->value);
   80|  4.24k|        pj_list_insert_before(dst_list, new_param);
   81|  4.24k|        p = p->next;
   82|  4.24k|    }
   83|  1.44k|}
pjsip_sip_uri_set_secure:
  231|  4.27k|{
  232|  4.27k|    url->vptr = secure ? &sips_url_vptr : &sip_url_vptr;
  ------------------
  |  Branch (232:17): [True: 200, False: 4.07k]
  ------------------
  233|  4.27k|}
pjsip_sip_uri_init:
  236|  4.27k|{
  237|  4.27k|    pj_bzero(url, sizeof(*url));
  238|  4.27k|    url->ttl_param = -1;
  239|  4.27k|    pjsip_sip_uri_set_secure(url, secure);
  240|  4.27k|    pj_list_init(&url->other_param);
  241|  4.27k|    pj_list_init(&url->header_param);
  242|  4.27k|}
pjsip_sip_uri_create:
  246|  4.27k|{
  247|  4.27k|    pjsip_sip_uri *url = PJ_POOL_ALLOC_T(pool, pjsip_sip_uri);
  ------------------
  |  |  506|  4.27k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
  248|  4.27k|    pjsip_sip_uri_init(url, secure);
  249|  4.27k|    return url;
  250|  4.27k|}
pjsip_name_addr_init:
  541|  26.9k|{
  542|  26.9k|    name->vptr = &name_addr_vptr;
  543|  26.9k|    name->uri = NULL;
  544|  26.9k|    name->display.slen = 0;
  545|  26.9k|    name->display.ptr = NULL;
  546|  26.9k|}
pjsip_name_addr_create:
  549|  23.6k|{
  550|  23.6k|    pjsip_name_addr *name_addr = PJ_POOL_ALLOC_T(pool, pjsip_name_addr);
  ------------------
  |  |  506|  23.6k|            ((type*)pj_pool_alloc(pool, sizeof(type)))
  ------------------
  551|  23.6k|    pjsip_name_addr_init(name_addr);
  552|  23.6k|    return name_addr;
  553|  23.6k|}
pjsip_other_uri_create:
  660|  6.61k|{
  661|  6.61k|    pjsip_other_uri *uri = PJ_POOL_ZALLOC_T(pool, pjsip_other_uri);
  ------------------
  |  |  520|  6.61k|            ((type*)pj_pool_zalloc(pool, sizeof(type)))
  ------------------
  662|  6.61k|    uri->vptr = &other_uri_vptr;
  663|  6.61k|    return uri;
  664|  6.61k|}

sipParser:
   41|  4.82k|int sipParser(char *DataFx,size_t Size){
   42|       |
   43|  4.82k|    int ret = 0;
   44|  4.82k|    pj_pool_t *pool;
   45|  4.82k|    pjsip_msg *parsed_msg = NULL;
   46|  4.82k|    pjsip_parser_err_report err_list;
   47|       |
   48|  4.82k|    pool = pjsip_endpt_create_pool(endpt, NULL, POOL_SIZE, POOL_SIZE);
  ------------------
  |  |   35|  4.82k|#define POOL_SIZE	8000
  ------------------
                  pool = pjsip_endpt_create_pool(endpt, NULL, POOL_SIZE, POOL_SIZE);
  ------------------
  |  |   35|  4.82k|#define POOL_SIZE	8000
  ------------------
   49|       |
   50|       |
   51|  4.82k|    pj_list_init(&err_list);
   52|       |
   53|  4.82k|    parsed_msg = pjsip_parse_msg(pool, DataFx, Size, &err_list);
   54|       |    
   55|  4.82k|    if (parsed_msg == NULL)
  ------------------
  |  Branch (55:9): [True: 2.44k, False: 2.38k]
  ------------------
   56|  2.44k|        ret = 1;
   57|       |
   58|  4.82k|    pjsip_endpt_release_pool(endpt, pool);
   59|       |
   60|  4.82k|    return ret;
   61|  4.82k|}
LLVMFuzzerTestOneInput:
   65|  4.84k|{/*/home/Ez/project/pjproject/pjsip/src/test/msg_test.c*/
   66|       |
   67|  4.84k|    if (Size < kMinInputLength || Size > kMaxInputLength){
  ------------------
  |  |   38|  9.69k|#define kMinInputLength 10
  ------------------
                  if (Size < kMinInputLength || Size > kMaxInputLength){
  ------------------
  |  |   39|  4.84k|#define kMaxInputLength 5120
  ------------------
  |  Branch (67:9): [True: 6, False: 4.84k]
  |  Branch (67:35): [True: 19, False: 4.82k]
  ------------------
   68|     25|        return 1;
   69|     25|    }
   70|       |
   71|       |/*Add Extra byte */
   72|  4.82k|    char *DataFx;
   73|  4.82k|    DataFx = (char *)calloc((Size+1),sizeof(char));
   74|  4.82k|    memcpy((void *)DataFx,(void *)Data,Size);
   75|       |
   76|       |
   77|       |/*init*/
   78|  4.82k|    pj_status_t rc;
   79|       |    //pj_status_t status;
   80|       |
   81|  4.82k|    pj_log_set_level(0);
   82|       |
   83|  4.82k|    rc=pj_init();
   84|  4.82k|    rc=pjlib_util_init();
   85|       |
   86|  4.82k|    pj_dump_config();
   87|       |
   88|  4.82k|    pj_caching_pool_init( &caching_pool, &pj_pool_factory_default_policy, 
   89|  4.82k|			  PJSIP_TEST_MEM_SIZE );
  ------------------
  |  |   36|  4.82k|#define PJSIP_TEST_MEM_SIZE	    (2*1024*1024)
  ------------------
   90|       |
   91|  4.82k|    rc = pjsip_endpt_create(&caching_pool.factory, "endpt", &endpt);
   92|       |
   93|       |    /* Start transaction layer module. */
   94|  4.82k|    rc = pjsip_tsx_layer_init_module(endpt);
   95|       |
   96|  4.82k|    rc = pjsip_loop_start(endpt, NULL);
   97|       |
   98|       |/*Calls*/
   99|  4.82k|    rc = sipParser(DataFx,Size);
  100|       |
  101|  4.82k|    pjsip_endpt_destroy(endpt);
  102|  4.82k|    pj_caching_pool_destroy(&caching_pool);
  103|       |
  104|  4.82k|    free(DataFx);
  105|       |
  106|  4.82k|    return rc;
  107|  4.84k|}

