Curl_altsvc_cleanup:
  375|    812|{
  376|    812|  if(*asi) {
  ------------------
  |  Branch (376:6): [True: 0, False: 812]
  ------------------
  377|      0|    struct Curl_llist_node *e;
  378|      0|    struct Curl_llist_node *n;
  379|      0|    struct altsvcinfo *altsvc = *asi;
  380|      0|    for(e = Curl_llist_head(&altsvc->list); e; e = n) {
  ------------------
  |  Branch (380:45): [True: 0, False: 0]
  ------------------
  381|      0|      struct altsvc *as = Curl_node_elem(e);
  382|      0|      n = Curl_node_next(e);
  383|      0|      altsvc_free(as);
  ------------------
  |  |   87|      0|#define altsvc_free(x) curlx_free(x)
  |  |  ------------------
  |  |  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  ------------------
  384|      0|    }
  385|      0|    curlx_free(altsvc->filename);
  ------------------
  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  ------------------
  386|      0|    curlx_free(altsvc);
  ------------------
  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  ------------------
  387|       |    *asi = NULL; /* clear the pointer */
  388|      0|  }
  389|    812|}
Curl_altsvc_save:
  396|    812|{
  397|    812|  CURLcode result = CURLE_OK;
  398|    812|  FILE *out;
  399|    812|  char *tempstore = NULL;
  400|       |
  401|    812|  if(!asi)
  ------------------
  |  Branch (401:6): [True: 812, False: 0]
  ------------------
  402|       |    /* no cache activated */
  403|    812|    return CURLE_OK;
  404|       |
  405|       |  /* if not new name is given, use the one we stored from the load */
  406|      0|  if(!file && asi->filename)
  ------------------
  |  Branch (406:6): [True: 0, False: 0]
  |  Branch (406:15): [True: 0, False: 0]
  ------------------
  407|      0|    file = asi->filename;
  408|       |
  409|      0|  if((asi->flags & CURLALTSVC_READONLYFILE) || !file || !file[0])
  ------------------
  |  | 1044|      0|#define CURLALTSVC_READONLYFILE (1L << 2)
  ------------------
  |  Branch (409:6): [True: 0, False: 0]
  |  Branch (409:48): [True: 0, False: 0]
  |  Branch (409:57): [True: 0, False: 0]
  ------------------
  410|       |    /* marked as read-only, no file or zero length filename */
  411|      0|    return CURLE_OK;
  412|       |
  413|      0|  result = Curl_fopen(data, file, &out, &tempstore);
  414|      0|  if(!result) {
  ------------------
  |  Branch (414:6): [True: 0, False: 0]
  ------------------
  415|      0|    struct Curl_llist_node *e;
  416|      0|    struct Curl_llist_node *n;
  417|      0|    fputs("# Your alt-svc cache. https://curl.se/docs/alt-svc.html\n"
  418|      0|          "# This file was generated by libcurl! Edit at your own risk.\n",
  419|      0|          out);
  420|      0|    for(e = Curl_llist_head(&asi->list); e; e = n) {
  ------------------
  |  Branch (420:42): [True: 0, False: 0]
  ------------------
  421|      0|      struct altsvc *as = Curl_node_elem(e);
  422|      0|      n = Curl_node_next(e);
  423|      0|      result = altsvc_out(as, out);
  424|      0|      if(result)
  ------------------
  |  Branch (424:10): [True: 0, False: 0]
  ------------------
  425|      0|        break;
  426|      0|    }
  427|      0|    curlx_fclose(out);
  ------------------
  |  |   88|      0|#define curlx_fclose(file)      curl_dbg_fclose(file, __LINE__, __FILE__)
  ------------------
  428|      0|    if(!result && tempstore && curlx_rename(tempstore, file))
  ------------------
  |  |   74|      0|#define curlx_rename            rename
  ------------------
  |  Branch (428:8): [True: 0, False: 0]
  |  Branch (428:19): [True: 0, False: 0]
  |  Branch (428:32): [True: 0, False: 0]
  ------------------
  429|      0|      result = CURLE_WRITE_ERROR;
  430|       |
  431|      0|    if(result && tempstore)
  ------------------
  |  Branch (431:8): [True: 0, False: 0]
  |  Branch (431:18): [True: 0, False: 0]
  ------------------
  432|      0|      unlink(tempstore);
  433|      0|  }
  434|      0|  curlx_free(tempstore);
  ------------------
  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  ------------------
  435|      0|  return result;
  436|      0|}

Curl_eapi_enter:
  191|    812|{
  192|    812|  struct Curl_easy *data = curl;
  193|    812|  const struct Curl_eapi_fn_props *fn_props;
  194|    812|  CURLcode result = CURLE_OK;
  195|       |
  196|    812|  guard->depth = 0;
  197|       |
  198|       |  /* Verify that we got an easy handle we can work with. */
  199|    812|  if(!GOOD_EASY_HANDLE(data) || data->state.internal) {
  ------------------
  |  |   34|  1.62k|  (((x) && ((x)->magic == CURLEASY_MAGIC_NUMBER)) ? TRUE : \
  |  |  ------------------
  |  |  |  |   28|    812|#define CURLEASY_MAGIC_NUMBER 0xc0dedbadU
  |  |  ------------------
  |  |                 (((x) && ((x)->magic == CURLEASY_MAGIC_NUMBER)) ? TRUE : \
  |  |  ------------------
  |  |  |  | 1016|    812|#define TRUE true
  |  |  ------------------
  |  |  |  Branch (34:5): [True: 812, False: 0]
  |  |  |  Branch (34:12): [True: 812, False: 0]
  |  |  ------------------
  |  |   35|  1.62k|   (DEBUGASSERT(!(x)), FALSE))
  |  |  ------------------
  |  |  |  | 1046|      0|#define DEBUGASSERT(x) assert(x)
  |  |  ------------------
  |  |                  (DEBUGASSERT(!(x)), FALSE))
  |  |  ------------------
  |  |  |  | 1019|      0|#define FALSE false
  |  |  ------------------
  ------------------
  |  Branch (199:6): [True: 0, False: 812]
  |  Branch (199:7): [True: 0, False: 0]
  |  Branch (199:7): [True: 0, False: 0]
  |  Branch (199:33): [True: 0, False: 812]
  ------------------
  200|      0|    result = CURLE_BAD_FUNCTION_ARGUMENT;
  201|      0|    goto out;
  202|      0|  }
  203|       |  /* verify that is either not added to a multi handle OR has a
  204|       |   * GOOD multi handle that knows `data` for `data->mid`. */
  205|    812|  if(data->mid != UINT32_MAX) {
  ------------------
  |  Branch (205:6): [True: 0, False: 812]
  ------------------
  206|      0|    if(GOOD_MULTI_HANDLE(data->multi)) {
  ------------------
  |  |   48|      0|  (((x) && (x)->magic == CURLMULTI_MAGIC_NUMBER) ? TRUE : \
  |  |  ------------------
  |  |  |  |   41|      0|#define CURLMULTI_MAGIC_NUMBER 0x000bab1e
  |  |  ------------------
  |  |                 (((x) && (x)->magic == CURLMULTI_MAGIC_NUMBER) ? TRUE : \
  |  |  ------------------
  |  |  |  | 1016|      0|#define TRUE true
  |  |  ------------------
  |  |  |  Branch (48:3): [True: 0, False: 0]
  |  |  |  Branch (48:5): [True: 0, False: 0]
  |  |  |  Branch (48:12): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|  (DEBUGASSERT(!(x)), FALSE))
  |  |  ------------------
  |  |  |  | 1046|      0|#define DEBUGASSERT(x) assert(x)
  |  |  ------------------
  |  |                 (DEBUGASSERT(!(x)), FALSE))
  |  |  ------------------
  |  |  |  | 1019|      0|#define FALSE false
  |  |  ------------------
  ------------------
  |  Branch (206:8): [True: 0, False: 0]
  |  Branch (206:8): [True: 0, False: 0]
  ------------------
  207|      0|      if(!Curl_multi_knows_easy(data->multi, data)) {
  ------------------
  |  Branch (207:10): [True: 0, False: 0]
  ------------------
  208|       |        /* But multi does not know it, something is fishy, better deny call */
  209|      0|        DEBUGASSERT(0);
  ------------------
  |  | 1046|      0|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (209:9): [Folded, False: 0]
  |  Branch (209:9): [Folded, False: 0]
  ------------------
  210|      0|        result = CURLE_BAD_FUNCTION_ARGUMENT;
  211|      0|        goto out;
  212|      0|      }
  213|      0|    }
  214|      0|    else {
  215|      0|      DEBUGASSERT(0); /* data needs to have a GOOD multi handle */
  ------------------
  |  | 1046|      0|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (215:7): [Folded, False: 0]
  |  Branch (215:7): [Folded, False: 0]
  ------------------
  216|      0|      result = CURLE_BAD_FUNCTION_ARGUMENT;
  217|      0|      goto out;
  218|      0|    }
  219|      0|  }
  220|    812|  else if(data->multi) {
  ------------------
  |  Branch (220:11): [True: 0, False: 812]
  ------------------
  221|      0|    DEBUGASSERT(0); /* data should not have a multi handle */
  ------------------
  |  | 1046|      0|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (221:5): [Folded, False: 0]
  |  Branch (221:5): [Folded, False: 0]
  ------------------
  222|      0|    result = CURLE_BAD_FUNCTION_ARGUMENT;
  223|      0|    goto out;
  224|      0|  }
  225|       |  /* verify that the call `fn` we're about to enter is known
  226|       |   * and check call properties to be admitting. */
  227|    812|  if(fn >= CURL_EAPI_FN_LAST) {
  ------------------
  |  Branch (227:6): [True: 0, False: 812]
  ------------------
  228|      0|    result = CURLE_BAD_FUNCTION_ARGUMENT;
  229|      0|    goto out;
  230|      0|  }
  231|    812|  fn_props = &eapi_fn_props[fn];
  232|    812|  DEBUGASSERT(fn_props->fn == fn);
  ------------------
  |  | 1046|    812|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (232:3): [True: 0, False: 812]
  |  Branch (232:3): [True: 812, False: 0]
  ------------------
  233|    812|  if(!fn_props->recurse) {
  ------------------
  |  Branch (233:6): [True: 812, False: 0]
  ------------------
  234|    812|    if(data->callstack.count) {
  ------------------
  |  Branch (234:8): [True: 0, False: 812]
  ------------------
  235|      0|#ifdef CURLVERBOSE
  236|      0|      DEBUGF(curl_mfprintf(stderr,
  ------------------
  |  | 1032|      0|#define DEBUGF(x) x
  ------------------
  237|      0|        "EAPI guard: calling %hu with call to %u ongoing\n", (uint16_t)fn,
  238|      0|        data->callstack.calls[data->callstack.count - 1]));
  239|      0|#endif
  240|      0|      result = CURLE_RECURSIVE_API_CALL;
  241|      0|      goto out;
  242|      0|    }
  243|    812|    if(data->multi && data->multi->callstack.count) {
  ------------------
  |  Branch (243:8): [True: 0, False: 812]
  |  Branch (243:23): [True: 0, False: 0]
  ------------------
  244|      0|#ifdef CURLVERBOSE
  245|       |
  246|      0|      DEBUGF(curl_mfprintf(stderr,
  ------------------
  |  | 1032|      0|#define DEBUGF(x) x
  ------------------
  247|      0|        "EAPI guard: calling %hu with multi call to %u ongoing\n",
  248|      0|        (uint16_t)fn,
  249|      0|        data->multi->callstack.calls[data->multi->callstack.count - 1]));
  250|      0|#endif
  251|      0|      result = CURLE_RECURSIVE_API_CALL;
  252|      0|      goto out;
  253|      0|    }
  254|    812|  }
  255|       |
  256|    812|  if(fn_props->no_event_cb && eapi_in_event_cb(data)) {
  ------------------
  |  Branch (256:6): [True: 0, False: 812]
  |  Branch (256:31): [True: 0, False: 0]
  ------------------
  257|       |    /* Not allowed to be invoked while an event cb is ongoing */
  258|      0|#ifdef CURLVERBOSE
  259|      0|      DEBUGF(curl_mfprintf(stderr,
  ------------------
  |  | 1032|      0|#define DEBUGF(x) x
  ------------------
  260|      0|        "EAPI guard: calling %hu while event callback ongoing\n",
  261|      0|        (uint16_t)fn));
  262|      0|#endif
  263|      0|    result = CURLE_RECURSIVE_API_CALL;
  264|      0|    goto out;
  265|      0|  }
  266|       |
  267|    812|#if defined(USE_SSL) && defined(USE_MUTEX)
  268|    812|  if(fn_props->no_scache_lock &&
  ------------------
  |  Branch (268:6): [True: 0, False: 812]
  ------------------
  269|      0|     Curl_ssl_scache_is_locked_by_current_thread(data)) {
  ------------------
  |  Branch (269:6): [True: 0, False: 0]
  ------------------
  270|      0|#ifdef CURLVERBOSE
  271|      0|      DEBUGF(curl_mfprintf(stderr,
  ------------------
  |  | 1032|      0|#define DEBUGF(x) x
  ------------------
  272|      0|        "EAPI guard: calling %hu while vtls_scache is locked by "
  273|      0|        "current thread\n", (uint16_t)fn));
  274|      0|#endif
  275|      0|    result = CURLE_RECURSIVE_API_CALL;
  276|      0|    goto out;
  277|      0|  }
  278|    812|#endif
  279|       |
  280|       |  /* all fine, add to data's callstack */
  281|    812|  if(data->callstack.count >= CURL_EAPI_MAX_RECURSION) {
  ------------------
  |  |  139|    812|#define CURL_EAPI_MAX_RECURSION       7
  ------------------
  |  Branch (281:6): [True: 0, False: 812]
  ------------------
  282|      0|    result = CURLE_RECURSIVE_API_CALL;
  283|      0|    goto out;
  284|      0|  }
  285|    812|  data->callstack.calls[data->callstack.count] = (uint16_t)fn;
  286|    812|  ++data->callstack.count;
  287|    812|  guard->depth = data->callstack.count;
  288|    812|  guard->data = fn_props->data_is_killed ? NULL : data;
  ------------------
  |  Branch (288:17): [True: 812, False: 0]
  ------------------
  289|       |
  290|    812|out:
  291|    812|  if(presult)
  ------------------
  |  Branch (291:6): [True: 0, False: 812]
  ------------------
  292|      0|    *presult = result;
  293|    812|  return guard->depth > 0;
  294|    812|}
Curl_eapi_leave:
  297|    812|{
  298|    812|  if(guard->depth) {
  ------------------
  |  Branch (298:6): [True: 812, False: 0]
  ------------------
  299|       |    /* guard->data is set when handle is supposed to stay alive during call */
  300|    812|    if(guard->data && GOOD_EASY_HANDLE(guard->data)) {
  ------------------
  |  |   34|      0|  (((x) && ((x)->magic == CURLEASY_MAGIC_NUMBER)) ? TRUE : \
  |  |  ------------------
  |  |  |  |   28|      0|#define CURLEASY_MAGIC_NUMBER 0xc0dedbadU
  |  |  ------------------
  |  |                 (((x) && ((x)->magic == CURLEASY_MAGIC_NUMBER)) ? TRUE : \
  |  |  ------------------
  |  |  |  | 1016|      0|#define TRUE true
  |  |  ------------------
  |  |  |  Branch (34:3): [True: 0, False: 0]
  |  |  |  Branch (34:5): [True: 0, False: 0]
  |  |  |  Branch (34:12): [True: 0, False: 0]
  |  |  ------------------
  |  |   35|      0|   (DEBUGASSERT(!(x)), FALSE))
  |  |  ------------------
  |  |  |  | 1046|      0|#define DEBUGASSERT(x) assert(x)
  |  |  ------------------
  |  |                  (DEBUGASSERT(!(x)), FALSE))
  |  |  ------------------
  |  |  |  | 1019|      0|#define FALSE false
  |  |  ------------------
  ------------------
  |  Branch (300:8): [True: 0, False: 812]
  |  Branch (300:23): [True: 0, False: 0]
  |  Branch (300:23): [True: 0, False: 0]
  ------------------
  301|      0|      if(guard->depth > guard->data->callstack.count) {
  ------------------
  |  Branch (301:10): [True: 0, False: 0]
  ------------------
  302|      0|        DEBUGASSERT(0); /* something very wrong */
  ------------------
  |  | 1046|      0|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (302:9): [Folded, False: 0]
  |  Branch (302:9): [Folded, False: 0]
  ------------------
  303|      0|      }
  304|      0|      else {
  305|      0|        if(guard->depth < guard->data->callstack.count) {
  ------------------
  |  Branch (305:12): [True: 0, False: 0]
  ------------------
  306|      0|          DEBUGASSERT(0); /* someone forgot to clean up */
  ------------------
  |  | 1046|      0|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (306:11): [Folded, False: 0]
  |  Branch (306:11): [Folded, False: 0]
  ------------------
  307|      0|        }
  308|       |        /* reset to depth the guard was entered in */
  309|      0|        guard->data->callstack.count = (uint16_t)(guard->depth - 1);
  310|      0|      }
  311|      0|    }
  312|    812|  }
  313|    812|}

Curl_bufref_init:
   38|  1.62k|{
   39|  1.62k|  DEBUGASSERT(br);
  ------------------
  |  | 1046|  1.62k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (39:3): [True: 0, False: 1.62k]
  |  Branch (39:3): [True: 1.62k, False: 0]
  ------------------
   40|  1.62k|  br->dtor = NULL;
   41|  1.62k|  br->ptr = NULL;
   42|  1.62k|  br->len = 0;
   43|       |
   44|  1.62k|#ifdef DEBUGBUILD
   45|  1.62k|  br->signature = SIGNATURE;
  ------------------
  |  |   31|  1.62k|#define SIGNATURE 0x5c48e9b2    /* Random pattern. */
  ------------------
   46|  1.62k|#endif
   47|  1.62k|}
Curl_bufref_free:
   55|  2.43k|{
   56|  2.43k|  DEBUGASSERT(br);
  ------------------
  |  | 1046|  2.43k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (56:3): [True: 0, False: 2.43k]
  |  Branch (56:3): [True: 2.43k, False: 0]
  ------------------
   57|  2.43k|  DEBUGASSERT(br->signature == SIGNATURE);
  ------------------
  |  | 1046|  2.43k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (57:3): [True: 0, False: 2.43k]
  |  Branch (57:3): [True: 2.43k, False: 0]
  ------------------
   58|  2.43k|  DEBUGASSERT(br->ptr || !br->len);
  ------------------
  |  | 1046|  2.43k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (58:3): [True: 2.43k, False: 0]
  |  Branch (58:3): [True: 0, False: 0]
  |  Branch (58:3): [True: 0, False: 2.43k]
  |  Branch (58:3): [True: 2.43k, False: 0]
  ------------------
   59|       |
   60|  2.43k|  if(br->ptr && br->dtor)
  ------------------
  |  Branch (60:6): [True: 0, False: 2.43k]
  |  Branch (60:17): [True: 0, False: 0]
  ------------------
   61|      0|    br->dtor(CURL_UNCONST(br->ptr));
  ------------------
  |  |  827|      0|#define CURL_UNCONST(p) ((void *)(uintptr_t)(const void *)(p))
  ------------------
   62|       |
   63|  2.43k|  br->dtor = NULL;
   64|       |  br->ptr = NULL;
   65|  2.43k|  br->len = 0;
   66|  2.43k|}

Curl_flush_cookies:
 1665|    812|{
 1666|    812|  Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);
 1667|       |  /* only save the cookie file if a transfer was started (cookies->running is
 1668|       |     set), as otherwise the cookies were not completely initialized and there
 1669|       |     might be cookie files that were not loaded so saving the file is the
 1670|       |     wrong thing. */
 1671|    812|  if(data->cookies) {
  ------------------
  |  Branch (1671:6): [True: 0, False: 812]
  ------------------
 1672|      0|    const char *cookiejar = CURL_EASY_STR(data, STRING_COOKIEJAR);
  ------------------
  |  | 1233|      0|  Curl_u8_strset_get(&(d)->set.strings, (uint8_t)(id))
  ------------------
 1673|      0|    if(cookiejar && data->cookies->running) {
  ------------------
  |  Branch (1673:8): [True: 0, False: 0]
  |  Branch (1673:21): [True: 0, False: 0]
  ------------------
 1674|       |      /* if we have a destination file for all the cookies to get dumped to */
 1675|      0|      CURLcode result = cookie_output(data, data->cookies, cookiejar);
 1676|      0|      if(result)
  ------------------
  |  Branch (1676:10): [True: 0, False: 0]
  ------------------
 1677|      0|        infof(data, "WARNING: failed to save cookies in %s: %s",
  ------------------
  |  |  143|      0|  do {                               \
  |  |  144|      0|    if(Curl_trc_is_verbose(data))    \
  |  |  ------------------
  |  |  |  |  322|      0|  ((data) && (data)->set.verbose &&                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (322:4): [True: 0, False: 0]
  |  |  |  |  |  Branch (322:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  323|      0|   (!(data)->state.feat ||                                 \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (323:5): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  324|      0|    ((data)->state.feat->log_level >= CURL_LOG_LVL_INFO)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|      0|#define CURL_LOG_LVL_INFO  1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (324:5): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  145|      0|      Curl_infof(data, __VA_ARGS__); \
  |  |  146|      0|  } while(0)
  |  |  ------------------
  |  |  |  Branch (146:11): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1678|      0|              cookiejar, curl_easy_strerror(result));
 1679|      0|    }
 1680|       |
 1681|      0|    if(cleanup && (!data->share || (data->cookies != data->share->cookies))) {
  ------------------
  |  Branch (1681:8): [True: 0, False: 0]
  |  Branch (1681:20): [True: 0, False: 0]
  |  Branch (1681:36): [True: 0, False: 0]
  ------------------
 1682|      0|      Curl_cookie_cleanup(data->cookies);
 1683|       |      data->cookies = NULL;
 1684|      0|    }
 1685|      0|  }
 1686|    812|  Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);
 1687|    812|}

Curl_creds_create:
   41|     82|{
   42|     82|  struct Curl_creds *creds = NULL;
   43|     82|  size_t ulen = user ? strlen(user) : 0;
  ------------------
  |  Branch (43:17): [True: 73, False: 9]
  ------------------
   44|     82|  size_t plen = passwd ? strlen(passwd) : 0;
  ------------------
  |  Branch (44:17): [True: 40, False: 42]
  ------------------
   45|     82|  size_t olen = oauth_bearer ? strlen(oauth_bearer) : 0;
  ------------------
  |  Branch (45:17): [True: 0, False: 82]
  ------------------
   46|     82|  size_t salen = sasl_authzid ? strlen(sasl_authzid) : 0;
  ------------------
  |  Branch (46:18): [True: 0, False: 82]
  ------------------
   47|     82|  size_t sslen = sasl_service ? strlen(sasl_service) : 0;
  ------------------
  |  Branch (47:18): [True: 0, False: 82]
  ------------------
   48|     82|  char *s, *buf;
   49|     82|  size_t bufsize;
   50|     82|  CURLcode result = CURLE_OK;
   51|       |
   52|     82|  Curl_creds_unlink(pcreds);
   53|       |
   54|       |  /* Everything empty/NULL, this is the NULL credential */
   55|     82|  if(!user && !passwd && !olen && !salen && !sslen)
  ------------------
  |  Branch (55:6): [True: 9, False: 73]
  |  Branch (55:15): [True: 0, False: 9]
  |  Branch (55:26): [True: 0, False: 0]
  |  Branch (55:35): [True: 0, False: 0]
  |  Branch (55:45): [True: 0, False: 0]
  ------------------
   56|      0|    goto out;
   57|       |
   58|     82|  if((ulen > CURL_MAX_INPUT_LENGTH) ||
  ------------------
  |  |   45|     82|#define CURL_MAX_INPUT_LENGTH 8000000
  ------------------
  |  Branch (58:6): [True: 0, False: 82]
  ------------------
   59|     82|     (plen > CURL_MAX_INPUT_LENGTH) ||
  ------------------
  |  |   45|     82|#define CURL_MAX_INPUT_LENGTH 8000000
  ------------------
  |  Branch (59:6): [True: 0, False: 82]
  ------------------
   60|     82|     (olen > CURL_MAX_INPUT_LENGTH) ||
  ------------------
  |  |   45|     82|#define CURL_MAX_INPUT_LENGTH 8000000
  ------------------
  |  Branch (60:6): [True: 0, False: 82]
  ------------------
   61|     82|     (salen > CURL_MAX_INPUT_LENGTH) ||
  ------------------
  |  |   45|     82|#define CURL_MAX_INPUT_LENGTH 8000000
  ------------------
  |  Branch (61:6): [True: 0, False: 82]
  ------------------
   62|     82|     (sslen > CURL_MAX_INPUT_LENGTH)) {
  ------------------
  |  |   45|     82|#define CURL_MAX_INPUT_LENGTH 8000000
  ------------------
  |  Branch (62:6): [True: 0, False: 82]
  ------------------
   63|      0|    result = CURLE_BAD_FUNCTION_ARGUMENT;
   64|      0|    goto out;
   65|      0|  }
   66|       |
   67|       |  /* null-terminator for user already part of struct */
   68|     82|  bufsize = ulen + plen + 1 + olen + 1 + salen + 1 + sslen + 1;
   69|     82|  creds = curlx_calloc(1, sizeof(*creds) + bufsize);
  ------------------
  |  | 1444|     82|  curl_dbg_calloc(nbelem, size, __LINE__, __FILE__)
  ------------------
   70|     82|  if(!creds) {
  ------------------
  |  Branch (70:6): [True: 0, False: 82]
  ------------------
   71|      0|    result = CURLE_OUT_OF_MEMORY;
   72|      0|    goto out;
   73|      0|  }
   74|       |
   75|     82|  creds->bufsize = bufsize;
   76|     82|  creds->refcount = 1;
   77|     82|  creds->source = source;
   78|       |  /* Some compilers try to be too smart about our dynamic struct size */
   79|     82|  buf = ((char *)creds) + offsetof(struct Curl_creds, buf);
   80|     82|  creds->user = s = buf;
   81|     82|  if(ulen)
  ------------------
  |  Branch (81:6): [True: 63, False: 19]
  ------------------
   82|     63|    memcpy(s, user, ulen + 1);
   83|     82|  creds->passwd = s = buf + ulen + 1;
   84|     82|  if(plen)
  ------------------
  |  Branch (84:6): [True: 34, False: 48]
  ------------------
   85|     34|    memcpy(s, passwd, plen + 1);
   86|     82|  creds->oauth_bearer = s = buf + ulen + 1 + plen + 1;
   87|     82|  if(olen)
  ------------------
  |  Branch (87:6): [True: 0, False: 82]
  ------------------
   88|      0|    memcpy(s, oauth_bearer, olen + 1);
   89|     82|  creds->sasl_authzid = s = buf + ulen + 1 + plen + 1 + olen + 1;
   90|     82|  if(salen)
  ------------------
  |  Branch (90:6): [True: 0, False: 82]
  ------------------
   91|      0|    memcpy(s, sasl_authzid, salen + 1);
   92|     82|  creds->sasl_service = s = buf + ulen + 1 + plen + 1 + olen + 1 + salen + 1;
   93|     82|  if(sslen)
  ------------------
  |  Branch (93:6): [True: 0, False: 82]
  ------------------
   94|      0|    memcpy(s, sasl_service, sslen + 1);
   95|       |
   96|     82|out:
   97|     82|  if(!result)
  ------------------
  |  Branch (97:6): [True: 82, False: 0]
  ------------------
   98|     82|    *pcreds = creds;
   99|      0|  else
  100|      0|    Curl_creds_unlink(&creds);
  101|     82|  return result;
  102|     82|}
Curl_creds_link:
  131|     82|{
  132|     82|  if(*pdest != src) {
  ------------------
  |  Branch (132:6): [True: 82, False: 0]
  ------------------
  133|     82|    Curl_creds_unlink(pdest);
  134|     82|    *pdest = src;
  135|     82|    if(src) {
  ------------------
  |  Branch (135:8): [True: 82, False: 0]
  ------------------
  136|     82|      DEBUGASSERT(src->refcount < UINT32_MAX);
  ------------------
  |  | 1046|     82|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (136:7): [True: 0, False: 82]
  |  Branch (136:7): [True: 82, False: 0]
  ------------------
  137|     82|      src->refcount++;
  138|     82|    }
  139|     82|  }
  140|     82|}
Curl_creds_unlink:
  143|  6.57k|{
  144|  6.57k|  if(*pcreds) {
  ------------------
  |  Branch (144:6): [True: 164, False: 6.40k]
  ------------------
  145|    164|    struct Curl_creds *creds = *pcreds;
  146|       |
  147|    164|    DEBUGASSERT(creds->refcount);
  ------------------
  |  | 1046|    164|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (147:5): [True: 0, False: 164]
  |  Branch (147:5): [True: 164, False: 0]
  ------------------
  148|    164|    *pcreds = NULL;
  149|    164|    if(creds->refcount)
  ------------------
  |  Branch (149:8): [True: 164, False: 0]
  ------------------
  150|    164|      creds->refcount--;
  151|    164|    if(!creds->refcount) {
  ------------------
  |  Branch (151:8): [True: 82, False: 82]
  ------------------
  152|     82|      curlx_memzero(creds, sizeof(*creds) + creds->bufsize);
  153|     82|      curlx_free(creds);
  ------------------
  |  | 1447|     82|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  ------------------
  154|     82|    }
  155|    164|  }
  156|  6.57k|}

Curl_get_line:
   36|  71.8k|{
   37|  71.8k|  CURLcode result;
   38|  71.8k|  char buffer[128];
   39|  71.8k|  curlx_dyn_reset(buf);
   40|  90.4k|  while(1) {
  ------------------
  |  Branch (40:9): [True: 90.4k, Folded]
  ------------------
   41|  90.4k|    size_t rlen;
   42|  90.4k|    const char *b = fgets(buffer, sizeof(buffer), input);
   43|  90.4k|    if(!b && ferror(input))
  ------------------
  |  Branch (43:8): [True: 118, False: 90.3k]
  |  Branch (43:14): [True: 0, False: 118]
  ------------------
   44|      0|      return CURLE_READ_ERROR;
   45|       |
   46|  90.4k|    *eof = feof(input);
   47|       |
   48|  90.4k|    rlen = b ? strlen(b) : 0;
  ------------------
  |  Branch (48:12): [True: 90.3k, False: 118]
  ------------------
   49|  90.4k|    if(rlen) {
  ------------------
  |  Branch (49:8): [True: 89.7k, False: 721]
  ------------------
   50|  89.7k|      result = curlx_dyn_addn(buf, b, rlen);
   51|  89.7k|      if(result)
  ------------------
  |  Branch (51:10): [True: 2, False: 89.7k]
  ------------------
   52|       |        /* too long line or out of memory */
   53|      2|        return result;
   54|  89.7k|    }
   55|       |    /* now check the full line */
   56|  90.4k|    rlen = curlx_dyn_len(buf);
   57|  90.4k|    b = curlx_dyn_ptr(buf);
   58|  90.4k|    if(rlen && (b[rlen - 1] == '\n'))
  ------------------
  |  Branch (58:8): [True: 89.9k, False: 513]
  |  Branch (58:16): [True: 70.9k, False: 18.9k]
  ------------------
   59|       |      /* LF at end of the line */
   60|  70.9k|      return CURLE_OK; /* all good */
   61|  19.4k|    if(*eof)
  ------------------
  |  Branch (61:8): [True: 810, False: 18.6k]
  ------------------
   62|       |      /* append a newline */
   63|    810|      return curlx_dyn_addn(buf, "\n", 1);
   64|       |    /* otherwise get next line to append */
   65|  19.4k|  }
   66|       |  /* UNREACHABLE */
   67|  71.8k|}

Curl_share_lock_share:
  378|    812|{
  379|    812|  if(!share)
  ------------------
  |  Branch (379:6): [True: 812, False: 0]
  ------------------
  380|    812|    return CURLSHE_INVALID;
  381|       |
  382|      0|  if(share->specifier & (unsigned int)(1 << type) &&
  ------------------
  |  Branch (382:6): [True: 0, False: 0]
  ------------------
  383|      0|     share->lockfunc) /* only call this if set! */
  ------------------
  |  Branch (383:6): [True: 0, False: 0]
  ------------------
  384|      0|    share->lockfunc(data, type, accesstype, share->clientdata);
  385|       |  /* else if we do not share this, pretend successful lock */
  386|       |
  387|      0|  return CURLSHE_OK;
  388|    812|}
Curl_share_lock:
  392|    812|{
  393|    812|  return Curl_share_lock_share(data->share, data, type, accesstype);
  394|    812|}
Curl_share_unlock_share:
  399|    812|{
  400|    812|  if(!share)
  ------------------
  |  Branch (400:6): [True: 812, False: 0]
  ------------------
  401|    812|    return CURLSHE_INVALID;
  402|       |
  403|      0|  if(share->specifier & (unsigned int)(1 << type) &&
  ------------------
  |  Branch (403:6): [True: 0, False: 0]
  ------------------
  404|      0|     share->unlockfunc) /* only call this if set! */
  ------------------
  |  Branch (404:6): [True: 0, False: 0]
  ------------------
  405|      0|    share->unlockfunc(data, type, share->clientdata);
  406|       |
  407|      0|  return CURLSHE_OK;
  408|    812|}
Curl_share_unlock:
  411|    812|{
  412|    812|  return Curl_share_unlock_share(data->share, data, type);
  413|    812|}
Curl_share_easy_unlink:
  416|    812|{
  417|    812|  struct Curl_share *share = data->share;
  418|       |
  419|    812|  if(share) {
  ------------------
  |  Branch (419:6): [True: 0, False: 812]
  ------------------
  420|      0|    bool locked = share_lock_acquire(share, data);
  421|       |
  422|       |    /* If share caches connections, detach any existing connection and
  423|       |     * forget its identifier. */
  424|      0|    if((share->specifier & (1 << CURL_LOCK_DATA_CONNECT))) {
  ------------------
  |  Branch (424:8): [True: 0, False: 0]
  ------------------
  425|      0|      if(data->conn)
  ------------------
  |  Branch (425:10): [True: 0, False: 0]
  ------------------
  426|      0|        Curl_detach_connection(data);
  427|      0|      data->state.last_conn_id = -1;
  428|      0|      data->state.last_cpid = UINT32_MAX;
  429|      0|    }
  430|       |
  431|      0|#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
  432|      0|    if(share->cookies == data->cookies)
  ------------------
  |  Branch (432:8): [True: 0, False: 0]
  ------------------
  433|      0|      data->cookies = NULL;
  434|      0|#endif
  435|       |
  436|      0|#ifndef CURL_DISABLE_HSTS
  437|      0|    if(share->hsts == data->hsts)
  ------------------
  |  Branch (437:8): [True: 0, False: 0]
  ------------------
  438|      0|      data->hsts = NULL;
  439|      0|#endif
  440|       |#ifdef USE_LIBPSL
  441|       |    if(&share->psl == data->psl)
  442|       |      data->psl = data->multi ? &data->multi->psl : NULL;
  443|       |#endif
  444|       |
  445|      0|    share_unlink(&data->share, data, locked);
  446|      0|  }
  447|    812|  return CURLE_OK;
  448|    812|}

Curl_trc_opt:
  671|      2|{
  672|      2|  CURLcode result = config ? trc_opt(config) : CURLE_OK;
  ------------------
  |  Branch (672:21): [True: 0, False: 2]
  ------------------
  673|      2|#ifdef DEBUGBUILD
  674|       |  /* CURL_DEBUG can override anything */
  675|      2|  if(!result) {
  ------------------
  |  Branch (675:6): [True: 2, False: 0]
  ------------------
  676|      2|    const char *dbg_config = getenv("CURL_DEBUG");
  677|      2|    if(dbg_config)
  ------------------
  |  Branch (677:8): [True: 0, False: 2]
  ------------------
  678|      0|      result = trc_opt(dbg_config);
  679|      2|  }
  680|      2|#endif /* DEBUGBUILD */
  681|      2|  return result;
  682|      2|}
Curl_trc_init:
  685|      2|{
  686|      2|#ifdef DEBUGBUILD
  687|      2|  return Curl_trc_opt(NULL);
  688|       |#else
  689|       |  return CURLE_OK;
  690|       |#endif
  691|      2|}

curlx_dyn_init:
   39|  4.05k|{
   40|  4.05k|  DEBUGASSERT(s);
  ------------------
  |  | 1046|  4.05k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (40:3): [True: 0, False: 4.05k]
  |  Branch (40:3): [True: 4.05k, False: 0]
  ------------------
   41|  4.05k|  DEBUGASSERT(toobig);
  ------------------
  |  | 1046|  4.05k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (41:3): [True: 0, False: 4.05k]
  |  Branch (41:3): [True: 4.05k, False: 0]
  ------------------
   42|  4.05k|  DEBUGASSERT(toobig <= MAX_DYNBUF_SIZE); /* catch crazy mistakes */
  ------------------
  |  | 1046|  4.05k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (42:3): [True: 0, False: 4.05k]
  |  Branch (42:3): [True: 4.05k, False: 0]
  ------------------
   43|  4.05k|  s->bufr = NULL;
   44|  4.05k|  s->leng = 0;
   45|  4.05k|  s->allc = 0;
   46|  4.05k|  s->toobig = toobig;
   47|  4.05k|#ifdef DEBUGBUILD
   48|  4.05k|  s->init = DYNINIT;
  ------------------
  |  |   32|  4.05k|#define DYNINIT 0xbee51da /* random pattern */
  ------------------
   49|  4.05k|#endif
   50|  4.05k|}
curlx_dyn_free:
   57|  4.09k|{
   58|  4.09k|  DEBUGASSERT(s);
  ------------------
  |  | 1046|  4.09k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (58:3): [True: 0, False: 4.09k]
  |  Branch (58:3): [True: 4.09k, False: 0]
  ------------------
   59|  4.09k|  DEBUGASSERT(s->init == DYNINIT);
  ------------------
  |  | 1046|  4.09k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (59:3): [True: 0, False: 4.09k]
  |  Branch (59:3): [True: 4.09k, False: 0]
  ------------------
   60|  4.09k|  curlx_safefree(s->bufr);
  ------------------
  |  | 1303|  4.09k|  do {                      \
  |  | 1304|  4.09k|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|  4.09k|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|  4.09k|    (ptr) = NULL;           \
  |  | 1306|  4.09k|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 4.09k]
  |  |  ------------------
  ------------------
   61|  4.09k|  s->leng = s->allc = 0;
   62|  4.09k|}
curlx_dyn_reset:
  126|   113k|{
  127|   113k|  DEBUGASSERT(s);
  ------------------
  |  | 1046|   113k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (127:3): [True: 0, False: 113k]
  |  Branch (127:3): [True: 113k, False: 0]
  ------------------
  128|   113k|  DEBUGASSERT(s->init == DYNINIT);
  ------------------
  |  | 1046|   113k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (128:3): [True: 0, False: 113k]
  |  Branch (128:3): [True: 113k, False: 0]
  ------------------
  129|   113k|  DEBUGASSERT(!s->leng || s->bufr);
  ------------------
  |  | 1046|   113k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (129:3): [True: 113k, False: 0]
  |  Branch (129:3): [True: 0, False: 0]
  |  Branch (129:3): [True: 35.6k, False: 78.3k]
  |  Branch (129:3): [True: 78.3k, False: 0]
  ------------------
  130|   113k|  if(s->leng)
  ------------------
  |  Branch (130:6): [True: 78.3k, False: 35.6k]
  ------------------
  131|  78.3k|    s->bufr[0] = 0;
  132|   113k|  s->leng = 0;
  133|   113k|}
curlx_dyn_addn:
  163|   268k|{
  164|   268k|  DEBUGASSERT(s);
  ------------------
  |  | 1046|   268k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (164:3): [True: 0, False: 268k]
  |  Branch (164:3): [True: 268k, False: 0]
  ------------------
  165|   268k|  DEBUGASSERT(s->init == DYNINIT);
  ------------------
  |  | 1046|   268k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (165:3): [True: 0, False: 268k]
  |  Branch (165:3): [True: 268k, False: 0]
  ------------------
  166|   268k|  DEBUGASSERT(!s->leng || s->bufr);
  ------------------
  |  | 1046|   268k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (166:3): [True: 268k, False: 0]
  |  Branch (166:3): [True: 0, False: 0]
  |  Branch (166:3): [True: 82.8k, False: 185k]
  |  Branch (166:3): [True: 185k, False: 0]
  ------------------
  167|   268k|  return dyn_nappend(s, mem, len);
  168|   268k|}
curlx_dyn_add:
  174|  71.6k|{
  175|  71.6k|  size_t n;
  176|  71.6k|  DEBUGASSERT(str);
  ------------------
  |  | 1046|  71.6k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (176:3): [True: 0, False: 71.6k]
  |  Branch (176:3): [True: 71.6k, False: 0]
  ------------------
  177|  71.6k|  DEBUGASSERT(s);
  ------------------
  |  | 1046|  71.6k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (177:3): [True: 0, False: 71.6k]
  |  Branch (177:3): [True: 71.6k, False: 0]
  ------------------
  178|  71.6k|  DEBUGASSERT(s->init == DYNINIT);
  ------------------
  |  | 1046|  71.6k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (178:3): [True: 0, False: 71.6k]
  |  Branch (178:3): [True: 71.6k, False: 0]
  ------------------
  179|  71.6k|  DEBUGASSERT(!s->leng || s->bufr);
  ------------------
  |  | 1046|  71.6k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (179:3): [True: 71.6k, False: 0]
  |  Branch (179:3): [True: 0, False: 0]
  |  Branch (179:3): [True: 812, False: 70.7k]
  |  Branch (179:3): [True: 70.7k, False: 0]
  ------------------
  180|  71.6k|  n = strlen(str);
  181|  71.6k|  return dyn_nappend(s, (const unsigned char *)str, n);
  182|  71.6k|}
curlx_dyn_ptr:
  238|   172k|{
  239|   172k|  DEBUGASSERT(s);
  ------------------
  |  | 1046|   172k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (239:3): [True: 0, False: 172k]
  |  Branch (239:3): [True: 172k, False: 0]
  ------------------
  240|   172k|  DEBUGASSERT(s->init == DYNINIT);
  ------------------
  |  | 1046|   172k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (240:3): [True: 0, False: 172k]
  |  Branch (240:3): [True: 172k, False: 0]
  ------------------
  241|   172k|  DEBUGASSERT(!s->leng || s->bufr);
  ------------------
  |  | 1046|   172k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (241:3): [True: 172k, False: 0]
  |  Branch (241:3): [True: 0, False: 0]
  |  Branch (241:3): [True: 2.62k, False: 169k]
  |  Branch (241:3): [True: 169k, False: 0]
  ------------------
  242|   172k|  return s->bufr;
  243|   172k|}
curlx_dyn_len:
  272|  91.2k|{
  273|  91.2k|  DEBUGASSERT(s);
  ------------------
  |  | 1046|  91.2k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (273:3): [True: 0, False: 91.2k]
  |  Branch (273:3): [True: 91.2k, False: 0]
  ------------------
  274|  91.2k|  DEBUGASSERT(s->init == DYNINIT);
  ------------------
  |  | 1046|  91.2k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (274:3): [True: 0, False: 91.2k]
  |  Branch (274:3): [True: 91.2k, False: 0]
  ------------------
  275|  91.2k|  DEBUGASSERT(!s->leng || s->bufr);
  ------------------
  |  | 1046|  91.2k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (275:3): [True: 91.2k, False: 0]
  |  Branch (275:3): [True: 0, False: 0]
  |  Branch (275:3): [True: 513, False: 90.7k]
  |  Branch (275:3): [True: 90.7k, False: 0]
  ------------------
  276|  91.2k|  return s->leng;
  277|  91.2k|}
dynbuf.c:dyn_nappend:
   69|   340k|{
   70|   340k|  size_t idx = s->leng;
   71|   340k|  size_t a = s->allc;
   72|   340k|  size_t fit = len + idx + 1; /* new string + old string + zero byte */
   73|       |
   74|       |  /* try to detect if there is rubbish in the struct */
   75|   340k|  DEBUGASSERT(s->init == DYNINIT);
  ------------------
  |  | 1046|   340k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (75:3): [True: 0, False: 340k]
  |  Branch (75:3): [True: 340k, False: 0]
  ------------------
   76|   340k|  DEBUGASSERT(s->toobig);
  ------------------
  |  | 1046|   340k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (76:3): [True: 0, False: 340k]
  |  Branch (76:3): [True: 340k, False: 0]
  ------------------
   77|   340k|  DEBUGASSERT(idx < s->toobig);
  ------------------
  |  | 1046|   340k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (77:3): [True: 0, False: 340k]
  |  Branch (77:3): [True: 340k, False: 0]
  ------------------
   78|   340k|  DEBUGASSERT(!s->leng || s->bufr);
  ------------------
  |  | 1046|   340k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (78:3): [True: 340k, False: 0]
  |  Branch (78:3): [True: 0, False: 0]
  |  Branch (78:3): [True: 83.6k, False: 256k]
  |  Branch (78:3): [True: 256k, False: 0]
  ------------------
   79|   340k|  DEBUGASSERT(a <= s->toobig);
  ------------------
  |  | 1046|   340k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (79:3): [True: 0, False: 340k]
  |  Branch (79:3): [True: 340k, False: 0]
  ------------------
   80|   340k|  DEBUGASSERT(!len || mem);
  ------------------
  |  | 1046|   340k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (80:3): [True: 340k, False: 0]
  |  Branch (80:3): [True: 0, False: 0]
  |  Branch (80:3): [True: 3.77k, False: 336k]
  |  Branch (80:3): [True: 336k, False: 0]
  ------------------
   81|       |
   82|   340k|  if(fit > s->toobig) {
  ------------------
  |  Branch (82:6): [True: 34, False: 340k]
  ------------------
   83|     34|    curlx_dyn_free(s);
   84|     34|    return CURLE_TOO_LARGE;
   85|     34|  }
   86|   340k|  else if(!a) {
  ------------------
  |  Branch (86:11): [True: 2.05k, False: 338k]
  ------------------
   87|  2.05k|    DEBUGASSERT(!idx);
  ------------------
  |  | 1046|  2.05k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (87:5): [True: 0, False: 2.05k]
  |  Branch (87:5): [True: 2.05k, False: 0]
  ------------------
   88|       |    /* first invoke */
   89|  2.05k|    if(MIN_FIRST_ALLOC > s->toobig)
  ------------------
  |  |   29|  2.05k|#define MIN_FIRST_ALLOC 32
  ------------------
  |  Branch (89:8): [True: 0, False: 2.05k]
  ------------------
   90|      0|      a = s->toobig;
   91|  2.05k|    else if(fit < MIN_FIRST_ALLOC)
  ------------------
  |  |   29|  2.05k|#define MIN_FIRST_ALLOC 32
  ------------------
  |  Branch (91:13): [True: 1.95k, False: 97]
  ------------------
   92|  1.95k|      a = MIN_FIRST_ALLOC;
  ------------------
  |  |   29|  1.95k|#define MIN_FIRST_ALLOC 32
  ------------------
   93|     97|    else
   94|     97|      a = fit;
   95|  2.05k|  }
   96|   338k|  else {
   97|   342k|    while(a < fit)
  ------------------
  |  Branch (97:11): [True: 3.84k, False: 338k]
  ------------------
   98|  3.84k|      a *= 2;
   99|   338k|    if(a > s->toobig)
  ------------------
  |  Branch (99:8): [True: 22, False: 338k]
  ------------------
  100|       |      /* no point in allocating a larger buffer than this is allowed to use */
  101|     22|      a = s->toobig;
  102|   338k|  }
  103|       |
  104|   340k|  if(a != s->allc) {
  ------------------
  |  Branch (104:6): [True: 4.44k, False: 335k]
  ------------------
  105|  4.44k|    void *p = curlx_realloc(s->bufr, a);
  ------------------
  |  | 1446|  4.44k|  curl_dbg_realloc(ptr, size, __LINE__, __FILE__)
  ------------------
  106|  4.44k|    if(!p) {
  ------------------
  |  Branch (106:8): [True: 0, False: 4.44k]
  ------------------
  107|      0|      curlx_dyn_free(s);
  108|      0|      return CURLE_OUT_OF_MEMORY;
  109|      0|    }
  110|  4.44k|    s->bufr = p;
  111|  4.44k|    s->allc = a;
  112|  4.44k|  }
  113|       |
  114|   340k|  if(len)
  ------------------
  |  Branch (114:6): [True: 336k, False: 3.77k]
  ------------------
  115|   336k|    memcpy(&s->bufr[idx], mem, len);
  116|   340k|  s->leng = idx + len;
  117|   340k|  s->bufr[s->leng] = 0;
  118|   340k|  return CURLE_OK;
  119|   340k|}

curlx_memzero:
  113|    894|{
  114|    894|  if(buf)
  ------------------
  |  Branch (114:6): [True: 894, False: 0]
  ------------------
  115|    894|    curlx_memzero_low(buf, size);
  ------------------
  |  | 1621|    894|#define curlx_memzero_low(buf, size)  explicit_bzero(buf, size)
  ------------------
  116|    894|}

curlx_str_passblanks:
  319|   133k|{
  320|   159k|  while(ISBLANK(**linep))
  ------------------
  |  |   43|   159k|#define ISBLANK(x)  (((x) == ' ') || ((x) == '\t'))
  |  |  ------------------
  |  |  |  Branch (43:22): [True: 24.9k, False: 134k]
  |  |  |  Branch (43:38): [True: 1.19k, False: 133k]
  |  |  ------------------
  ------------------
  321|  26.1k|    (*linep)++; /* move over it */
  322|   133k|}

curlx_uztosi:
   69|      4|{
   70|      4|  DEBUGASSERT(uznum <= (size_t)CURL_MASK_SINT);
  ------------------
  |  | 1046|      4|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (70:3): [True: 0, False: 4]
  |  Branch (70:3): [True: 4, False: 0]
  ------------------
   71|      4|  return (int)(uznum & (size_t)CURL_MASK_SINT);
  ------------------
  |  |   44|      4|#define CURL_MASK_SINT    (CURL_MASK_UINT >> 1)
  |  |  ------------------
  |  |  |  |   43|      4|#define CURL_MASK_UINT    ((unsigned int)~0)
  |  |  ------------------
  ------------------
   72|      4|}

curl_global_init:
  234|      2|{
  235|      2|  CURLcode result;
  236|      2|  global_init_lock();
  ------------------
  |  |   92|      2|#define global_init_lock()   curl_simple_lock_lock(&s_lock)
  ------------------
  237|       |
  238|      2|  result = global_init(flags, TRUE);
  ------------------
  |  | 1016|      2|#define TRUE true
  ------------------
  239|       |
  240|      2|  global_init_unlock();
  ------------------
  |  |   93|      2|#define global_init_unlock() curl_simple_lock_unlock(&s_lock)
  ------------------
  241|       |
  242|      2|  return result;
  243|      2|}
curl_easy_init:
  369|    812|{
  370|    812|  CURLcode result;
  371|    812|  struct Curl_easy *data;
  372|       |
  373|       |  /* Make sure we inited the global SSL stuff */
  374|    812|  global_init_lock();
  ------------------
  |  |   92|    812|#define global_init_lock()   curl_simple_lock_lock(&s_lock)
  ------------------
  375|       |
  376|    812|  if(!initialized) {
  ------------------
  |  Branch (376:6): [True: 0, False: 812]
  ------------------
  377|      0|    result = global_init(CURL_GLOBAL_DEFAULT, TRUE);
  ------------------
  |  | 3049|      0|#define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL
  |  |  ------------------
  |  |  |  | 3047|      0|#define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL | CURL_GLOBAL_WINSOCK)
  |  |  |  |  ------------------
  |  |  |  |  |  | 3044|      0|#define CURL_GLOBAL_SSL (1 << 0) /* no purpose since 7.57.0 */
  |  |  |  |  ------------------
  |  |  |  |               #define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL | CURL_GLOBAL_WINSOCK)
  |  |  |  |  ------------------
  |  |  |  |  |  | 3045|      0|#define CURL_GLOBAL_WINSOCK (1 << 1)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  result = global_init(CURL_GLOBAL_DEFAULT, TRUE);
  ------------------
  |  | 1016|      0|#define TRUE true
  ------------------
  378|      0|    if(result) {
  ------------------
  |  Branch (378:8): [True: 0, False: 0]
  ------------------
  379|       |      /* something in the global init failed, return nothing */
  380|      0|      DEBUGF(curl_mfprintf(stderr, "Error: curl_global_init failed\n"));
  ------------------
  |  | 1032|      0|#define DEBUGF(x) x
  ------------------
  381|      0|      global_init_unlock();
  ------------------
  |  |   93|      0|#define global_init_unlock() curl_simple_lock_unlock(&s_lock)
  ------------------
  382|      0|      return NULL;
  383|      0|    }
  384|      0|  }
  385|    812|  global_init_unlock();
  ------------------
  |  |   93|    812|#define global_init_unlock() curl_simple_lock_unlock(&s_lock)
  ------------------
  386|       |
  387|       |  /* We use Curl_open() with undefined URL so far */
  388|    812|  result = Curl_open(&data);
  389|    812|  if(result) {
  ------------------
  |  Branch (389:6): [True: 0, False: 812]
  ------------------
  390|      0|    DEBUGF(curl_mfprintf(stderr, "Error: Curl_open failed\n"));
  ------------------
  |  | 1032|      0|#define DEBUGF(x) x
  ------------------
  391|      0|    return NULL;
  392|      0|  }
  393|       |
  394|    812|  return data;
  395|    812|}
curl_easy_cleanup:
  884|    812|{
  885|    812|  struct Curl_eapi_guard guard;
  886|       |
  887|    812|  if(CURL_EAPI_ENTER(&guard, curl, easy_cleanup, NULL)) {
  ------------------
  |  |  163|    812|  Curl_eapi_enter((g), (curl), CURL_EAPI_FN_##fn, (r)) && (curl)
  |  |  ------------------
  |  |  |  Branch (163:3): [True: 812, False: 0]
  |  |  |  Branch (163:59): [True: 812, False: 0]
  |  |  ------------------
  ------------------
  888|    812|    struct Curl_easy *data = curl;
  889|    812|    struct Curl_sigpipe_ctx sigpipe_ctx;
  890|    812|    sigpipe_ignore(data, &sigpipe_ctx);
  891|    812|    Curl_close(&data);
  892|    812|    sigpipe_restore(&sigpipe_ctx);
  893|    812|  }
  894|    812|  CURL_EAPI_LEAVE(&guard);
  ------------------
  |  |  165|    812|  Curl_eapi_leave(g)
  ------------------
  895|    812|}
easy.c:global_init:
  130|      2|{
  131|      2|  (void)flags;
  132|       |
  133|      2|  if(initialized++)
  ------------------
  |  Branch (133:6): [True: 0, False: 2]
  ------------------
  134|      0|    return CURLE_OK;
  135|       |
  136|      2|  if(memoryfuncs) {
  ------------------
  |  Branch (136:6): [True: 2, False: 0]
  ------------------
  137|       |    /* Setup the default memory functions here (again) */
  138|      2|    Curl_cmalloc = (curl_malloc_callback)malloc;
  139|      2|    Curl_cfree = (curl_free_callback)free;
  140|      2|    Curl_crealloc = (curl_realloc_callback)realloc;
  141|      2|    Curl_cstrdup = (curl_strdup_callback)CURLX_STRDUP_LOW;
  ------------------
  |  | 1436|      2|#define CURLX_STRDUP_LOW strdup
  ------------------
  142|      2|    Curl_ccalloc = (curl_calloc_callback)calloc;
  143|      2|  }
  144|       |
  145|       |#ifdef _WIN32
  146|       |  curlx_verify_windows_init();
  147|       |  curlx_now_init();
  148|       |#endif
  149|       |
  150|      2|  if(Curl_trc_init()) {
  ------------------
  |  Branch (150:6): [True: 0, False: 2]
  ------------------
  151|      0|    DEBUGF(curl_mfprintf(stderr, "Error: Curl_trc_init failed\n"));
  ------------------
  |  | 1032|      0|#define DEBUGF(x) x
  ------------------
  152|      0|    goto fail;
  153|      0|  }
  154|       |
  155|       |#ifdef USE_WINDOWS_SSPI
  156|       |  if(Curl_sspi_global_init()) {
  157|       |    DEBUGF(curl_mfprintf(stderr, "Error: Curl_sspi_global_init() failed\n"));
  158|       |    goto fail;
  159|       |  }
  160|       |#endif
  161|       |
  162|       |#ifdef USE_WINSOCK
  163|       |  /* CURL_GLOBAL_WINSOCK controls the *optional* part of the Windows
  164|       |     initialization which is for the Windows sockets library (Winsock). */
  165|       |  if(flags & CURL_GLOBAL_WINSOCK) {
  166|       |    WSADATA wsa;
  167|       |    if(WSAStartup(MAKEWORD(2, 2), &wsa)) {
  168|       |      DEBUGF(curl_mfprintf(stderr, "Error: WSAStartup() failed\n"));
  169|       |      goto fail;
  170|       |    }
  171|       |    winsock_initialized = TRUE;
  172|       |  }
  173|       |#endif
  174|       |
  175|      2|  if(!Curl_ssl_init()) {
  ------------------
  |  Branch (175:6): [True: 0, False: 2]
  ------------------
  176|      0|    DEBUGF(curl_mfprintf(stderr, "Error: Curl_ssl_init failed\n"));
  ------------------
  |  | 1032|      0|#define DEBUGF(x) x
  ------------------
  177|      0|    goto fail;
  178|      0|  }
  179|       |
  180|      2|  if(Curl_hash_global_init()) {
  ------------------
  |  Branch (180:6): [True: 0, False: 2]
  ------------------
  181|      0|    DEBUGF(curl_mfprintf(stderr, "Error: Curl_hash_global_init failed\n"));
  ------------------
  |  | 1032|      0|#define DEBUGF(x) x
  ------------------
  182|      0|    goto fail;
  183|      0|  }
  184|       |
  185|      2|  if(!Curl_vquic_init()) {
  ------------------
  |  |   84|      2|#define Curl_vquic_init() 1
  ------------------
  |  Branch (185:6): [Folded, False: 2]
  ------------------
  186|      0|    DEBUGF(curl_mfprintf(stderr, "Error: Curl_vquic_init failed\n"));
  ------------------
  |  | 1032|      0|#define DEBUGF(x) x
  ------------------
  187|      0|    goto fail;
  188|      0|  }
  189|       |
  190|      2|  if(Curl_amiga_init()) {
  ------------------
  |  |   36|      2|#define Curl_amiga_init()    CURLE_OK
  |  |  ------------------
  |  |  |  Branch (36:30): [Folded, False: 2]
  |  |  ------------------
  ------------------
  191|      0|    DEBUGF(curl_mfprintf(stderr, "Error: Curl_amiga_init failed\n"));
  ------------------
  |  | 1032|      0|#define DEBUGF(x) x
  ------------------
  192|      0|    goto fail;
  193|      0|  }
  194|       |
  195|      2|  if(Curl_macos_init()) {
  ------------------
  |  |   31|      2|#define Curl_macos_init() CURLE_OK
  |  |  ------------------
  |  |  |  Branch (31:27): [Folded, False: 2]
  |  |  ------------------
  ------------------
  196|      0|    DEBUGF(curl_mfprintf(stderr, "Error: Curl_macos_init failed\n"));
  ------------------
  |  | 1032|      0|#define DEBUGF(x) x
  ------------------
  197|      0|    goto fail;
  198|      0|  }
  199|       |
  200|      2|  if(Curl_async_global_init()) {
  ------------------
  |  Branch (200:6): [True: 0, False: 2]
  ------------------
  201|      0|    DEBUGF(curl_mfprintf(stderr, "Error: Curl_async_global_init failed\n"));
  ------------------
  |  | 1032|      0|#define DEBUGF(x) x
  ------------------
  202|      0|    goto fail;
  203|      0|  }
  204|       |
  205|      2|  if(Curl_ssh_init()) {
  ------------------
  |  |  259|      2|#define Curl_ssh_init() 0
  |  |  ------------------
  |  |  |  Branch (259:25): [Folded, False: 2]
  |  |  ------------------
  ------------------
  206|      0|    DEBUGF(curl_mfprintf(stderr, "Error: Curl_ssh_init failed\n"));
  ------------------
  |  | 1032|      0|#define DEBUGF(x) x
  ------------------
  207|      0|    goto fail;
  208|      0|  }
  209|       |
  210|      2|#ifdef DEBUGBUILD
  211|      2|  if(getenv("CURL_GLOBAL_INIT"))
  ------------------
  |  Branch (211:6): [True: 0, False: 2]
  ------------------
  212|       |    /* alloc data that will leak if *cleanup() is not called! */
  213|      0|    leakpointer = curlx_malloc(1);
  ------------------
  |  | 1442|      0|#define curlx_malloc(size)         curl_dbg_malloc(size, __LINE__, __FILE__)
  ------------------
  214|      2|#endif
  215|       |
  216|      2|  return CURLE_OK;
  217|       |
  218|      0|fail:
  219|       |#ifdef USE_WINSOCK
  220|       |  if(winsock_initialized) {
  221|       |    WSACleanup();
  222|       |    winsock_initialized = FALSE;
  223|       |  }
  224|       |#endif
  225|      0|  initialized--; /* undo the increase */
  226|      0|  return CURLE_FAILED_INIT;
  227|      2|}

easy.c:curl_simple_lock_lock:
   64|    814|{
   65|    814|  for(;;) {
   66|    814|    if(!atomic_exchange_explicit(lock, true, memory_order_acquire))
  ------------------
  |  Branch (66:8): [True: 814, False: 0]
  ------------------
   67|    814|      break;
   68|       |    /* Reduce cache coherency traffic */
   69|      0|    while(atomic_load_explicit(lock, memory_order_relaxed)) {
  ------------------
  |  Branch (69:11): [True: 0, False: 0]
  ------------------
   70|       |      /* Reduce load (not mandatory) */
   71|      0|#ifdef HAVE_BUILTIN_IA32_PAUSE
   72|      0|      __builtin_ia32_pause();
   73|       |#elif defined(__aarch64__)
   74|       |      /* NOLINTNEXTLINE(portability-no-assembler) */
   75|       |      __asm__ volatile("yield" ::: "memory");
   76|       |#elif defined(HAVE_SCHED_YIELD)
   77|       |      sched_yield();
   78|       |#endif
   79|      0|    }
   80|      0|  }
   81|    814|}
easy.c:curl_simple_lock_unlock:
   84|    814|{
   85|    814|  atomic_store_explicit(lock, false, memory_order_release);
   86|    814|}

Curl_wildcard_dtor:
  189|    812|{
  190|    812|  struct WildcardData *wc = *wcp;
  191|    812|  if(!wc)
  ------------------
  |  Branch (191:6): [True: 812, False: 0]
  ------------------
  192|    812|    return;
  193|       |
  194|      0|  if(wc->dtor) {
  ------------------
  |  Branch (194:6): [True: 0, False: 0]
  ------------------
  195|      0|    wc->dtor(wc->ftpwc);
  196|      0|    wc->dtor = ZERO_NULL;
  ------------------
  |  | 1129|      0|#define ZERO_NULL 0
  ------------------
  197|      0|    wc->ftpwc = NULL;
  198|      0|  }
  199|      0|  DEBUGASSERT(!wc->ftpwc);
  ------------------
  |  | 1046|      0|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (199:3): [True: 0, False: 0]
  |  Branch (199:3): [True: 0, False: 0]
  ------------------
  200|       |
  201|      0|  Curl_llist_destroy(&wc->filelist, NULL);
  202|      0|  curlx_safefree(wc->path);
  ------------------
  |  | 1303|      0|  do {                      \
  |  | 1304|      0|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|      0|    (ptr) = NULL;           \
  |  | 1306|      0|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 0]
  |  |  ------------------
  ------------------
  203|      0|  curlx_safefree(wc->pattern);
  ------------------
  |  | 1303|      0|  do {                      \
  |  | 1304|      0|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|      0|    (ptr) = NULL;           \
  |  | 1306|      0|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 0]
  |  |  ------------------
  ------------------
  204|      0|  wc->state = CURLWC_INIT;
  205|      0|  curlx_free(wc);
  ------------------
  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  ------------------
  206|       |  *wcp = NULL;
  207|      0|}

Curl_initinfo:
   42|    812|{
   43|    812|  struct Progress *pro = &data->progress;
   44|    812|  struct PureInfo *info = &data->info;
   45|       |
   46|    812|  memset(&pro->delta, 0, sizeof(pro->delta));
   47|    812|  memset(&pro->total, 0, sizeof(pro->total));
   48|    812|  pro->startransfer_added = FALSE;
  ------------------
  |  | 1019|    812|#define FALSE false
  ------------------
   49|       |
   50|    812|  info->httpcode = 0;
   51|    812|  info->httpproxycode = 0;
   52|    812|  info->httpversion = 0;
   53|    812|  info->filetime = -1; /* -1 is an illegal time and thus means unknown */
   54|    812|  info->timecond = FALSE;
  ------------------
  |  | 1019|    812|#define FALSE false
  ------------------
   55|       |
   56|    812|  info->header_size = 0;
   57|    812|  info->request_size = 0;
   58|    812|  info->proxyauthavail = 0;
   59|    812|  info->httpauthavail = 0;
   60|    812|  info->proxyauthpicked = 0;
   61|    812|  info->httpauthpicked = 0;
   62|    812|  info->numconnects = 0;
   63|       |
   64|    812|  curlx_safefree(info->contenttype);
  ------------------
  |  | 1303|    812|  do {                      \
  |  | 1304|    812|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|    812|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|    812|    (ptr) = NULL;           \
  |  | 1306|    812|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 812]
  |  |  ------------------
  ------------------
   65|    812|  curlx_safefree(info->wouldredirect);
  ------------------
  |  | 1303|    812|  do {                      \
  |  | 1304|    812|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|    812|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|    812|    (ptr) = NULL;           \
  |  | 1306|    812|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 812]
  |  |  ------------------
  ------------------
   66|    812|  curlx_safefree(info->effective_url);
  ------------------
  |  | 1303|    812|  do {                      \
  |  | 1304|    812|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|    812|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|    812|    (ptr) = NULL;           \
  |  | 1306|    812|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 812]
  |  |  ------------------
  ------------------
   67|       |
   68|    812|  memset(&info->primary, 0, sizeof(info->primary));
   69|    812|  info->retry_after = 0;
   70|       |
   71|    812|  info->conn_scheme = 0;
   72|    812|  info->conn_protocol = 0;
   73|    812|  info->used_proxy = 0;
   74|       |
   75|    812|#ifdef USE_SSL
   76|    812|  Curl_ssl_free_certinfo(data);
   77|    812|#endif
   78|    812|}

Curl_hash_global_init:
   60|      2|{
   61|      2|  static bool seeded;
   62|      2|  unsigned char buf[sizeof(size_t)];
   63|      2|  size_t seed = 0;
   64|      2|  size_t i;
   65|      2|  CURLcode result;
   66|       |
   67|      2|  if(seeded)
  ------------------
  |  Branch (67:6): [True: 0, False: 2]
  ------------------
   68|      0|    return CURLE_OK;
   69|       |
   70|      2|  result = Curl_rand_bytes(NULL,
   71|      2|#ifdef DEBUGBUILD
   72|      2|                           FALSE,
  ------------------
  |  | 1019|      2|#define FALSE false
  ------------------
   73|      2|#endif
   74|      2|                           buf, sizeof(buf));
   75|      2|  if(result)
  ------------------
  |  Branch (75:6): [True: 0, False: 2]
  ------------------
   76|      0|    return result;
   77|       |
   78|     18|  for(i = 0; i < sizeof(buf); i++)
  ------------------
  |  Branch (78:14): [True: 16, False: 2]
  ------------------
   79|     16|    seed = (seed << 8) | buf[i];
   80|       |
   81|      2|  hash_seed = seed ? seed : 1;
  ------------------
  |  Branch (81:15): [True: 2, False: 0]
  ------------------
   82|       |  seeded = TRUE;
  ------------------
  |  | 1016|      2|#define TRUE true
  ------------------
   83|      2|  return CURLE_OK;
   84|      2|}
Curl_hash_init:
  217|    812|{
  218|    812|  DEBUGASSERT(h);
  ------------------
  |  | 1046|    812|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (218:3): [True: 0, False: 812]
  |  Branch (218:3): [True: 812, False: 0]
  ------------------
  219|    812|  DEBUGASSERT(slots);
  ------------------
  |  | 1046|    812|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (219:3): [True: 0, False: 812]
  |  Branch (219:3): [True: 812, False: 0]
  ------------------
  220|    812|  DEBUGASSERT((unsigned int)type < CURL_HASH_TYPE_LAST);
  ------------------
  |  | 1046|    812|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (220:3): [True: 0, False: 812]
  |  Branch (220:3): [True: 812, False: 0]
  ------------------
  221|    812|  DEBUGASSERT(dtor);
  ------------------
  |  | 1046|    812|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (221:3): [True: 0, False: 812]
  |  Branch (221:3): [True: 812, False: 0]
  ------------------
  222|       |
  223|    812|  h->table = NULL;
  224|    812|  h->dtor = dtor;
  225|    812|  h->size = 0;
  226|    812|  h->slots = slots;
  227|    812|  h->type = (uint8_t)type;
  228|    812|#ifdef DEBUGBUILD
  229|    812|  h->init = HASHINIT;
  ------------------
  |  |   33|    812|#define HASHINIT 0x7017e781
  ------------------
  230|    812|#endif
  231|    812|}
Curl_hash_destroy:
  410|    812|{
  411|    812|  DEBUGASSERT(h->init == HASHINIT);
  ------------------
  |  | 1046|    812|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (411:3): [True: 0, False: 812]
  |  Branch (411:3): [True: 812, False: 0]
  ------------------
  412|    812|  if(h->table) {
  ------------------
  |  Branch (412:6): [True: 0, False: 812]
  ------------------
  413|      0|    Curl_hash_clean(h);
  414|      0|    curlx_safefree(h->table);
  ------------------
  |  | 1303|      0|  do {                      \
  |  | 1304|      0|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|      0|    (ptr) = NULL;           \
  |  | 1306|      0|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 0]
  |  |  ------------------
  ------------------
  415|      0|  }
  416|    812|  DEBUGASSERT(h->size == 0);
  ------------------
  |  | 1046|    812|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (416:3): [True: 0, False: 812]
  |  Branch (416:3): [True: 812, False: 0]
  ------------------
  417|    812|  h->slots = 0;
  418|    812|}

Curl_headers_cleanup:
  470|    812|{
  471|    812|  struct Curl_llist_node *e;
  472|    812|  struct Curl_llist_node *n;
  473|       |
  474|    812|  for(e = Curl_llist_head(&data->state.httphdrs); e; e = n) {
  ------------------
  |  Branch (474:51): [True: 0, False: 812]
  ------------------
  475|      0|    struct Curl_header_store *hs = Curl_node_elem(e);
  476|      0|    n = Curl_node_next(e);
  477|      0|    curlx_free(hs);
  ------------------
  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  ------------------
  478|      0|  }
  479|    812|  headers_reset(data);
  480|    812|  return CURLE_OK;
  481|    812|}
headers.c:headers_reset:
  403|    812|{
  404|       |  Curl_llist_init(&data->state.httphdrs, NULL);
  405|    812|  data->state.nh_count = 0;
  406|    812|}

Curl_hsts_cleanup:
   80|    812|{
   81|    812|  struct hsts *h = *hp;
   82|    812|  if(h) {
  ------------------
  |  Branch (82:6): [True: 0, False: 812]
  ------------------
   83|      0|    struct Curl_llist_node *e;
   84|      0|    struct Curl_llist_node *n;
   85|      0|    for(e = Curl_llist_head(&h->list); e; e = n) {
  ------------------
  |  Branch (85:40): [True: 0, False: 0]
  ------------------
   86|      0|      struct stsentry *sts = Curl_node_elem(e);
   87|      0|      n = Curl_node_next(e);
   88|      0|      hsts_free(sts);
  ------------------
  |  |   77|      0|#define hsts_free(x) curlx_free(x)
  |  |  ------------------
  |  |  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  ------------------
   89|      0|    }
   90|      0|    curlx_free(h->filename);
  ------------------
  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  ------------------
   91|      0|    curlx_free(h);
  ------------------
  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  ------------------
   92|       |    *hp = NULL;
   93|      0|  }
   94|    812|}
Curl_hsts_save:
  371|    812|{
  372|    812|  struct Curl_llist_node *e;
  373|    812|  struct Curl_llist_node *n;
  374|    812|  CURLcode result = CURLE_OK;
  375|    812|  FILE *out;
  376|    812|  char *tempstore = NULL;
  377|       |
  378|    812|  if(!h)
  ------------------
  |  Branch (378:6): [True: 812, False: 0]
  ------------------
  379|       |    /* no cache activated */
  380|    812|    return CURLE_OK;
  381|       |
  382|       |  /* if no new name is given, use the one we stored from the load */
  383|      0|  if(!file && h->filename)
  ------------------
  |  Branch (383:6): [True: 0, False: 0]
  |  Branch (383:15): [True: 0, False: 0]
  ------------------
  384|      0|    file = h->filename;
  385|       |
  386|      0|  if((h->flags & CURLHSTS_READONLYFILE) || !file || !file[0])
  ------------------
  |  | 1084|      0|#define CURLHSTS_READONLYFILE (1L << 1)
  ------------------
  |  Branch (386:6): [True: 0, False: 0]
  |  Branch (386:44): [True: 0, False: 0]
  |  Branch (386:53): [True: 0, False: 0]
  ------------------
  387|       |    /* marked as read-only, no file or zero length filename */
  388|      0|    goto skipsave;
  389|       |
  390|      0|  result = Curl_fopen(data, file, &out, &tempstore);
  391|      0|  if(!result) {
  ------------------
  |  Branch (391:6): [True: 0, False: 0]
  ------------------
  392|      0|    fputs("# Your HSTS cache. https://curl.se/docs/hsts.html\n"
  393|      0|          "# This file was generated by libcurl! Edit at your own risk.\n",
  394|      0|          out);
  395|      0|    for(e = Curl_llist_head(&h->list); e; e = n) {
  ------------------
  |  Branch (395:40): [True: 0, False: 0]
  ------------------
  396|      0|      struct stsentry *sts = Curl_node_elem(e);
  397|      0|      n = Curl_node_next(e);
  398|      0|      hsts_out(sts, out);
  399|      0|    }
  400|      0|    curlx_fclose(out);
  ------------------
  |  |   88|      0|#define curlx_fclose(file)      curl_dbg_fclose(file, __LINE__, __FILE__)
  ------------------
  401|      0|    if(!result && tempstore && curlx_rename(tempstore, file))
  ------------------
  |  |   74|      0|#define curlx_rename            rename
  ------------------
  |  Branch (401:8): [True: 0, False: 0]
  |  Branch (401:19): [True: 0, False: 0]
  |  Branch (401:32): [True: 0, False: 0]
  ------------------
  402|      0|      result = CURLE_WRITE_ERROR;
  403|       |
  404|      0|    if(result && tempstore)
  ------------------
  |  Branch (404:8): [True: 0, False: 0]
  |  Branch (404:18): [True: 0, False: 0]
  ------------------
  405|      0|      unlink(tempstore);
  406|      0|  }
  407|      0|  curlx_free(tempstore);
  ------------------
  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  ------------------
  408|      0|skipsave:
  409|      0|  if(data->set.hsts_write) {
  ------------------
  |  Branch (409:6): [True: 0, False: 0]
  ------------------
  410|       |    /* if there is a write callback */
  411|      0|    struct curl_index i; /* count */
  412|      0|    i.total = Curl_llist_count(&h->list);
  413|      0|    i.index = 0;
  414|      0|    for(e = Curl_llist_head(&h->list); e; e = n) {
  ------------------
  |  Branch (414:40): [True: 0, False: 0]
  ------------------
  415|      0|      struct stsentry *sts = Curl_node_elem(e);
  416|      0|      bool stop;
  417|      0|      n = Curl_node_next(e);
  418|      0|      result = hsts_push(data, &i, sts, &stop);
  419|      0|      if(result || stop)
  ------------------
  |  Branch (419:10): [True: 0, False: 0]
  |  Branch (419:20): [True: 0, False: 0]
  ------------------
  420|      0|        break;
  421|      0|      i.index++;
  422|      0|    }
  423|      0|  }
  424|      0|  return result;
  425|      0|}

Curl_http_auth_cleanup_digest:
  184|    812|{
  185|    812|  Curl_auth_digest_cleanup(&data->state.digest);
  186|    812|  Curl_auth_digest_cleanup(&data->state.proxydigest);
  187|    812|}

Curl_llist_init:
   46|  1.62k|{
   47|  1.62k|  l->_size = 0;
   48|  1.62k|  l->_dtor = dtor;
   49|  1.62k|  l->_head = NULL;
   50|  1.62k|  l->_tail = NULL;
   51|  1.62k|#ifdef DEBUGBUILD
   52|  1.62k|  l->_init = LLISTINIT;
  ------------------
  |  |   29|  1.62k|#define LLISTINIT 0x100cc001 /* random pattern */
  ------------------
   53|  1.62k|#endif
   54|  1.62k|}
Curl_llist_head:
  207|    812|{
  208|    812|  DEBUGASSERT(list);
  ------------------
  |  | 1046|    812|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (208:3): [True: 0, False: 812]
  |  Branch (208:3): [True: 812, False: 0]
  ------------------
  209|    812|  DEBUGASSERT(list->_init == LLISTINIT);
  ------------------
  |  | 1046|    812|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (209:3): [True: 0, False: 812]
  |  Branch (209:3): [True: 812, False: 0]
  ------------------
  210|    812|  return VERIFYNODE(list->_head);
  ------------------
  |  |   33|    812|#define VERIFYNODE(x) verifynode(x)
  ------------------
  211|    812|}
llist.c:verifynode:
   35|    812|{
   36|    812|  DEBUGASSERT(!n || (n->_init == NODEINIT));
  ------------------
  |  | 1046|    812|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (36:3): [True: 812, False: 0]
  |  Branch (36:3): [True: 0, False: 0]
  |  Branch (36:3): [True: 812, False: 0]
  |  Branch (36:3): [True: 0, False: 0]
  ------------------
   37|    812|  return n;
   38|    812|}

curl_dbg_malloc:
  212|  9.37k|{
  213|  9.37k|  struct memdebug *mem;
  214|  9.37k|  size_t size;
  215|       |
  216|  9.37k|  DEBUGASSERT(wantedsize != 0);
  ------------------
  |  | 1046|  9.37k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (216:3): [True: 0, False: 9.37k]
  |  Branch (216:3): [True: 9.37k, False: 0]
  ------------------
  217|       |
  218|  9.37k|  if(countcheck("malloc", line, source))
  ------------------
  |  Branch (218:6): [True: 0, False: 9.37k]
  ------------------
  219|      0|    return NULL;
  220|       |
  221|       |  /* alloc at least 64 bytes */
  222|  9.37k|  size = sizeof(struct memdebug) + wantedsize;
  223|       |
  224|  9.37k|  mem = Curl_cmalloc(size);
  225|  9.37k|  if(mem) {
  ------------------
  |  Branch (225:6): [True: 9.37k, False: 0]
  ------------------
  226|  9.37k|    mem->size = wantedsize;
  227|  9.37k|  }
  228|       |
  229|  9.37k|  if(source)
  ------------------
  |  Branch (229:6): [True: 0, False: 9.37k]
  ------------------
  230|      0|    curl_dbg_log("MEM %s:%d malloc(%zu) = %p\n",
  231|      0|                 source, line, wantedsize,
  232|      0|                 mem ? (void *)mem->mem : (void *)0);
  ------------------
  |  Branch (232:18): [True: 0, False: 0]
  ------------------
  233|       |
  234|  9.37k|  return mem ? mem->mem : NULL;
  ------------------
  |  Branch (234:10): [True: 9.37k, False: 0]
  ------------------
  235|  9.37k|}
curl_dbg_calloc:
  240|    894|{
  241|    894|  struct memdebug *mem;
  242|    894|  size_t size, user_size;
  243|       |
  244|    894|  DEBUGASSERT(wanted_elements != 0);
  ------------------
  |  | 1046|    894|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (244:3): [True: 0, False: 894]
  |  Branch (244:3): [True: 894, False: 0]
  ------------------
  245|    894|  DEBUGASSERT(wanted_size != 0);
  ------------------
  |  | 1046|    894|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (245:3): [True: 0, False: 894]
  |  Branch (245:3): [True: 894, False: 0]
  ------------------
  246|       |
  247|    894|  if(countcheck("calloc", line, source))
  ------------------
  |  Branch (247:6): [True: 0, False: 894]
  ------------------
  248|      0|    return NULL;
  249|       |
  250|       |  /* alloc at least 64 bytes */
  251|    894|  user_size = wanted_size * wanted_elements;
  252|    894|  size = sizeof(struct memdebug) + user_size;
  253|       |
  254|    894|  mem = Curl_ccalloc(1, size);
  255|    894|  if(mem)
  ------------------
  |  Branch (255:6): [True: 894, False: 0]
  ------------------
  256|    894|    mem->size = user_size;
  257|       |
  258|    894|  if(source)
  ------------------
  |  Branch (258:6): [True: 894, False: 0]
  ------------------
  259|    894|    curl_dbg_log("MEM %s:%d calloc(%zu,%zu) = %p\n",
  260|    894|                 source, line, wanted_elements, wanted_size,
  261|    894|                 mem ? (void *)mem->mem : (void *)0);
  ------------------
  |  Branch (261:18): [True: 894, False: 0]
  ------------------
  262|       |
  263|    894|  return mem ? mem->mem : NULL;
  ------------------
  |  Branch (263:10): [True: 894, False: 0]
  ------------------
  264|    894|}
curl_dbg_strdup:
  268|  9.37k|{
  269|  9.37k|  char *mem;
  270|  9.37k|  size_t len;
  271|       |
  272|  9.37k|  DEBUGASSERT(str);
  ------------------
  |  | 1046|  9.37k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (272:3): [True: 0, False: 9.37k]
  |  Branch (272:3): [True: 9.37k, False: 0]
  ------------------
  273|       |
  274|  9.37k|  if(countcheck("strdup", line, source))
  ------------------
  |  Branch (274:6): [True: 0, False: 9.37k]
  ------------------
  275|      0|    return NULL;
  276|       |
  277|  9.37k|  len = strlen(str) + 1;
  278|       |
  279|  9.37k|  mem = curl_dbg_malloc(len, 0, NULL); /* NULL prevents logging */
  280|  9.37k|  if(mem)
  ------------------
  |  Branch (280:6): [True: 9.37k, False: 0]
  ------------------
  281|  9.37k|    memcpy(mem, str, len);
  282|       |
  283|  9.37k|  if(source)
  ------------------
  |  Branch (283:6): [True: 9.37k, False: 0]
  ------------------
  284|  9.37k|    curl_dbg_log("MEM %s:%d strdup(%p) (%zu) = %p\n",
  285|  9.37k|                 source, line, (const void *)str, len, (const void *)mem);
  286|       |
  287|  9.37k|  return mem;
  288|  9.37k|}
curl_dbg_realloc:
  321|  4.44k|{
  322|  4.44k|  struct memdebug *mem = NULL;
  323|  4.44k|  bool was_locked;
  324|       |
  325|  4.44k|  size_t size = sizeof(struct memdebug) + wantedsize;
  326|       |
  327|  4.44k|  DEBUGASSERT(wantedsize != 0);
  ------------------
  |  | 1046|  4.44k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (327:3): [True: 0, False: 4.44k]
  |  Branch (327:3): [True: 4.44k, False: 0]
  ------------------
  328|       |
  329|  4.44k|  if(countcheck("realloc", line, source))
  ------------------
  |  Branch (329:6): [True: 0, False: 4.44k]
  ------------------
  330|      0|    return NULL;
  331|       |
  332|       |  /* need to realloc under lock, as we get out-of-order log
  333|       |   * entries otherwise, since another thread might alloc the
  334|       |   * memory released by realloc() before otherwise would log it. */
  335|  4.44k|  was_locked = curl_dbg_lock();
  336|       |#ifdef __INTEL_COMPILER
  337|       |#  pragma warning(push)
  338|       |#  pragma warning(disable:1684)
  339|       |   /* 1684: conversion from pointer to same-sized integral type */
  340|       |#endif
  341|       |
  342|  4.44k|  if(ptr)
  ------------------
  |  Branch (342:6): [True: 2.38k, False: 2.05k]
  ------------------
  343|  2.38k|    mem = (void *)((char *)ptr - offsetof(struct memdebug, mem));
  344|       |
  345|       |#ifdef __INTEL_COMPILER
  346|       |#  pragma warning(pop)
  347|       |#endif
  348|       |
  349|  4.44k|  mem = Curl_crealloc(mem, size);
  350|  4.44k|  if(source)
  ------------------
  |  Branch (350:6): [True: 4.44k, False: 0]
  ------------------
  351|  4.44k|    curl_dbg_log_locked("MEM %s:%d realloc(%p, %zu) = %p\n",
  352|  4.44k|                        source, line, (void *)ptr, wantedsize,
  353|  4.44k|                        mem ? (void *)mem->mem : (void *)0);
  ------------------
  |  Branch (353:25): [True: 4.44k, False: 0]
  ------------------
  354|       |
  355|  4.44k|  curl_dbg_unlock(was_locked);
  356|  4.44k|  if(mem) {
  ------------------
  |  Branch (356:6): [True: 4.44k, False: 0]
  ------------------
  357|  4.44k|    mem->size = wantedsize;
  358|  4.44k|    return mem->mem;
  359|  4.44k|  }
  360|       |
  361|      0|  return NULL;
  362|  4.44k|}
curl_dbg_free:
  365|  75.4k|{
  366|  75.4k|  if(ptr) {
  ------------------
  |  Branch (366:6): [True: 12.3k, False: 63.1k]
  ------------------
  367|  12.3k|    struct memdebug *mem;
  368|       |
  369|  12.3k|    if(source)
  ------------------
  |  Branch (369:8): [True: 12.3k, False: 0]
  ------------------
  370|  12.3k|      curl_dbg_log("MEM %s:%d free(%p)\n", source, line, (void *)ptr);
  371|       |
  372|       |#ifdef __INTEL_COMPILER
  373|       |#  pragma warning(push)
  374|       |#  pragma warning(disable:1684)
  375|       |   /* 1684: conversion from pointer to same-sized integral type */
  376|       |#endif
  377|       |
  378|  12.3k|    mem = (void *)((char *)ptr - offsetof(struct memdebug, mem));
  379|       |
  380|       |#ifdef __INTEL_COMPILER
  381|       |#  pragma warning(pop)
  382|       |#endif
  383|       |
  384|       |    /* free for real */
  385|  12.3k|    Curl_cfree(mem);
  386|  12.3k|  }
  387|  75.4k|}
curl_dbg_fopen:
  477|    812|{
  478|    812|  FILE *res = CURLX_FOPEN_LOW(file, mode);
  ------------------
  |  |   68|    812|#define CURLX_FOPEN_LOW         fopen
  ------------------
  479|    812|  if(source)
  ------------------
  |  Branch (479:6): [True: 812, False: 0]
  ------------------
  480|    812|    curl_dbg_log("FILE %s:%d fopen(\"%s\",\"%s\") = %p\n",
  481|    812|                 source, line, file, mode, (void *)res);
  482|       |
  483|    812|  return res;
  484|    812|}
curl_dbg_fclose:
  510|    812|{
  511|    812|  int res;
  512|       |
  513|    812|  DEBUGASSERT(file);
  ------------------
  |  | 1046|    812|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (513:3): [True: 0, False: 812]
  |  Branch (513:3): [True: 812, False: 0]
  ------------------
  514|       |
  515|    812|  if(source)
  ------------------
  |  Branch (515:6): [True: 812, False: 0]
  ------------------
  516|    812|    curl_dbg_log("FILE %s:%d fclose(%p)\n", source, line, (void *)file);
  517|       |
  518|       |  /* !checksrc! disable BANNEDFUNC 1 */
  519|    812|  res = fclose(file);
  520|       |
  521|    812|  return res;
  522|    812|}
curl_dbg_log:
  565|  24.2k|{
  566|  24.2k|  bool was_locked;
  567|  24.2k|  va_list ap;
  568|       |
  569|  24.2k|  if(!curl_dbg_logfile)
  ------------------
  |  Branch (569:6): [True: 24.2k, False: 0]
  ------------------
  570|  24.2k|    return;
  571|       |
  572|      0|  was_locked = curl_dbg_lock();
  573|      0|  va_start(ap, format);
  574|      0|  curl_dbg_vlog(format, ap);
  575|       |  va_end(ap);
  576|      0|  curl_dbg_unlock(was_locked);
  577|      0|}
memdebug.c:countcheck:
  187|  24.0k|{
  188|       |  /* if source is NULL, then the call is made internally and this check
  189|       |     should not be made */
  190|  24.0k|  if(memlimit && source) {
  ------------------
  |  Branch (190:6): [True: 0, False: 24.0k]
  |  Branch (190:18): [True: 0, False: 0]
  ------------------
  191|      0|    if(!memsize) {
  ------------------
  |  Branch (191:8): [True: 0, False: 0]
  ------------------
  192|       |      /* log to file */
  193|      0|      curl_dbg_log("LIMIT %s:%d %s reached memlimit\n", source, line, func);
  194|       |      /* log to stderr also */
  195|      0|      curl_mfprintf(stderr, "LIMIT %s:%d %s reached memlimit\n",
  196|      0|                    source, line, func);
  197|      0|      dump_bt();
  198|      0|      fflush(curl_dbg_logfile); /* because it might crash now */
  199|       |      /* !checksrc! disable ERRNOVAR 1 */
  200|      0|      errno = ENOMEM;
  201|      0|      return TRUE; /* RETURN ERROR! */
  ------------------
  |  | 1016|      0|#define TRUE true
  ------------------
  202|      0|    }
  203|      0|    else
  204|      0|      memsize--; /* countdown */
  205|      0|  }
  206|       |
  207|  24.0k|  return FALSE; /* allow this */
  ------------------
  |  | 1019|  24.0k|#define FALSE false
  ------------------
  208|  24.0k|}
memdebug.c:curl_dbg_lock:
   74|  4.44k|{
   75|  4.44k|#ifdef USE_MUTEX
   76|  4.44k|  if(dbg_mutex_init) {
  ------------------
  |  Branch (76:6): [True: 0, False: 4.44k]
  ------------------
   77|      0|    Curl_mutex_acquire(&dbg_mutex);
  ------------------
  |  |   51|      0|#  define Curl_mutex_acquire(m)  pthread_mutex_lock(m)
  ------------------
   78|      0|    return TRUE;
  ------------------
  |  | 1016|      0|#define TRUE true
  ------------------
   79|      0|  }
   80|  4.44k|#endif
   81|  4.44k|  return FALSE;
  ------------------
  |  | 1019|  4.44k|#define FALSE false
  ------------------
   82|  4.44k|}
memdebug.c:curl_dbg_unlock:
   85|  4.44k|{
   86|  4.44k|#ifdef USE_MUTEX
   87|  4.44k|  if(was_locked)
  ------------------
  |  Branch (87:6): [True: 0, False: 4.44k]
  ------------------
   88|      0|    Curl_mutex_release(&dbg_mutex);
  ------------------
  |  |   52|      0|#  define Curl_mutex_release(m)  pthread_mutex_unlock(m)
  ------------------
   89|       |#else
   90|       |  (void)was_locked;
   91|       |#endif
   92|  4.44k|}
memdebug.c:curl_dbg_log_locked:
  552|  4.44k|{
  553|  4.44k|  va_list ap;
  554|       |
  555|  4.44k|  if(!curl_dbg_logfile)
  ------------------
  |  Branch (555:6): [True: 4.44k, False: 0]
  ------------------
  556|  4.44k|    return;
  557|       |
  558|  4.44k|  va_start(ap, format);
  559|      0|  curl_dbg_vlog(format, ap);
  560|       |  va_end(ap);
  561|      0|}

Curl_mime_cleanpart:
 1080|  1.62k|{
 1081|  1.62k|  if(part) {
  ------------------
  |  Branch (1081:6): [True: 0, False: 1.62k]
  ------------------
 1082|      0|    cleanup_part_content(part);
 1083|      0|    curl_slist_free_all(part->curlheaders);
 1084|      0|    if(part->flags & MIME_USERHEADERS_OWNER)
  ------------------
  |  |   34|      0|#define MIME_USERHEADERS_OWNER  (1 << 0)
  ------------------
  |  Branch (1084:8): [True: 0, False: 0]
  ------------------
 1085|      0|      curl_slist_free_all(part->userheaders);
 1086|      0|    curlx_safefree(part->mimetype);
  ------------------
  |  | 1303|      0|  do {                      \
  |  | 1304|      0|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|      0|    (ptr) = NULL;           \
  |  | 1306|      0|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1087|      0|    curlx_safefree(part->name);
  ------------------
  |  | 1303|      0|  do {                      \
  |  | 1304|      0|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|      0|    (ptr) = NULL;           \
  |  | 1306|      0|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1088|       |    curlx_safefree(part->filename);
  ------------------
  |  | 1303|      0|  do {                      \
  |  | 1304|      0|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|      0|    (ptr) = NULL;           \
  |  | 1306|      0|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1089|      0|    Curl_mime_initpart(part);
 1090|      0|  }
 1091|  1.62k|}

Curl_detach_connection:
  913|    812|{
  914|    812|  struct connectdata *conn = data->conn;
  915|    812|  if(conn) {
  ------------------
  |  Branch (915:6): [True: 0, False: 812]
  ------------------
  916|       |    /* this should never happen, prevent underflow */
  917|      0|    DEBUGASSERT(conn->attached_xfers);
  ------------------
  |  | 1046|      0|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (917:5): [True: 0, False: 0]
  |  Branch (917:5): [True: 0, False: 0]
  ------------------
  918|      0|    if(conn->attached_xfers) {
  ------------------
  |  Branch (918:8): [True: 0, False: 0]
  ------------------
  919|      0|      conn->attached_xfers--;
  920|      0|      if(!conn->attached_xfers)
  ------------------
  |  Branch (920:10): [True: 0, False: 0]
  ------------------
  921|      0|        conn->attached_multi = NULL;
  922|      0|    }
  923|      0|  }
  924|    812|  data->conn = NULL;
  925|    812|}
Curl_expire_clear_all:
 3817|    812|{
 3818|    812|  struct Curl_multi *multi = data->multi;
 3819|       |
 3820|       |  /* this is only interesting while there is still an associated multi struct
 3821|       |     remaining! */
 3822|    812|  if(!multi)
  ------------------
  |  Branch (3822:6): [True: 812, False: 0]
  ------------------
 3823|    812|    return;
 3824|       |
 3825|      0|  if(Curl_timeouts_remove(&multi->timeouts, data)) {
  ------------------
  |  Branch (3825:6): [True: 0, False: 0]
  ------------------
 3826|       |    /* Since this is an cleared time, we must remove the previous entry from
 3827|       |       the splay tree */
 3828|      0|    multi_timeouts_init(data);
 3829|       |
 3830|      0|    if(data->id >= 0)
  ------------------
  |  Branch (3830:8): [True: 0, False: 0]
  ------------------
 3831|      0|      CURL_TRC_M(data, "[TIMEOUT] all cleared");
  ------------------
  |  |  148|      0|  do {                                   \
  |  |  149|      0|    if(CURL_TRC_M_is_verbose(data))      \
  |  |  ------------------
  |  |  |  |  135|      0|  Curl_trc_ft_is_verbose(data, &Curl_trc_feat_multi)
  |  |  |  |  ------------------
  |  |  |  |  |  |  329|      0|  (Curl_trc_is_verbose(data) &&          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  322|      0|  ((data) && (data)->set.verbose &&                        \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (322:4): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  Branch (322:14): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      0|   (!(data)->state.feat ||                                 \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (323:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  324|      0|    ((data)->state.feat->log_level >= CURL_LOG_LVL_INFO)))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   70|      0|#define CURL_LOG_LVL_INFO  1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (324:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  330|      0|   (ft)->log_level >= CURL_LOG_LVL_INFO)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   70|      0|#define CURL_LOG_LVL_INFO  1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (330:4): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|      Curl_trc_multi(data, __VA_ARGS__); \
  |  |  151|      0|  } while(0)
  |  |  ------------------
  |  |  |  Branch (151:11): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3832|      0|  }
 3833|      0|}

Curl_netrc_scan:
  585|    812|{
  586|    812|  NETRCcode retcode = NETRC_OK;
  587|       |
  588|    812|  CURL_TRC_M(data, "[NETRC] scanning '%s' for host '%s' user '%s'",
  ------------------
  |  |  148|    812|  do {                                   \
  |  |  149|    812|    if(CURL_TRC_M_is_verbose(data))      \
  |  |  ------------------
  |  |  |  |  135|    812|  Curl_trc_ft_is_verbose(data, &Curl_trc_feat_multi)
  |  |  |  |  ------------------
  |  |  |  |  |  |  329|    812|  (Curl_trc_is_verbose(data) &&          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  322|  1.62k|  ((data) && (data)->set.verbose &&                        \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (322:4): [True: 812, False: 0]
  |  |  |  |  |  |  |  |  |  Branch (322:14): [True: 0, False: 812]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|  1.62k|   (!(data)->state.feat ||                                 \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (323:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  324|      0|    ((data)->state.feat->log_level >= CURL_LOG_LVL_INFO)))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   70|      0|#define CURL_LOG_LVL_INFO  1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (324:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  330|    812|   (ft)->log_level >= CURL_LOG_LVL_INFO)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   70|      0|#define CURL_LOG_LVL_INFO  1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (330:4): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|    812|      Curl_trc_multi(data, __VA_ARGS__); \
  |  |  151|    812|  } while(0)
  |  |  ------------------
  |  |  |  Branch (151:11): [Folded, False: 812]
  |  |  ------------------
  ------------------
  589|    812|             netrcfile, hostname, user);
  590|    812|  Curl_creds_unlink(pcreds);
  591|    812|  if(!netrcfile) {
  ------------------
  |  Branch (591:6): [True: 0, False: 812]
  ------------------
  592|      0|    char *home = NULL;
  593|      0|    char *homea = NULL;
  594|      0|    char *filealloc = NULL;
  595|      0|#if defined(HAVE_GETPWUID_R) && defined(HAVE_GETEUID)
  596|      0|    char pwbuf[1024];
  597|      0|#endif
  598|      0|    filealloc = curl_getenv("NETRC");
  599|      0|    if(!filealloc) {
  ------------------
  |  Branch (599:8): [True: 0, False: 0]
  ------------------
  600|      0|      homea = curl_getenv("HOME"); /* portable environment reader */
  601|      0|      if(homea) {
  ------------------
  |  Branch (601:10): [True: 0, False: 0]
  ------------------
  602|      0|        home = homea;
  603|      0|#if defined(HAVE_GETPWUID_R) && defined(HAVE_GETEUID)
  604|      0|      }
  605|      0|      else {
  606|      0|        struct passwd pw, *pw_res;
  607|      0|        if(!getpwuid_r(geteuid(), &pw, pwbuf, sizeof(pwbuf), &pw_res) &&
  ------------------
  |  Branch (607:12): [True: 0, False: 0]
  ------------------
  608|      0|           pw_res) {
  ------------------
  |  Branch (608:12): [True: 0, False: 0]
  ------------------
  609|      0|          home = pw.pw_dir;
  610|      0|        }
  611|       |#elif defined(HAVE_GETPWUID) && defined(HAVE_GETEUID)
  612|       |      }
  613|       |      else {
  614|       |        struct passwd *pw;
  615|       |        pw = getpwuid(geteuid());
  616|       |        if(pw) {
  617|       |          home = pw->pw_dir;
  618|       |        }
  619|       |#elif defined(_WIN32)
  620|       |      }
  621|       |      else {
  622|       |        homea = curl_getenv("USERPROFILE");
  623|       |        if(homea) {
  624|       |          home = homea;
  625|       |        }
  626|       |#endif
  627|      0|      }
  628|       |
  629|      0|      if(!home)
  ------------------
  |  Branch (629:10): [True: 0, False: 0]
  ------------------
  630|      0|        return NETRC_FILE_MISSING; /* no home directory found (or possibly out
  631|       |                                      of memory) */
  632|       |
  633|      0|      filealloc = curl_maprintf("%s%s.netrc", home, DIR_CHAR);
  ------------------
  |  |  644|      0|#  define DIR_CHAR      "/"
  ------------------
  634|      0|      if(!filealloc) {
  ------------------
  |  Branch (634:10): [True: 0, False: 0]
  ------------------
  635|      0|        curlx_free(homea);
  ------------------
  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  ------------------
  636|      0|        retcode = NETRC_OUT_OF_MEMORY;
  637|      0|        goto out;
  638|      0|      }
  639|      0|    }
  640|      0|    retcode = netrc_scan_file(
  641|      0|      data, store, hostname, user, filealloc, pcreds);
  642|      0|    curlx_free(filealloc);
  ------------------
  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  ------------------
  643|       |#ifdef _WIN32
  644|       |    if(retcode == NETRC_FILE_MISSING) {
  645|       |      /* fallback to the old-style "_netrc" file */
  646|       |      filealloc = curl_maprintf("%s%s_netrc", home, DIR_CHAR);
  647|       |      if(!filealloc) {
  648|       |        curlx_free(homea);
  649|       |        return NETRC_OUT_OF_MEMORY;
  650|       |      }
  651|       |      retcode = netrc_scan_file(
  652|       |        data, store, hostname, user, filealloc, pcreds);
  653|       |      curlx_free(filealloc);
  654|       |    }
  655|       |#endif
  656|      0|    curlx_free(homea);
  ------------------
  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  ------------------
  657|      0|  }
  658|    812|  else
  659|    812|    retcode = netrc_scan_file(
  660|    812|      data, store, hostname, user, netrcfile, pcreds);
  661|       |
  662|    812|out:
  663|    812|  if(retcode)
  ------------------
  |  Branch (663:6): [True: 730, False: 82]
  ------------------
  664|    730|    Curl_creds_unlink(pcreds);
  665|    812|  return retcode;
  666|    812|}
Curl_netrc_init:
  669|  1.62k|{
  670|  1.62k|  curlx_dyn_init(&store->filebuf, MAX_NETRC_FILE);
  ------------------
  |  |   77|  1.62k|#define MAX_NETRC_FILE  (128 * 1024)
  ------------------
  671|  1.62k|  store->loaded = FALSE;
  ------------------
  |  | 1019|  1.62k|#define FALSE false
  ------------------
  672|       |  store->filename = NULL;
  673|  1.62k|}
Curl_netrc_cleanup:
  675|  1.62k|{
  676|  1.62k|  curlx_dyn_free(&store->filebuf);
  677|  1.62k|  curlx_safefree(store->filename);
  ------------------
  |  | 1303|  1.62k|  do {                      \
  |  | 1304|  1.62k|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|  1.62k|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|  1.62k|    (ptr) = NULL;           \
  |  | 1306|  1.62k|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 1.62k]
  |  |  ------------------
  ------------------
  678|       |  store->loaded = FALSE;
  ------------------
  |  | 1019|  1.62k|#define FALSE false
  ------------------
  679|  1.62k|}
Curl_netrc_strerror:
  682|    817|{
  683|    817|  switch(ret) {
  684|     83|  default:
  ------------------
  |  Branch (684:3): [True: 83, False: 734]
  ------------------
  685|     83|    return ""; /* not a legit error */
  686|      1|  case NETRC_FILE_MISSING:
  ------------------
  |  Branch (686:3): [True: 1, False: 816]
  ------------------
  687|      1|    return "no such file";
  688|    564|  case NETRC_NO_MATCH:
  ------------------
  |  Branch (688:3): [True: 564, False: 253]
  ------------------
  689|    564|    return "no matching entry";
  690|      1|  case NETRC_OUT_OF_MEMORY:
  ------------------
  |  Branch (690:3): [True: 1, False: 816]
  ------------------
  691|      1|    return "out of memory";
  692|    168|  case NETRC_SYNTAX_ERROR:
  ------------------
  |  Branch (692:3): [True: 168, False: 649]
  ------------------
  693|    168|    return "syntax error";
  694|    817|  }
  695|       |  /* never reached */
  696|    817|}
netrc.c:netrc_scan_file:
  548|    812|{
  549|    812|  struct dynbuf *filebuf = &store->filebuf;
  550|       |
  551|    812|  if(!store->loaded || strcmp(netrcfile, store->filename)) {
  ------------------
  |  Branch (551:6): [True: 812, False: 0]
  |  Branch (551:24): [True: 0, False: 0]
  ------------------
  552|    812|    NETRCcode ret;
  553|    812|    store->loaded = FALSE;
  ------------------
  |  | 1019|    812|#define FALSE false
  ------------------
  554|    812|    ret = file2memory(netrcfile, filebuf);
  555|    812|    if(ret) {
  ------------------
  |  Branch (555:8): [True: 4, False: 808]
  ------------------
  556|      4|      CURL_TRC_M(data, "[NETRC] could not load '%s'", netrcfile);
  ------------------
  |  |  148|      4|  do {                                   \
  |  |  149|      4|    if(CURL_TRC_M_is_verbose(data))      \
  |  |  ------------------
  |  |  |  |  135|      4|  Curl_trc_ft_is_verbose(data, &Curl_trc_feat_multi)
  |  |  |  |  ------------------
  |  |  |  |  |  |  329|      4|  (Curl_trc_is_verbose(data) &&          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  322|      8|  ((data) && (data)->set.verbose &&                        \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (322:4): [True: 4, False: 0]
  |  |  |  |  |  |  |  |  |  Branch (322:14): [True: 0, False: 4]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  323|      8|   (!(data)->state.feat ||                                 \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (323:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  324|      0|    ((data)->state.feat->log_level >= CURL_LOG_LVL_INFO)))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   70|      0|#define CURL_LOG_LVL_INFO  1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (324:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  330|      4|   (ft)->log_level >= CURL_LOG_LVL_INFO)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   70|      0|#define CURL_LOG_LVL_INFO  1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (330:4): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      4|      Curl_trc_multi(data, __VA_ARGS__); \
  |  |  151|      4|  } while(0)
  |  |  ------------------
  |  |  |  Branch (151:11): [Folded, False: 4]
  |  |  ------------------
  ------------------
  557|      4|      return ret;
  558|      4|    }
  559|    808|    curlx_free(store->filename);
  ------------------
  |  | 1447|    808|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  ------------------
  560|    808|    store->filename = curlx_strdup(netrcfile);
  ------------------
  |  | 1441|    808|#define curlx_strdup(ptr)          curl_dbg_strdup(ptr, __LINE__, __FILE__)
  ------------------
  561|    808|    if(!store->filename) {
  ------------------
  |  Branch (561:8): [True: 0, False: 808]
  ------------------
  562|      0|      curlx_dyn_reset(&store->filebuf);
  563|      0|      return NETRC_OUT_OF_MEMORY;
  564|      0|    }
  565|    808|    store->loaded = TRUE;
  ------------------
  |  | 1016|    808|#define TRUE true
  ------------------
  566|    808|  }
  567|    808|  if(!curlx_dyn_len(filebuf))
  ------------------
  |  Branch (567:6): [True: 0, False: 808]
  ------------------
  568|      0|    return NETRC_NO_MATCH;
  569|       |
  570|    808|  return netrc_scan(data, curlx_dyn_ptr(filebuf), hostname, user, pcreds);
  571|    808|}
netrc.c:file2memory:
  504|    812|{
  505|    812|  NETRCcode ret = NETRC_FILE_MISSING; /* if it cannot open the file */
  506|    812|  FILE *file = curlx_fopen(filename, FOPEN_READTEXT);
  ------------------
  |  |   83|    812|#define curlx_fopen(file, mode) curl_dbg_fopen(file, mode, __LINE__, __FILE__)
  ------------------
  507|       |
  508|    812|  curlx_dyn_reset(filebuf);
  509|    812|  if(file) {
  ------------------
  |  Branch (509:6): [True: 812, False: 0]
  ------------------
  510|    812|    curlx_struct_stat stat;
  ------------------
  |  |   67|    812|#define curlx_struct_stat       struct stat
  ------------------
  511|    812|    if((curlx_fstat(fileno(file), &stat) == -1) || !S_ISDIR(stat.st_mode)) {
  ------------------
  |  |   66|    812|#define curlx_fstat             fstat
  ------------------
  |  Branch (511:8): [True: 0, False: 812]
  |  Branch (511:52): [True: 812, False: 0]
  ------------------
  512|    812|      CURLcode result = CURLE_OK;
  513|    812|      bool eof;
  514|    812|      struct dynbuf linebuf;
  515|    812|      curlx_dyn_init(&linebuf, MAX_NETRC_LINE);
  ------------------
  |  |   76|    812|#define MAX_NETRC_LINE  16384
  ------------------
  516|    812|      ret = NETRC_OK;
  517|  71.8k|      do {
  518|  71.8k|        const char *line;
  519|       |        /* Curl_get_line always returns lines ending with a newline */
  520|  71.8k|        result = Curl_get_line(&linebuf, file, &eof);
  521|  71.8k|        if(!result) {
  ------------------
  |  Branch (521:12): [True: 71.8k, False: 3]
  ------------------
  522|  71.8k|          line = curlx_dyn_ptr(&linebuf);
  523|       |          /* skip comments on load */
  524|  71.8k|          curlx_str_passblanks(&line);
  525|  71.8k|          if(*line == '#')
  ------------------
  |  Branch (525:14): [True: 194, False: 71.6k]
  ------------------
  526|    194|            continue;
  527|  71.6k|          result = curlx_dyn_add(filebuf, line);
  528|  71.6k|        }
  529|  71.6k|        if(result) {
  ------------------
  |  Branch (529:12): [True: 4, False: 71.6k]
  ------------------
  530|      4|          curlx_dyn_free(filebuf);
  531|      4|          ret = curl2netrc(result);
  ------------------
  |  |   84|      4|  ((!(r)) ? NETRC_OK : (((r) == CURLE_OUT_OF_MEMORY) ? \
  |  |  ------------------
  |  |  |  Branch (84:4): [True: 0, False: 4]
  |  |  |  Branch (84:25): [True: 0, False: 4]
  |  |  ------------------
  |  |   85|      4|   NETRC_OUT_OF_MEMORY : NETRC_SYNTAX_ERROR))
  ------------------
  532|      4|          break;
  533|      4|        }
  534|  71.8k|      } while(!eof);
  ------------------
  |  Branch (534:15): [True: 70.9k, False: 808]
  ------------------
  535|    812|      curlx_dyn_free(&linebuf);
  536|    812|    }
  537|    812|    curlx_fclose(file);
  ------------------
  |  |   88|    812|#define curlx_fclose(file)      curl_dbg_fclose(file, __LINE__, __FILE__)
  ------------------
  538|    812|  }
  539|    812|  return ret;
  540|    812|}
netrc.c:netrc_scan:
  428|    808|{
  429|    808|  struct netrc_scanner sc;
  430|    808|  NETRCcode rc = NETRC_OK;
  431|       |
  432|    808|  Curl_creds_unlink(pcreds);
  433|    808|  netrc_scan_init(&sc, data, content, hostname, user);
  434|       |
  435|  31.3k|  while(!rc && !sc.found) {
  ------------------
  |  Branch (435:9): [True: 31.2k, False: 163]
  |  Branch (435:16): [True: 31.2k, False: 0]
  ------------------
  436|  31.2k|    rc = netrc_lexer_next(&sc.lexer, FALSE);
  ------------------
  |  | 1019|  31.2k|#define FALSE false
  ------------------
  437|  31.2k|    if(!rc) {
  ------------------
  |  Branch (437:8): [True: 31.0k, False: 137]
  ------------------
  438|       |      /* Does this token end any previous entry? */
  439|  31.0k|      switch(sc.lexer.token) {
  440|    638|      case NETRC_TOK_EOF:
  ------------------
  |  Branch (440:7): [True: 638, False: 30.4k]
  ------------------
  441|  1.16k|      case NETRC_TOK_MACHINE:
  ------------------
  |  Branch (441:7): [True: 523, False: 30.5k]
  ------------------
  442|  7.54k|      case NETRC_TOK_DEFAULT:
  ------------------
  |  Branch (442:7): [True: 6.38k, False: 24.6k]
  ------------------
  443|  8.22k|      case NETRC_TOK_MACDEF:
  ------------------
  |  Branch (443:7): [True: 675, False: 30.3k]
  ------------------
  444|  8.22k|        rc = netrc_scan_end_entry(&sc);
  445|  8.22k|        if(rc || sc.found)
  ------------------
  |  Branch (445:12): [True: 0, False: 8.22k]
  |  Branch (445:18): [True: 82, False: 8.14k]
  ------------------
  446|     82|          goto out;
  447|  8.14k|        break;
  448|  22.8k|      default:
  ------------------
  |  Branch (448:7): [True: 22.8k, False: 8.22k]
  ------------------
  449|  22.8k|        break;
  450|  31.0k|      }
  451|       |
  452|  30.9k|      switch(sc.lexer.token) {
  453|    563|      case NETRC_TOK_EOF:
  ------------------
  |  Branch (453:7): [True: 563, False: 30.4k]
  ------------------
  454|    563|        goto out;
  455|    523|      case NETRC_TOK_MACHINE:
  ------------------
  |  Branch (455:7): [True: 523, False: 30.4k]
  ------------------
  456|    523|        rc = netrc_lexer_next(&sc.lexer, TRUE);
  ------------------
  |  | 1016|    523|#define TRUE true
  ------------------
  457|    523|        if(!rc) {
  ------------------
  |  Branch (457:12): [True: 522, False: 1]
  ------------------
  458|    522|          if(sc.lexer.token == NETRC_TOK_LITERAL) {
  ------------------
  |  Branch (458:14): [True: 517, False: 5]
  ------------------
  459|    517|            sc.matches_host = curl_strequal(
  460|    517|              sc.hostname, curlx_dyn_ptr(&sc.lexer.literal));
  461|    517|          }
  462|      5|          else {
  463|      5|            sc.matches_host = FALSE;
  ------------------
  |  | 1019|      5|#define FALSE false
  ------------------
  464|      5|            netrc_lexer_push(&sc.lexer);
  465|      5|          }
  466|    522|        }
  467|    523|        break;
  468|  6.37k|      case NETRC_TOK_DEFAULT:
  ------------------
  |  Branch (468:7): [True: 6.37k, False: 24.6k]
  ------------------
  469|  6.37k|        sc.matches_host = TRUE;
  ------------------
  |  | 1016|  6.37k|#define TRUE true
  ------------------
  470|  6.37k|        break;
  471|    295|      case NETRC_TOK_ACCOUNT:
  ------------------
  |  Branch (471:7): [True: 295, False: 30.6k]
  ------------------
  472|    295|        rc = netrc_scan_literal(&sc, NULL); /* ignore, not used */
  473|    295|        break;
  474|  6.07k|      case NETRC_TOK_LOGIN:
  ------------------
  |  Branch (474:7): [True: 6.07k, False: 24.9k]
  ------------------
  475|  6.07k|        rc = netrc_scan_literal(&sc, &sc.login);
  476|  6.07k|        break;
  477|  3.27k|      case NETRC_TOK_PASSWD:
  ------------------
  |  Branch (477:7): [True: 3.27k, False: 27.7k]
  ------------------
  478|  3.27k|        rc = netrc_scan_literal(&sc, &sc.passwd);
  479|  3.27k|        break;
  480|    675|      case NETRC_TOK_MACDEF:
  ------------------
  |  Branch (480:7): [True: 675, False: 30.3k]
  ------------------
  481|    675|        netrc_skip_to_empty_line(&sc.lexer);
  482|    675|        break;
  483|    733|      case NETRC_TOK_LITERAL:
  ------------------
  |  Branch (483:7): [True: 733, False: 30.2k]
  ------------------
  484|  13.2k|      case NETRC_TOK_JUNK:
  ------------------
  |  Branch (484:7): [True: 12.4k, False: 18.5k]
  ------------------
  485|  13.2k|      default:
  ------------------
  |  Branch (485:7): [True: 0, False: 30.9k]
  ------------------
  486|       |        /* skip this */
  487|  13.2k|        break;
  488|  30.9k|      }
  489|  30.9k|    }
  490|  31.2k|  }
  491|       |
  492|    808|out:
  493|    808|  if(!rc) {
  ------------------
  |  Branch (493:6): [True: 645, False: 163]
  ------------------
  494|    645|    if(sc.creds)
  ------------------
  |  Branch (494:8): [True: 82, False: 563]
  ------------------
  495|     82|      Curl_creds_link(pcreds, sc.creds);
  496|    563|    else
  497|    563|      rc = NETRC_NO_MATCH;
  498|    645|  }
  499|    808|  netrc_scan_cleanup(&sc);
  500|    808|  return rc;
  501|    808|}
netrc.c:netrc_scan_init:
  345|    808|{
  346|    808|  memset(sc, 0, sizeof(*sc));
  347|    808|  netrc_lexer_init(&sc->lexer, data, content);
  348|    808|  sc->hostname = hostname;
  349|    808|  sc->user = (user && user[0]) ? user : NULL;
  ------------------
  |  Branch (349:15): [True: 341, False: 467]
  |  Branch (349:23): [True: 341, False: 0]
  ------------------
  350|    808|  netrc_scan_reset(sc);
  351|    808|}
netrc.c:netrc_lexer_init:
  139|    808|{
  140|    808|  curlx_dyn_init(&lexer->literal, MAX_NETRC_TOKEN);
  ------------------
  |  |   78|    808|#define MAX_NETRC_TOKEN 4096
  ------------------
  141|    808|  lexer->data = data;
  142|    808|  lexer->content = lexer->pos = content;
  143|    808|}
netrc.c:netrc_scan_reset:
  334|  9.83k|{
  335|  9.83k|  curlx_safefree(sc->login);
  ------------------
  |  | 1303|  9.83k|  do {                      \
  |  | 1304|  9.83k|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|  9.83k|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|  9.83k|    (ptr) = NULL;           \
  |  | 1306|  9.83k|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 9.83k]
  |  |  ------------------
  ------------------
  336|  9.83k|  curlx_safefree(sc->passwd);
  ------------------
  |  | 1303|  9.83k|  do {                      \
  |  | 1304|  9.83k|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|  9.83k|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|  9.83k|    (ptr) = NULL;           \
  |  | 1306|  9.83k|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 9.83k]
  |  |  ------------------
  ------------------
  337|       |  sc->matches_host = FALSE;
  ------------------
  |  | 1019|  9.83k|#define FALSE false
  ------------------
  338|  9.83k|}
netrc.c:netrc_lexer_next:
  250|  41.3k|{
  251|  41.3k|  const char *s = lexer->pos, *start;
  252|  41.3k|  NETRCcode rc = NETRC_OK;
  253|  41.3k|  size_t slen;
  254|  41.3k|  CURLcode result;
  255|       |
  256|  41.3k|  if(lexer->pushed) {
  ------------------
  |  Branch (256:6): [True: 27, False: 41.3k]
  ------------------
  257|     27|    lexer->pushed = FALSE;
  ------------------
  |  | 1019|     27|#define FALSE false
  ------------------
  258|     27|    goto out;
  259|     27|  }
  260|       |
  261|  41.3k|  curlx_dyn_reset(&lexer->literal);
  262|  41.3k|  netrc_skip_blanks(lexer);
  263|  41.3k|  s = lexer->pos;
  264|       |
  265|  41.3k|  switch(*s) {
  266|    638|  case 0:
  ------------------
  |  Branch (266:3): [True: 638, False: 40.7k]
  ------------------
  267|    638|    lexer->token = NETRC_TOK_EOF;
  268|    638|    break;
  269|    866|  case '\"':
  ------------------
  |  Branch (269:3): [True: 866, False: 40.4k]
  ------------------
  270|    866|    rc = netrc_lexer_quoted(lexer);
  271|    866|    lexer->token = NETRC_TOK_LITERAL;
  272|    866|    s = lexer->pos;
  273|    866|    break;
  274|  39.8k|  default:
  ------------------
  |  Branch (274:3): [True: 39.8k, False: 1.50k]
  ------------------
  275|       |    /* unquoted token */
  276|  39.8k|    start = s;
  277|  1.17M|    while(*s && !ISBLANK(*s) && !ISNEWLINE(*s))
  ------------------
  |  |   43|  2.35M|#define ISBLANK(x)  (((x) == ' ') || ((x) == '\t'))
  |  |  ------------------
  |  |  |  Branch (43:22): [True: 24.7k, False: 1.15M]
  |  |  |  Branch (43:38): [True: 1.05k, False: 1.15M]
  |  |  ------------------
  ------------------
                  while(*s && !ISBLANK(*s) && !ISNEWLINE(*s))
  ------------------
  |  |   48|  1.15M|#define ISNEWLINE(x)    (((x) == '\n') || (x) == '\r')
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 10.3k, False: 1.14M]
  |  |  |  Branch (48:43): [True: 3.69k, False: 1.13M]
  |  |  ------------------
  ------------------
  |  Branch (277:11): [True: 1.17M, False: 0]
  ------------------
  278|  1.13M|      ++s;
  279|  39.8k|    slen = s - start;
  280|  39.8k|    if(!slen) {
  ------------------
  |  Branch (280:8): [True: 3.05k, False: 36.7k]
  ------------------
  281|  3.05k|      rc = NETRC_SYNTAX_ERROR;
  282|  3.05k|    }
  283|  39.8k|    if(want_literal) {
  ------------------
  |  Branch (283:8): [True: 10.1k, False: 29.7k]
  ------------------
  284|  10.1k|      lexer->token = NETRC_TOK_LITERAL;
  285|  10.1k|      result = curlx_dyn_addn(&lexer->literal, start, slen);
  286|  10.1k|      rc = curl2netrc(result);
  ------------------
  |  |   84|  10.1k|  ((!(r)) ? NETRC_OK : (((r) == CURLE_OUT_OF_MEMORY) ? \
  |  |  ------------------
  |  |  |  Branch (84:4): [True: 10.1k, False: 19]
  |  |  |  Branch (84:25): [True: 0, False: 19]
  |  |  ------------------
  |  |   85|     19|   NETRC_OUT_OF_MEMORY : NETRC_SYNTAX_ERROR))
  ------------------
  287|  10.1k|    }
  288|  29.7k|    else if((slen == 7) && curl_strnequal(start, "machine", slen)) {
  ------------------
  |  Branch (288:13): [True: 10.6k, False: 19.0k]
  |  Branch (288:28): [True: 523, False: 10.1k]
  ------------------
  289|    523|      lexer->token = NETRC_TOK_MACHINE;
  290|    523|    }
  291|  29.1k|    else if((slen == 7) && curl_strnequal(start, "default", slen)) {
  ------------------
  |  Branch (291:13): [True: 10.1k, False: 19.0k]
  |  Branch (291:28): [True: 6.38k, False: 3.71k]
  ------------------
  292|  6.38k|      lexer->token = NETRC_TOK_DEFAULT;
  293|  6.38k|    }
  294|  22.8k|    else if((slen == 7) && curl_strnequal(start, "account", slen)) {
  ------------------
  |  Branch (294:13): [True: 3.71k, False: 19.0k]
  |  Branch (294:28): [True: 295, False: 3.41k]
  ------------------
  295|    295|      lexer->token = NETRC_TOK_ACCOUNT;
  296|    295|    }
  297|  22.5k|    else if((slen == 5) && curl_strnequal(start, "login", slen)) {
  ------------------
  |  Branch (297:13): [True: 6.52k, False: 15.9k]
  |  Branch (297:28): [True: 6.07k, False: 445]
  ------------------
  298|  6.07k|      lexer->token = NETRC_TOK_LOGIN;
  299|  6.07k|    }
  300|  16.4k|    else if((slen == 8) && curl_strnequal(start, "password", slen)) {
  ------------------
  |  Branch (300:13): [True: 3.61k, False: 12.8k]
  |  Branch (300:28): [True: 3.27k, False: 340]
  ------------------
  301|  3.27k|      lexer->token = NETRC_TOK_PASSWD;
  302|  3.27k|    }
  303|  13.1k|    else if((slen == 6) && curl_strnequal(start, "macdef", slen)) {
  ------------------
  |  Branch (303:13): [True: 1.23k, False: 11.9k]
  |  Branch (303:28): [True: 675, False: 555]
  ------------------
  304|    675|      lexer->token = NETRC_TOK_MACDEF;
  305|    675|    }
  306|  12.4k|    else {
  307|  12.4k|      lexer->token = NETRC_TOK_JUNK;
  308|  12.4k|    }
  309|  39.8k|    break;
  310|  41.3k|  }
  311|       |
  312|  41.3k|out:
  313|       |#if NETRC_DEBUG
  314|       |  CURL_TRC_M(lexer->data, "[NETRC] token %s '%s', rc=%d",
  315|       |             netrc_tokenstr(lexer->token),
  316|       |             curlx_dyn_ptr(&lexer->literal), rc);
  317|       |#endif
  318|  41.3k|  lexer->pos = s;
  319|  41.3k|  return rc;
  320|  41.3k|}
netrc.c:netrc_skip_blanks:
  153|  41.3k|{
  154|  41.3k|  const char *s = lexer->pos;
  155|  61.8k|  while(*s) {
  ------------------
  |  Branch (155:9): [True: 61.2k, False: 638]
  ------------------
  156|  61.2k|    curlx_str_passblanks(&s);
  157|  66.1k|    while(*s == '\r')
  ------------------
  |  Branch (157:11): [True: 4.85k, False: 61.2k]
  ------------------
  158|  4.85k|      ++s;
  159|  61.2k|    if(*s == '\n') {
  ------------------
  |  Branch (159:8): [True: 20.5k, False: 40.7k]
  ------------------
  160|  20.5k|      ++s;
  161|  20.5k|    }
  162|  40.7k|    else
  163|  40.7k|      break;
  164|  61.2k|  }
  165|  41.3k|  lexer->pos = s;
  166|  41.3k|}
netrc.c:netrc_lexer_quoted:
  195|    866|{
  196|    866|  NETRCcode rc = NETRC_SYNTAX_ERROR;
  197|    866|  const char *s = lexer->pos;
  198|    866|  bool escape = FALSE;
  ------------------
  |  | 1019|    866|#define FALSE false
  ------------------
  199|    866|  CURLcode result;
  200|       |
  201|    866|  DEBUGASSERT(*s == '\"');
  ------------------
  |  | 1046|    866|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (201:3): [True: 0, False: 866]
  |  Branch (201:3): [True: 866, False: 0]
  ------------------
  202|    866|  ++s; /* pass the leading quote */
  203|   169k|  while(*s) {
  ------------------
  |  Branch (203:9): [True: 169k, False: 121]
  ------------------
  204|   169k|    char c = *s;
  205|   169k|    if(escape) {
  ------------------
  |  Branch (205:8): [True: 1.26k, False: 168k]
  ------------------
  206|  1.26k|      escape = FALSE;
  ------------------
  |  | 1019|  1.26k|#define FALSE false
  ------------------
  207|  1.26k|      switch(c) {
  ------------------
  |  Branch (207:14): [True: 937, False: 326]
  ------------------
  208|    216|      case 'n':
  ------------------
  |  Branch (208:7): [True: 216, False: 1.04k]
  ------------------
  209|    216|        c = '\n';
  210|    216|        break;
  211|    251|      case 'r':
  ------------------
  |  Branch (211:7): [True: 251, False: 1.01k]
  ------------------
  212|    251|        c = '\r';
  213|    251|        break;
  214|    470|      case 't':
  ------------------
  |  Branch (214:7): [True: 470, False: 793]
  ------------------
  215|    470|        c = '\t';
  216|    470|        break;
  217|  1.26k|      }
  218|  1.26k|    }
  219|   168k|    else if(c == '\\') {
  ------------------
  |  Branch (219:13): [True: 1.26k, False: 166k]
  ------------------
  220|  1.26k|      escape = TRUE;
  ------------------
  |  | 1016|  1.26k|#define TRUE true
  ------------------
  221|  1.26k|      ++s;
  222|  1.26k|      continue;
  223|  1.26k|    }
  224|   166k|    else if(c == '\"') {
  ------------------
  |  Branch (224:13): [True: 734, False: 166k]
  ------------------
  225|    734|      ++s; /* pass the ending quote */
  226|       |      /* Ensure even an empty literal has a null-terminator. */
  227|    734|      result = curlx_dyn_addn(&lexer->literal, "", 0);
  228|    734|      rc = curl2netrc(result);
  ------------------
  |  |   84|    734|  ((!(r)) ? NETRC_OK : (((r) == CURLE_OUT_OF_MEMORY) ? \
  |  |  ------------------
  |  |  |  Branch (84:4): [True: 734, False: 0]
  |  |  |  Branch (84:25): [True: 0, False: 0]
  |  |  ------------------
  |  |   85|      0|   NETRC_OUT_OF_MEMORY : NETRC_SYNTAX_ERROR))
  ------------------
  229|    734|      goto out;
  230|    734|    }
  231|   167k|    result = curlx_dyn_addn(&lexer->literal, &c, 1);
  232|   167k|    if(result) {
  ------------------
  |  Branch (232:8): [True: 11, False: 167k]
  ------------------
  233|     11|      rc = curl2netrc(result);
  ------------------
  |  |   84|     11|  ((!(r)) ? NETRC_OK : (((r) == CURLE_OUT_OF_MEMORY) ? \
  |  |  ------------------
  |  |  |  Branch (84:4): [True: 0, False: 11]
  |  |  |  Branch (84:25): [True: 0, False: 11]
  |  |  ------------------
  |  |   85|     11|   NETRC_OUT_OF_MEMORY : NETRC_SYNTAX_ERROR))
  ------------------
  234|     11|      goto out;
  235|     11|    }
  236|   167k|    ++s;
  237|   167k|  }
  238|    866|out:
  239|    866|  lexer->pos = s;
  240|    866|  return rc;
  241|    866|}
netrc.c:netrc_scan_end_entry:
  382|  8.22k|{
  383|  8.22k|  NETRCcode rc = NETRC_OK;
  384|       |#if NETRC_DEBUG
  385|       |  CURL_TRC_M(sc->lexer.data,
  386|       |             "[NETRC] entry matches_host=%d, login='%s', passwd='%s'",
  387|       |             sc->matches_host, sc->login, sc->passwd);
  388|       |#endif
  389|  8.22k|  if(sc->matches_host) {
  ------------------
  |  Branch (389:6): [True: 6.56k, False: 1.66k]
  ------------------
  390|  6.56k|    if(sc->login) {
  ------------------
  |  Branch (390:8): [True: 3.82k, False: 2.73k]
  ------------------
  391|  3.82k|      if(sc->user) {
  ------------------
  |  Branch (391:10): [True: 3.77k, False: 49]
  ------------------
  392|  3.77k|        if(Curl_timestrcmp(sc->user, sc->login))
  ------------------
  |  Branch (392:12): [True: 3.27k, False: 502]
  ------------------
  393|  3.27k|          goto out;
  394|       |        /* We look for a specific user,
  395|       |         * entry is only interesting with password */
  396|    502|        sc->found = !!sc->passwd;
  397|    502|      }
  398|     49|      else {
  399|     49|        sc->found = TRUE;
  ------------------
  |  | 1016|     49|#define TRUE true
  ------------------
  400|     49|      }
  401|  3.82k|    }
  402|  2.73k|    else if(sc->passwd) {
  ------------------
  |  Branch (402:13): [True: 33, False: 2.70k]
  ------------------
  403|       |      /* found a passwd that applies to any user */
  404|     33|      sc->found = TRUE;
  ------------------
  |  | 1016|     33|#define TRUE true
  ------------------
  405|     33|    }
  406|  2.70k|    else {
  407|       |      /* entry has nothing interesting */
  408|  2.70k|    }
  409|  3.28k|    if(sc->found) {
  ------------------
  |  Branch (409:8): [True: 82, False: 3.20k]
  ------------------
  410|       |#if NETRC_DEBUG
  411|       |      CURL_TRC_M(sc->lexer.data, "[NETRC] entry match found");
  412|       |#endif
  413|     82|      if(Curl_creds_create(sc->user ? sc->user : sc->login, sc->passwd,
  ------------------
  |  Branch (413:10): [True: 0, False: 82]
  |  Branch (413:28): [True: 24, False: 58]
  ------------------
  414|     82|                           NULL, NULL, NULL, CREDS_NETRC, &sc->creds))
  ------------------
  |  |   32|     82|#define CREDS_NETRC  3 /* username/passwd found in netrc */
  ------------------
  415|      0|        rc = NETRC_OUT_OF_MEMORY;
  416|     82|    }
  417|  3.28k|  }
  418|  8.22k|out:
  419|  8.22k|  netrc_scan_reset(sc);
  420|  8.22k|  return rc;
  421|  8.22k|}
netrc.c:netrc_lexer_push:
  244|     27|{
  245|       |  lexer->pushed = TRUE;
  ------------------
  |  | 1016|     27|#define TRUE true
  ------------------
  246|     27|}
netrc.c:netrc_scan_literal:
  364|  9.64k|{
  365|  9.64k|  NETRCcode rc = netrc_lexer_next(&sc->lexer, TRUE);
  ------------------
  |  | 1016|  9.64k|#define TRUE true
  ------------------
  366|  9.64k|  if(!rc) {
  ------------------
  |  Branch (366:6): [True: 9.61k, False: 25]
  ------------------
  367|  9.61k|    if(sc->lexer.token == NETRC_TOK_LITERAL) {
  ------------------
  |  Branch (367:8): [True: 9.59k, False: 22]
  ------------------
  368|  9.59k|      if(pdest && sc->matches_host) {
  ------------------
  |  Branch (368:10): [True: 9.31k, False: 286]
  |  Branch (368:19): [True: 8.56k, False: 744]
  ------------------
  369|  8.56k|        curlx_free(*pdest);
  ------------------
  |  | 1447|  8.56k|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  ------------------
  370|  8.56k|        *pdest = curlx_strdup(curlx_dyn_ptr(&sc->lexer.literal));
  ------------------
  |  | 1441|  8.56k|#define curlx_strdup(ptr)          curl_dbg_strdup(ptr, __LINE__, __FILE__)
  ------------------
  371|  8.56k|        if(!*pdest)
  ------------------
  |  Branch (371:12): [True: 0, False: 8.56k]
  ------------------
  372|      0|          rc = NETRC_OUT_OF_MEMORY;
  373|  8.56k|      }
  374|  9.59k|    }
  375|     22|    else
  376|     22|      netrc_lexer_push(&sc->lexer);
  377|  9.61k|  }
  378|  9.64k|  return rc;
  379|  9.64k|}
netrc.c:netrc_skip_to_empty_line:
  169|    675|{
  170|    675|  const char *s = lexer->pos;
  171|  1.53k|  while(*s) {
  ------------------
  |  Branch (171:9): [True: 1.48k, False: 50]
  ------------------
  172|  1.48k|    if(*s == '\r')
  ------------------
  |  Branch (172:8): [True: 197, False: 1.28k]
  ------------------
  173|    197|      ++s;
  174|  1.28k|    else if(*s == '\n') {
  ------------------
  |  Branch (174:13): [True: 872, False: 417]
  ------------------
  175|    872|      ++s;
  176|  1.06k|      while(*s == '\r')
  ------------------
  |  Branch (176:13): [True: 195, False: 872]
  ------------------
  177|    195|        ++s;
  178|    872|      if(*s == '\n')
  ------------------
  |  Branch (178:10): [True: 625, False: 247]
  ------------------
  179|    625|        goto out;
  180|    872|    }
  181|    417|    else
  182|    417|      ++s;
  183|  1.48k|  }
  184|    675|out:
  185|    675|  lexer->pos = s;
  186|    675|}
netrc.c:netrc_scan_cleanup:
  354|    808|{
  355|    808|  netrc_scan_reset(sc);
  356|    808|  sc->hostname = NULL;
  357|       |  sc->user = NULL;
  358|    808|  Curl_creds_unlink(&sc->creds);
  359|    808|  netrc_lexer_cleanup(&sc->lexer);
  360|    808|}
netrc.c:netrc_lexer_cleanup:
  146|    808|{
  147|    808|  lexer->content = lexer->pos = NULL;
  148|       |  lexer->data = NULL;
  149|    808|  curlx_dyn_free(&lexer->literal);
  150|    808|}

Curl_peer_unlink:
  307|  4.06k|{
  308|  4.06k|  if(*ppeer) {
  ------------------
  |  Branch (308:6): [True: 0, False: 4.06k]
  ------------------
  309|      0|    struct Curl_peer *peer = *ppeer;
  310|       |
  311|      0|    DEBUGASSERT(peer->refcount);
  ------------------
  |  | 1046|      0|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (311:5): [True: 0, False: 0]
  |  Branch (311:5): [True: 0, False: 0]
  ------------------
  312|      0|    *ppeer = NULL;
  313|      0|    if(peer->refcount)
  ------------------
  |  Branch (313:8): [True: 0, False: 0]
  ------------------
  314|      0|      peer->refcount--;
  315|      0|    if(!peer->refcount) {
  ------------------
  |  Branch (315:8): [True: 0, False: 0]
  ------------------
  316|      0|      curlx_free(peer);
  ------------------
  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  ------------------
  317|      0|    }
  318|      0|  }
  319|  4.06k|}

Curl_rand_bytes:
  144|      2|{
  145|      2|  CURLcode result = CURLE_BAD_FUNCTION_ARGUMENT;
  146|       |#ifndef DEBUGBUILD
  147|       |  const bool env_override = FALSE;
  148|       |#endif
  149|       |
  150|      2|  DEBUGASSERT(num);
  ------------------
  |  | 1046|      2|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (150:3): [True: 0, False: 2]
  |  Branch (150:3): [True: 2, False: 0]
  ------------------
  151|       |
  152|      6|  while(num) {
  ------------------
  |  Branch (152:9): [True: 4, False: 2]
  ------------------
  153|      4|    unsigned int r;
  154|      4|    size_t left = num < sizeof(unsigned int) ? num : sizeof(unsigned int);
  ------------------
  |  Branch (154:19): [True: 0, False: 4]
  ------------------
  155|       |
  156|      4|    result = randit(data, &r, env_override);
  157|      4|    if(result)
  ------------------
  |  Branch (157:8): [True: 0, False: 4]
  ------------------
  158|      0|      return result;
  159|       |
  160|     20|    while(left) {
  ------------------
  |  Branch (160:11): [True: 16, False: 4]
  ------------------
  161|     16|      *rnd++ = (unsigned char)(r & 0xFF);
  162|     16|      r >>= 8;
  163|     16|      --num;
  164|     16|      --left;
  165|     16|    }
  166|      4|  }
  167|       |
  168|      2|  return result;
  169|      2|}
rand.c:randit:
   89|      4|{
   90|      4|#ifdef DEBUGBUILD
   91|      4|  if(env_override) {
  ------------------
  |  Branch (91:6): [True: 0, False: 4]
  ------------------
   92|      0|    char *force_entropy = getenv("CURL_ENTROPY");
   93|      0|    if(force_entropy) {
  ------------------
  |  Branch (93:8): [True: 0, False: 0]
  ------------------
   94|      0|      static unsigned int randseed;
   95|      0|      static bool seeded = FALSE;
  ------------------
  |  | 1019|      0|#define FALSE false
  ------------------
   96|       |
   97|      0|      if(!seeded) {
  ------------------
  |  Branch (97:10): [True: 0, False: 0]
  ------------------
   98|      0|        unsigned int seed = 0;
   99|      0|        size_t elen = strlen(force_entropy);
  100|      0|        size_t clen = sizeof(seed);
  101|      0|        size_t min = elen < clen ? elen : clen;
  ------------------
  |  Branch (101:22): [True: 0, False: 0]
  ------------------
  102|      0|        memcpy((char *)&seed, force_entropy, min);
  103|      0|        randseed = ntohl(seed);
  104|      0|        seeded = TRUE;
  ------------------
  |  | 1016|      0|#define TRUE true
  ------------------
  105|      0|      }
  106|      0|      else
  107|      0|        randseed++;
  108|      0|      *rnd = randseed;
  109|      0|      return CURLE_OK;
  110|      0|    }
  111|      0|  }
  112|       |#else
  113|       |  (void)env_override;
  114|       |#endif
  115|       |
  116|       |  /* data may be NULL! */
  117|      4|#ifdef USE_SSL
  118|      4|  return Curl_ssl_random(data, (unsigned char *)rnd, sizeof(*rnd));
  119|       |#else
  120|       |  return weak_random(data, (unsigned char *)rnd, sizeof(*rnd));
  121|       |#endif
  122|      4|}

Curl_req_init:
   38|    812|{
   39|    812|  memset(req, 0, sizeof(*req));
   40|    812|}
Curl_req_free:
  175|    812|{
  176|    812|  curlx_safefree(req->newurl);
  ------------------
  |  | 1303|    812|  do {                      \
  |  | 1304|    812|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|    812|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|    812|    (ptr) = NULL;           \
  |  | 1306|    812|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 812]
  |  |  ------------------
  ------------------
  177|    812|  curlx_safefree(req->hd_auth);
  ------------------
  |  | 1303|    812|  do {                      \
  |  | 1304|    812|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|    812|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|    812|    (ptr) = NULL;           \
  |  | 1306|    812|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 812]
  |  |  ------------------
  ------------------
  178|    812|#ifndef CURL_DISABLE_PROXY
  179|    812|  curlx_safefree(req->hd_proxy_auth);
  ------------------
  |  | 1303|    812|  do {                      \
  |  | 1304|    812|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|    812|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|    812|    (ptr) = NULL;           \
  |  | 1306|    812|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 812]
  |  |  ------------------
  ------------------
  180|    812|#endif
  181|    812|  if(req->sendbuf_init)
  ------------------
  |  Branch (181:6): [True: 0, False: 812]
  ------------------
  182|      0|    Curl_bufq_free(&req->sendbuf);
  183|    812|  Curl_client_cleanup(data);
  184|    812|}

Curl_client_cleanup:
   72|    812|{
   73|    812|  cl_reset_reader(data);
   74|    812|  cl_reset_writer(data);
   75|       |
   76|    812|  data->req.bytecount = 0;
   77|    812|  data->req.headerline = 0;
   78|    812|}
sendf.c:cl_reset_reader:
   60|    812|{
   61|    812|  struct Curl_creader *reader = data->req.reader.stack;
   62|    812|  data->req.reader_started = FALSE;
  ------------------
  |  | 1019|    812|#define FALSE false
  ------------------
   63|    812|  while(reader) {
  ------------------
  |  Branch (63:9): [True: 0, False: 812]
  ------------------
   64|      0|    data->req.reader.stack = reader->next;
   65|      0|    reader->crt->do_close(data, reader);
   66|      0|    curlx_free(reader);
  ------------------
  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  ------------------
   67|      0|    reader = data->req.reader.stack;
   68|      0|  }
   69|    812|}
sendf.c:cl_reset_writer:
   48|    812|{
   49|    812|  struct Curl_cwriter *writer = data->req.writer.stack;
   50|    812|  while(writer) {
  ------------------
  |  Branch (50:9): [True: 0, False: 812]
  ------------------
   51|      0|    data->req.writer.stack = writer->next;
   52|      0|    writer->cwt->do_close(data, writer);
   53|      0|    curlx_free(writer);
  ------------------
  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  ------------------
   54|      0|    writer = data->req.writer.stack;
   55|      0|  }
   56|       |  data->req.writer.paused = FALSE;
  ------------------
  |  | 1019|    812|#define FALSE false
  ------------------
   57|    812|}

Curl_setopt_SSLVERSION:
  295|  1.62k|{
  296|       |  /*
  297|       |   * Set explicit SSL version to try to connect with, as some SSL
  298|       |   * implementations are lame.
  299|       |   */
  300|  1.62k|  {
  301|  1.62k|    long version, version_max;
  302|  1.62k|    struct ssl_easy_config *sslc = &data->set.ssl;
  303|  1.62k|#ifndef CURL_DISABLE_PROXY
  304|  1.62k|    if(option != CURLOPT_SSLVERSION)
  ------------------
  |  Branch (304:8): [True: 812, False: 812]
  ------------------
  305|    812|      sslc = &data->set.proxy_ssl;
  306|       |#else
  307|       |    (void)option; /* unused */
  308|       |#endif
  309|  1.62k|    version = C_SSLVERSION_VALUE(arg);
  ------------------
  |  |  172|  1.62k|#define C_SSLVERSION_VALUE(x)     ((x) & 0xffff)
  ------------------
  310|  1.62k|    version_max = (long)C_SSLVERSION_MAX_VALUE(arg);
  ------------------
  |  |  173|  1.62k|#define C_SSLVERSION_MAX_VALUE(x) ((unsigned long)(x) & 0xffff0000)
  ------------------
  311|       |
  312|  1.62k|    if(version < CURL_SSLVERSION_DEFAULT ||
  ------------------
  |  | 2394|  3.24k|#define CURL_SSLVERSION_DEFAULT 0L
  ------------------
  |  Branch (312:8): [True: 0, False: 1.62k]
  ------------------
  313|  1.62k|       version == CURL_SSLVERSION_SSLv2 ||
  ------------------
  |  | 2396|  3.24k|#define CURL_SSLVERSION_SSLv2   2L
  ------------------
  |  Branch (313:8): [True: 0, False: 1.62k]
  ------------------
  314|  1.62k|       version == CURL_SSLVERSION_SSLv3 ||
  ------------------
  |  | 2397|  3.24k|#define CURL_SSLVERSION_SSLv3   3L
  ------------------
  |  Branch (314:8): [True: 0, False: 1.62k]
  ------------------
  315|  1.62k|       version >= CURL_SSLVERSION_LAST ||
  ------------------
  |  | 2403|  3.24k|#define CURL_SSLVERSION_LAST    8L /* never use, keep last */
  ------------------
  |  Branch (315:8): [True: 0, False: 1.62k]
  ------------------
  316|  1.62k|       version_max < CURL_SSLVERSION_MAX_NONE ||
  ------------------
  |  | 2405|  3.24k|#define CURL_SSLVERSION_MAX_NONE 0L
  ------------------
  |  Branch (316:8): [True: 0, False: 1.62k]
  ------------------
  317|  1.62k|       version_max >= CURL_SSLVERSION_MAX_LAST)
  ------------------
  |  | 2413|  1.62k|#define CURL_SSLVERSION_MAX_LAST    (CURL_SSLVERSION_LAST    << 16)
  |  |  ------------------
  |  |  |  | 2403|  1.62k|#define CURL_SSLVERSION_LAST    8L /* never use, keep last */
  |  |  ------------------
  ------------------
  |  Branch (317:8): [True: 0, False: 1.62k]
  ------------------
  318|      0|      return CURLE_BAD_FUNCTION_ARGUMENT;
  319|  1.62k|    if(version == CURL_SSLVERSION_DEFAULT)
  ------------------
  |  | 2394|  1.62k|#define CURL_SSLVERSION_DEFAULT 0L
  ------------------
  |  Branch (319:8): [True: 1.62k, False: 0]
  ------------------
  320|  1.62k|      version = CURL_SSLVERSION_TLSv1_2;
  ------------------
  |  | 2400|  1.62k|#define CURL_SSLVERSION_TLSv1_2 6L
  ------------------
  321|       |
  322|  1.62k|    sslc->version = (unsigned char)version;
  323|  1.62k|    sslc->version_max = (unsigned int)version_max;
  324|  1.62k|  }
  325|      0|  return CURLE_OK;
  326|  1.62k|}

easy.c:sigpipe_ignore:
   49|    812|{
   50|       |  /* get a local copy of no_signal because the Curl_easy might not be
   51|       |     around when we restore */
   52|    812|  ig->no_signal = data->set.no_signal;
   53|    812|  if(!data->set.no_signal) {
  ------------------
  |  Branch (53:6): [True: 812, False: 0]
  ------------------
   54|    812|    struct sigaction action;
   55|       |    /* first, extract the existing situation */
   56|    812|    sigaction(SIGPIPE, NULL, &ig->old_pipe_act);
   57|    812|    action = ig->old_pipe_act;
   58|       |    /* ignore this signal */
   59|    812|    action.sa_handler = SIG_IGN;
   60|    812|#ifdef SA_SIGINFO
   61|       |    /* clear SA_SIGINFO flag since we are using sa_handler */
   62|    812|    action.sa_flags &= ~SA_SIGINFO;
   63|    812|#endif
   64|    812|    sigaction(SIGPIPE, &action, NULL);
   65|    812|  }
   66|    812|}
easy.c:sigpipe_restore:
   74|    812|{
   75|    812|  if(!ig->no_signal)
  ------------------
  |  Branch (75:6): [True: 812, False: 0]
  ------------------
   76|       |    /* restore the outside state */
   77|    812|    sigaction(SIGPIPE, &ig->old_pipe_act, NULL);
   78|    812|}

curl_slist_free_all:
  126|  1.62k|{
  127|  1.62k|  struct curl_slist *next;
  128|  1.62k|  struct curl_slist *item;
  129|       |
  130|  1.62k|  if(!list)
  ------------------
  |  Branch (130:6): [True: 1.62k, False: 0]
  ------------------
  131|  1.62k|    return;
  132|       |
  133|      0|  item = list;
  134|      0|  do {
  135|      0|    next = item->next;
  136|      0|    curlx_safefree(item->data);
  ------------------
  |  | 1303|      0|  do {                      \
  |  | 1304|      0|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|      0|    (ptr) = NULL;           \
  |  | 1306|      0|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 0]
  |  |  ------------------
  ------------------
  137|      0|    curlx_free(item);
  ------------------
  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  ------------------
  138|      0|    item = next;
  139|      0|  } while(next);
  ------------------
  |  Branch (139:11): [True: 0, False: 0]
  ------------------
  140|      0|}

Curl_timestrcmp:
  117|  3.77k|{
  118|  3.77k|  int match = 0;
  119|  3.77k|  int i = 0;
  120|       |
  121|  3.77k|  if(a && b) {
  ------------------
  |  Branch (121:6): [True: 3.77k, False: 0]
  |  Branch (121:11): [True: 3.77k, False: 0]
  ------------------
  122|  34.5k|    while(1) {
  ------------------
  |  Branch (122:11): [True: 34.5k, Folded]
  ------------------
  123|  34.5k|      match |= a[i] ^ b[i];
  124|  34.5k|      if(!a[i] || !b[i])
  ------------------
  |  Branch (124:10): [True: 3.38k, False: 31.1k]
  |  Branch (124:19): [True: 390, False: 30.8k]
  ------------------
  125|  3.77k|        break;
  126|  30.8k|      i++;
  127|  30.8k|    }
  128|  3.77k|  }
  129|      0|  else
  130|      0|    return a || b;
  ------------------
  |  Branch (130:12): [True: 0, False: 0]
  |  Branch (130:17): [True: 0, False: 0]
  ------------------
  131|  3.77k|  return match;
  132|  3.77k|}

strequal.c:Curl_raw_toupper:
   38|   266k|{
   39|   266k|  return (char)Curl_touppermap[(unsigned char)in];
   40|   266k|}

curl_strequal:
   77|    517|{
   78|    517|  if(s1 && s2)
  ------------------
  |  Branch (78:6): [True: 517, False: 0]
  |  Branch (78:12): [True: 517, False: 0]
  ------------------
   79|       |    /* both pointers point to something then compare them */
   80|    517|    return casecompare(s1, s2);
   81|       |
   82|       |  /* if both pointers are NULL then treat them as equal */
   83|      0|  return NULL == s1 && NULL == s2;
  ------------------
  |  Branch (83:10): [True: 0, False: 0]
  |  Branch (83:24): [True: 0, False: 0]
  ------------------
   84|    517|}
curl_strnequal:
   88|  35.8k|{
   89|  35.8k|  if(s1 && s2)
  ------------------
  |  Branch (89:6): [True: 35.8k, False: 0]
  |  Branch (89:12): [True: 35.8k, False: 0]
  ------------------
   90|       |    /* both pointers point to something then compare them */
   91|  35.8k|    return ncasecompare(s1, s2, n);
   92|       |
   93|       |  /* if both pointers are NULL then treat them as equal if max is non-zero */
   94|      0|  return NULL == s1 && NULL == s2 && n;
  ------------------
  |  Branch (94:10): [True: 0, False: 0]
  |  Branch (94:24): [True: 0, False: 0]
  |  Branch (94:38): [True: 0, False: 0]
  ------------------
   95|  35.8k|}
strequal.c:casecompare:
   36|    517|{
   37|  2.71k|  while(*first) {
  ------------------
  |  Branch (37:9): [True: 2.50k, False: 212]
  ------------------
   38|  2.50k|    if(Curl_raw_toupper(*first) != Curl_raw_toupper(*second))
  ------------------
  |  Branch (38:8): [True: 305, False: 2.19k]
  ------------------
   39|       |      /* get out of the loop as soon as they do not match */
   40|    305|      return 0;
   41|  2.19k|    first++;
   42|  2.19k|    second++;
   43|  2.19k|  }
   44|       |  /* If we are here either the strings are the same or the length is different.
   45|       |     We can test if the "current" character is non-zero for one and zero
   46|       |     for the other. Note that the characters may not be exactly the same even
   47|       |     if they match, we only want to compare zero-ness. */
   48|    212|  return !*first == !*second;
   49|    517|}
strequal.c:ncasecompare:
   52|  35.8k|{
   53|   147k|  while(*first && max) {
  ------------------
  |  Branch (53:9): [True: 147k, False: 0]
  |  Branch (53:19): [True: 130k, False: 17.2k]
  ------------------
   54|   130k|    if(Curl_raw_toupper(*first) != Curl_raw_toupper(*second))
  ------------------
  |  Branch (54:8): [True: 18.5k, False: 112k]
  ------------------
   55|  18.5k|      return 0;
   56|   112k|    max--;
   57|   112k|    first++;
   58|   112k|    second++;
   59|   112k|  }
   60|  17.2k|  if(max == 0)
  ------------------
  |  Branch (60:6): [True: 17.2k, False: 0]
  ------------------
   61|  17.2k|    return 1; /* they are equal this far */
   62|       |
   63|      0|  return Curl_raw_toupper(*first) == Curl_raw_toupper(*second);
   64|  17.2k|}

Curl_u8_strset_init:
   64|  2.43k|{
   65|       |#if defined(__GNUC__) && __GNUC__ >= 13
   66|       |#pragma GCC diagnostic push
   67|       |#pragma GCC diagnostic ignored "-Warray-bounds"
   68|       |#endif
   69|  2.43k|  memset(set, 0, sizeof(*set));
   70|       |#if defined(__GNUC__) && __GNUC__ >= 13
   71|       |#pragma GCC diagnostic pop
   72|       |#endif
   73|  2.43k|  set->data = set->sdata;
   74|  2.43k|  set->ids = set->sids;
   75|  2.43k|  set->psl = set->spsl;
   76|  2.43k|  set->slotbits = CURL_U8_STRSET_START_BITS;
  ------------------
  |  |   39|  2.43k|#define CURL_U8_STRSET_START_BITS   3
  ------------------
   77|  2.43k|  set->slotmask = CURL_U8_SLOT_MASK(set->slotbits);
  ------------------
  |  |   40|  2.43k|#define CURL_U8_SLOT_MASK(i)             (uint8_t)((1U << (i)) - 1)
  ------------------
   78|  2.43k|  set->count = 0;
   79|  2.43k|#ifdef DEBUGBUILD
   80|  2.43k|  set->init = CURL_U8_STRSET_MAGIC;
  ------------------
  |  |   31|  2.43k|#define CURL_U8_STRSET_MAGIC 0x7117e783
  ------------------
   81|  2.43k|#endif
   82|  2.43k|}
Curl_u8_strset_clear:
   85|    812|{
   86|    812|  uint16_t i;
   87|    812|  DEBUGASSERT(set->init == CURL_U8_STRSET_MAGIC);
  ------------------
  |  | 1046|    812|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (87:3): [True: 0, False: 812]
  |  Branch (87:3): [True: 812, False: 0]
  ------------------
   88|  7.30k|  for(i = 0; i < CURL_U8_STRSET_SLOT_CNT(set); ++i)
  ------------------
  |  |   41|  7.30k|#define CURL_U8_STRSET_SLOT_CNT(s)       CURL_U8_SLOT_CNT((s)->slotbits)
  |  |  ------------------
  |  |  |  |   39|  7.30k|#define CURL_U8_SLOT_CNT(i)              (uint16_t)((i) ? (1U << (i)) : 0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (39:53): [True: 7.30k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (88:14): [True: 6.49k, False: 812]
  ------------------
   89|  6.49k|    curlx_safefree(set->data[i]);
  ------------------
  |  | 1303|  7.30k|  do {                      \
  |  | 1304|  6.49k|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|  6.49k|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|  6.49k|    (ptr) = NULL;           \
  |  | 1306|  6.49k|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 6.49k]
  |  |  ------------------
  ------------------
   90|       |
   91|    812|  if(set->data != set->sdata)
  ------------------
  |  Branch (91:6): [True: 0, False: 812]
  ------------------
   92|       |    curlx_safefree(set->data);
  ------------------
  |  | 1303|      0|  do {                      \
  |  | 1304|      0|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|      0|    (ptr) = NULL;           \
  |  | 1306|      0|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 0]
  |  |  ------------------
  ------------------
   93|    812|  Curl_u8_strset_init(set);
   94|    812|}
Curl_u8_strset_get:
  199|  1.62k|{
  200|  1.62k|  uint8_t i;
  201|  1.62k|  DEBUGASSERT(set->init == CURL_U8_STRSET_MAGIC);
  ------------------
  |  | 1046|  1.62k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (201:3): [True: 0, False: 1.62k]
  |  Branch (201:3): [True: 1.62k, False: 0]
  ------------------
  202|  1.62k|  if(u8_strset_get_index(set, id, &i))
  ------------------
  |  Branch (202:6): [True: 0, False: 1.62k]
  ------------------
  203|      0|    return set->data[i];
  204|  1.62k|  return NULL;
  205|  1.62k|}
Curl_u8_strset_unset0:
  295|  4.06k|{
  296|       |  u8_strset_unset(set, id, TRUE);
  ------------------
  |  | 1016|  4.06k|#define TRUE true
  ------------------
  297|  4.06k|}
u8_strset.c:u8_strset_get_index:
  169|  5.68k|{
  170|  5.68k|  uint8_t i = CURL_U8_STRSET_SLOT_IDX(set, id);
  ------------------
  |  |   38|  5.68k|#define CURL_U8_STRSET_SLOT_IDX(s, i)    (uint8_t)((i) & (s)->slotmask)
  ------------------
  171|  5.68k|  uint8_t psl = 0;
  172|  5.68k|  while(set->data[i] && (psl <= set->psl[i])) {
  ------------------
  |  Branch (172:9): [True: 0, False: 5.68k]
  |  Branch (172:25): [True: 0, False: 0]
  ------------------
  173|      0|    if(set->ids[i] == id) {
  ------------------
  |  Branch (173:8): [True: 0, False: 0]
  ------------------
  174|      0|      *pindex = i;
  175|       |#if CURL_U8_STRSET_DEBUG
  176|       |      curl_mfprintf(stderr, "u8_strset_index %d=%s\n", id, set->data[i]);
  177|       |#endif
  178|      0|      return TRUE;
  ------------------
  |  | 1016|      0|#define TRUE true
  ------------------
  179|      0|    }
  180|      0|    i = CURL_U8_STRSET_SLOT_IDX(set, i + 1);
  ------------------
  |  |   38|      0|#define CURL_U8_STRSET_SLOT_IDX(s, i)    (uint8_t)((i) & (s)->slotmask)
  ------------------
  181|      0|    ++psl;
  182|      0|  }
  183|       |#if CURL_U8_STRSET_DEBUG
  184|       |  curl_mfprintf(stderr, "u8_strset_index %d not found\n", id);
  185|       |#endif
  186|  5.68k|  *pindex = 0;
  187|       |  return FALSE;
  ------------------
  |  | 1019|  5.68k|#define FALSE false
  ------------------
  188|  5.68k|}
u8_strset.c:u8_strset_unset:
  264|  4.06k|{
  265|  4.06k|  uint8_t i, j;
  266|       |
  267|  4.06k|  DEBUGASSERT(set->init == CURL_U8_STRSET_MAGIC);
  ------------------
  |  | 1046|  4.06k|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (267:3): [True: 0, False: 4.06k]
  |  Branch (267:3): [True: 4.06k, False: 0]
  ------------------
  268|  4.06k|  if(u8_strset_get_index(set, id, &i)) {
  ------------------
  |  Branch (268:6): [True: 0, False: 4.06k]
  ------------------
  269|       |    /* `id` is in set */
  270|      0|    if(zero)
  ------------------
  |  Branch (270:8): [True: 0, False: 0]
  ------------------
  271|      0|      curlx_strzero(set->data[i]);
  272|      0|    curlx_safefree(set->data[i]);
  ------------------
  |  | 1303|      0|  do {                      \
  |  | 1304|      0|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|      0|    (ptr) = NULL;           \
  |  | 1306|      0|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 0]
  |  |  ------------------
  ------------------
  273|      0|    set->ids[i] = set->psl[i] = 0;
  274|      0|    --set->count;
  275|      0|    j = CURL_U8_STRSET_SLOT_IDX(set, i + 1);
  ------------------
  |  |   38|      0|#define CURL_U8_STRSET_SLOT_IDX(s, i)    (uint8_t)((i) & (s)->slotmask)
  ------------------
  276|       |    /* shift all entries with positive psl "down" */
  277|      0|    while(set->data[j] && set->psl[j]) {
  ------------------
  |  Branch (277:11): [True: 0, False: 0]
  |  Branch (277:27): [True: 0, False: 0]
  ------------------
  278|      0|      set->data[i] = set->data[j];
  279|      0|      set->ids[i] = set->ids[j];
  280|      0|      set->psl[i] = (uint8_t)(set->psl[j] - 1);
  281|      0|      set->data[j] = NULL;
  282|      0|      set->ids[j] = set->psl[j] = 0;
  283|      0|      i = j;
  284|      0|      j = CURL_U8_STRSET_SLOT_IDX(set, i + 1);
  ------------------
  |  |   38|      0|#define CURL_U8_STRSET_SLOT_IDX(s, i)    (uint8_t)((i) & (s)->slotmask)
  ------------------
  285|      0|    }
  286|      0|  }
  287|  4.06k|}

Curl_freeset:
  148|    812|{
  149|       |  /* Free all dynamic strings stored in the data->set substructure. */
  150|    812|  enum dupblob j;
  151|       |
  152|    812|  CURL_EASY_STR_CLEAR0(data, STRING_PASSWORD);
  ------------------
  |  | 1241|    812|  Curl_u8_strset_unset0(&(d)->set.strings, (uint8_t)(id))
  ------------------
  153|    812|  CURL_EASY_STR_CLEAR0(data, STRING_KEY_PASSWD);
  ------------------
  |  | 1241|    812|  Curl_u8_strset_unset0(&(d)->set.strings, (uint8_t)(id))
  ------------------
  154|    812|  CURL_EASY_STR_CLEAR0(data, STRING_BEARER);
  ------------------
  |  | 1241|    812|  Curl_u8_strset_unset0(&(d)->set.strings, (uint8_t)(id))
  ------------------
  155|    812|#ifndef CURL_DISABLE_PROXY
  156|    812|  CURL_EASY_STR_CLEAR0(data, STRING_PROXYPASSWORD);
  ------------------
  |  | 1241|    812|  Curl_u8_strset_unset0(&(d)->set.strings, (uint8_t)(id))
  ------------------
  157|    812|  CURL_EASY_STR_CLEAR0(data, STRING_KEY_PASSWD_PROXY);
  ------------------
  |  | 1241|    812|  Curl_u8_strset_unset0(&(d)->set.strings, (uint8_t)(id))
  ------------------
  158|    812|#endif
  159|    812|  Curl_u8_strset_clear(&data->set.strings);
  160|    812|  curlx_safefree(data->set.str_copypostfields);
  ------------------
  |  | 1303|    812|  do {                      \
  |  | 1304|    812|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|    812|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|    812|    (ptr) = NULL;           \
  |  | 1306|    812|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 812]
  |  |  ------------------
  ------------------
  161|       |
  162|  7.30k|  for(j = (enum dupblob)0; j < BLOB_LAST; j++) {
  ------------------
  |  Branch (162:28): [True: 6.49k, False: 812]
  ------------------
  163|  6.49k|    curlx_safefree(data->set.blobs[j]);
  ------------------
  |  | 1303|  6.49k|  do {                      \
  |  | 1304|  6.49k|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|  6.49k|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|  6.49k|    (ptr) = NULL;           \
  |  | 1306|  6.49k|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 6.49k]
  |  |  ------------------
  ------------------
  164|  6.49k|  }
  165|       |
  166|    812|  Curl_bufref_free(&data->state.referer);
  167|    812|  Curl_bufref_free(&data->state.url);
  168|       |
  169|    812|#if !defined(CURL_DISABLE_MIME) || !defined(CURL_DISABLE_FORM_API)
  170|    812|  Curl_mime_cleanpart(data->set.mimepostp);
  171|    812|  curlx_safefree(data->set.mimepostp);
  ------------------
  |  | 1303|    812|  do {                      \
  |  | 1304|    812|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|    812|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|    812|    (ptr) = NULL;           \
  |  | 1306|    812|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 812]
  |  |  ------------------
  ------------------
  172|    812|#endif
  173|       |
  174|    812|#ifndef CURL_DISABLE_COOKIES
  175|    812|  curl_slist_free_all(data->state.cookielist);
  176|       |  data->state.cookielist = NULL;
  177|    812|#endif
  178|    812|}
Curl_close:
  198|    812|{
  199|    812|  struct Curl_easy *data;
  200|       |
  201|    812|  if(!datap || !*datap)
  ------------------
  |  Branch (201:6): [True: 0, False: 812]
  |  Branch (201:16): [True: 0, False: 812]
  ------------------
  202|      0|    return CURLE_OK;
  203|       |
  204|    812|  data = *datap;
  205|    812|  *datap = NULL;
  206|       |
  207|    812|  if(!data->state.internal && data->multi) {
  ------------------
  |  Branch (207:6): [True: 812, False: 0]
  |  Branch (207:31): [True: 0, False: 812]
  ------------------
  208|       |    /* This handle is still part of a multi handle, take care of this first
  209|       |       and detach this handle from there.
  210|       |       This detaches the connection. */
  211|      0|    Curl_multi_remove_handle(data->multi, data);
  212|      0|  }
  213|    812|  else {
  214|       |    /* Detach connection if any is left. This should not be normal, but can be
  215|       |       the case for example with CONNECT_ONLY + recv/send (test 556) */
  216|    812|    Curl_detach_connection(data);
  217|    812|    if(!data->state.internal && data->multi_easy) {
  ------------------
  |  Branch (217:8): [True: 812, False: 0]
  |  Branch (217:33): [True: 0, False: 812]
  ------------------
  218|       |      /* when curl_easy_perform() is used, it creates its own multi handle to
  219|       |         use and this is the one */
  220|      0|      curl_multi_cleanup(data->multi_easy);
  221|      0|      data->multi_easy = NULL;
  222|      0|    }
  223|    812|  }
  224|    812|  DEBUGASSERT(!data->conn || data->state.internal);
  ------------------
  |  | 1046|    812|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (224:3): [True: 812, False: 0]
  |  Branch (224:3): [True: 0, False: 0]
  |  Branch (224:3): [True: 812, False: 0]
  |  Branch (224:3): [True: 0, False: 0]
  ------------------
  225|       |
  226|    812|  Curl_expire_clear_all(data); /* shut off any timers left */
  227|       |
  228|    812|  if(data->state.rangestringalloc)
  ------------------
  |  Branch (228:6): [True: 0, False: 812]
  ------------------
  229|      0|    curlx_free(data->state.range);
  ------------------
  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  ------------------
  230|       |
  231|       |  /* release any resolve information this transfer kept */
  232|    812|  Curl_resolv_destroy_all(data);
  233|       |
  234|    812|  data->set.verbose = FALSE; /* no more calls to DEBUGFUNCTION */
  ------------------
  |  | 1019|    812|#define FALSE false
  ------------------
  235|    812|  data->magic = 0; /* force a clear AFTER the possibly enforced removal from
  236|       |                    * the multi handle and async dns shutdown. The multi
  237|       |                    * handle might check the magic and so might any
  238|       |                    * DEBUGFUNCTION invoked for tracing */
  239|       |
  240|       |  /* freed here in case DONE was not called */
  241|    812|  Curl_req_free(&data->req, data);
  242|       |
  243|       |  /* Close down all open SSL info and sessions */
  244|    812|  Curl_ssl_close_all(data);
  245|    812|  Curl_peer_unlink(&data->state.origin);
  246|    812|  Curl_peer_unlink(&data->state.initial_origin);
  247|    812|#ifndef CURL_DISABLE_RTSP
  248|    812|  Curl_peer_unlink(&data->state.rtsp_session_origin);
  249|    812|#endif
  250|    812|  Curl_ssl_free_certinfo(data);
  251|       |
  252|    812|  Curl_bufref_free(&data->state.referer);
  253|       |
  254|    812|  up_free(data);
  255|    812|  curlx_dyn_free(&data->state.headerb);
  256|    812|  Curl_flush_cookies(data, TRUE);
  ------------------
  |  | 1016|    812|#define TRUE true
  ------------------
  257|    812|#ifndef CURL_DISABLE_ALTSVC
  258|    812|  Curl_altsvc_save(data, data->asi, CURL_EASY_STR(data, STRING_ALTSVC));
  ------------------
  |  | 1233|    812|  Curl_u8_strset_get(&(d)->set.strings, (uint8_t)(id))
  ------------------
  259|    812|  Curl_altsvc_cleanup(&data->asi);
  260|    812|#endif
  261|    812|#ifndef CURL_DISABLE_HSTS
  262|    812|  Curl_hsts_save(data, data->hsts, CURL_EASY_STR(data, STRING_HSTS));
  ------------------
  |  | 1233|    812|  Curl_u8_strset_get(&(d)->set.strings, (uint8_t)(id))
  ------------------
  263|    812|  if(!data->share || !data->share->hsts)
  ------------------
  |  Branch (263:6): [True: 812, False: 0]
  |  Branch (263:22): [True: 0, False: 0]
  ------------------
  264|    812|    Curl_hsts_cleanup(&data->hsts);
  265|    812|  curl_slist_free_all(data->state.hstslist); /* clean up list */
  266|    812|#endif
  267|    812|#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_DIGEST_AUTH)
  268|    812|  Curl_http_auth_cleanup_digest(data);
  269|    812|#endif
  270|    812|  curlx_safefree(data->state.most_recent_ftp_entrypath);
  ------------------
  |  | 1303|    812|  do {                      \
  |  | 1304|    812|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|    812|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|    812|    (ptr) = NULL;           \
  |  | 1306|    812|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 812]
  |  |  ------------------
  ------------------
  271|    812|  curlx_safefree(data->info.contenttype);
  ------------------
  |  | 1303|    812|  do {                      \
  |  | 1304|    812|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|    812|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|    812|    (ptr) = NULL;           \
  |  | 1306|    812|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 812]
  |  |  ------------------
  ------------------
  272|    812|  curlx_safefree(data->info.wouldredirect);
  ------------------
  |  | 1303|    812|  do {                      \
  |  | 1304|    812|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|    812|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|    812|    (ptr) = NULL;           \
  |  | 1306|    812|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 812]
  |  |  ------------------
  ------------------
  273|    812|  curlx_safefree(data->info.effective_url);
  ------------------
  |  | 1303|    812|  do {                      \
  |  | 1304|    812|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|    812|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|    812|    (ptr) = NULL;           \
  |  | 1306|    812|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 812]
  |  |  ------------------
  ------------------
  274|       |
  275|       |  /* No longer a dirty share, if it exists */
  276|    812|  if(Curl_share_easy_unlink(data))
  ------------------
  |  Branch (276:6): [True: 0, False: 812]
  ------------------
  277|    812|    DEBUGASSERT(0);
  ------------------
  |  | 1046|    812|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (277:5): [Folded, False: 0]
  |  Branch (277:5): [Folded, False: 0]
  ------------------
  278|       |
  279|    812|  Curl_hash_destroy(&data->meta_hash);
  280|    812|  Curl_creds_unlink(&data->state.creds);
  281|    812|#ifndef CURL_DISABLE_HTTP
  282|    812|  curlx_safefree(data->state.rangeline);
  ------------------
  |  | 1303|    812|  do {                      \
  |  | 1304|    812|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|    812|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|    812|    (ptr) = NULL;           \
  |  | 1306|    812|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 812]
  |  |  ------------------
  ------------------
  283|    812|  curlx_safefree(data->state.http_host);
  ------------------
  |  | 1303|    812|  do {                      \
  |  | 1304|    812|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|    812|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|    812|    (ptr) = NULL;           \
  |  | 1306|    812|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 812]
  |  |  ------------------
  ------------------
  284|    812|#endif
  285|    812|#ifndef CURL_DISABLE_COOKIES
  286|    812|  curlx_safefree(data->req.cookiehost);
  ------------------
  |  | 1303|    812|  do {                      \
  |  | 1304|    812|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|    812|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|    812|    (ptr) = NULL;           \
  |  | 1306|    812|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 812]
  |  |  ------------------
  ------------------
  287|    812|#endif
  288|       |
  289|    812|#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_FORM_API)
  290|    812|  Curl_mime_cleanpart(data->state.formp);
  291|    812|  curlx_safefree(data->state.formp);
  ------------------
  |  | 1303|    812|  do {                      \
  |  | 1304|    812|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|    812|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|    812|    (ptr) = NULL;           \
  |  | 1306|    812|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 812]
  |  |  ------------------
  ------------------
  292|    812|#endif
  293|       |
  294|       |  /* destruct wildcard structures if it is needed */
  295|    812|  Curl_wildcard_dtor(&data->wildcard);
  296|    812|  Curl_freeset(data);
  297|    812|  Curl_headers_cleanup(data);
  298|    812|  Curl_netrc_cleanup(&data->state.netrc);
  299|    812|#ifndef CURL_DISABLE_DIGEST_AUTH
  300|    812|  curlx_free(data->state.envproxy);
  ------------------
  |  | 1447|    812|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  ------------------
  301|    812|#endif
  302|    812|  curlx_memzero(data, sizeof(*data));
  303|    812|  curlx_free(data);
  ------------------
  |  | 1447|    812|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  ------------------
  304|    812|  return CURLE_OK;
  305|    812|}
Curl_init_userdefined:
  312|    812|{
  313|    812|  struct UserDefined *set = &data->set;
  314|       |
  315|    812|  set->out = stdout;  /* default output to stdout */
  316|    812|  set->in_set = stdin;  /* default input from stdin */
  317|    812|  set->err = stderr;  /* default stderr to stderr */
  318|       |
  319|    812|  Curl_u8_strset_init(&data->set.strings);
  320|       |
  321|    812|#if defined(__clang__) && __clang_major__ >= 16
  322|    812|#pragma clang diagnostic push
  323|    812|#pragma clang diagnostic ignored "-Wcast-function-type-strict"
  324|    812|#endif
  325|       |  /* use fwrite as default function to store output */
  326|    812|  set->fwrite_func = (curl_write_callback)fwrite;
  327|       |
  328|       |  /* use fread as default function to read input */
  329|    812|  set->fread_func_set = (curl_read_callback)fread;
  330|    812|#if defined(__clang__) && __clang_major__ >= 16
  331|    812|#pragma clang diagnostic pop
  332|    812|#endif
  333|    812|  set->is_fread_set = 0;
  334|       |
  335|    812|  set->seek_client = ZERO_NULL;
  ------------------
  |  | 1129|    812|#define ZERO_NULL 0
  ------------------
  336|       |
  337|    812|  set->filesize = -1;        /* we do not know the size */
  338|    812|  set->postfieldsize = -1;   /* unknown size */
  339|    812|  set->maxredirs = 30;       /* sensible default */
  340|       |
  341|    812|  set->method = HTTPREQ_GET; /* Default HTTP request */
  342|    812|#ifndef CURL_DISABLE_RTSP
  343|    812|  set->rtspreq = RTSPREQ_OPTIONS; /* Default RTSP request */
  ------------------
  |  |   34|    812|#define RTSPREQ_OPTIONS CURL_RTSPREQ_OPTIONS
  |  |  ------------------
  |  |  |  | 2367|    812|#define CURL_RTSPREQ_OPTIONS       1L
  |  |  ------------------
  ------------------
  344|    812|#endif
  345|    812|#ifndef CURL_DISABLE_FTP
  346|    812|  set->ftp_use_epsv = TRUE;   /* FTP defaults to EPSV operations */
  ------------------
  |  | 1016|    812|#define TRUE true
  ------------------
  347|    812|  set->ftp_use_eprt = TRUE;   /* FTP defaults to EPRT operations */
  ------------------
  |  | 1016|    812|#define TRUE true
  ------------------
  348|    812|  set->ftp_use_pret = FALSE;  /* mainly useful for drftpd servers */
  ------------------
  |  | 1019|    812|#define FALSE false
  ------------------
  349|    812|  set->ftp_filemethod = FTPFILE_MULTICWD;
  350|    812|  set->ftp_skip_ip = TRUE;    /* skip PASV IP by default */
  ------------------
  |  | 1016|    812|#define TRUE true
  ------------------
  351|    812|#endif
  352|    812|  set->dns_cache_timeout_ms = 60000; /* Timeout every 60 seconds by default */
  353|       |
  354|       |  /* Timeout every 24 hours by default */
  355|    812|  set->ssl_ca_cache_timeout = 24 * 60 * 60;
  356|       |
  357|    812|  set->httpauth = CURLAUTH_BASIC;  /* defaults to basic */
  ------------------
  |  |  833|    812|#define CURLAUTH_BASIC        (((unsigned long)1) << 0)
  ------------------
  358|       |
  359|    812|  Curl_ssl_config_init(&data->set.ssl);
  360|    812|#ifndef CURL_DISABLE_PROXY
  361|    812|  Curl_ssl_config_init(&data->set.proxy_ssl);
  362|    812|  set->proxyport = 0;
  363|    812|  set->proxytype = CURLPROXY_HTTP; /* defaults to HTTP proxy */
  ------------------
  |  |  792|    812|#define CURLPROXY_HTTP            0L /* added in 7.10, new in 7.19.4 default is
  ------------------
  364|    812|  set->proxyauth = CURLAUTH_BASIC; /* defaults to basic */
  ------------------
  |  |  833|    812|#define CURLAUTH_BASIC        (((unsigned long)1) << 0)
  ------------------
  365|       |  /* SOCKS5 proxy auth defaults to username/password + GSS-API */
  366|    812|  set->socks5auth = CURLAUTH_BASIC | CURLAUTH_GSSAPI;
  ------------------
  |  |  833|    812|#define CURLAUTH_BASIC        (((unsigned long)1) << 0)
  ------------------
                set->socks5auth = CURLAUTH_BASIC | CURLAUTH_GSSAPI;
  ------------------
  |  |  839|    812|#define CURLAUTH_GSSAPI CURLAUTH_NEGOTIATE
  |  |  ------------------
  |  |  |  |  835|    812|#define CURLAUTH_NEGOTIATE    (((unsigned long)1) << 2)
  |  |  ------------------
  ------------------
  367|    812|#endif
  368|       |
  369|    812|#ifndef CURL_DISABLE_DOH
  370|    812|  set->doh_verifyhost = TRUE;
  ------------------
  |  | 1016|    812|#define TRUE true
  ------------------
  371|    812|  set->doh_verifypeer = TRUE;
  ------------------
  |  | 1016|    812|#define TRUE true
  ------------------
  372|    812|#endif
  373|       |#ifdef USE_SSH
  374|       |  /* defaults to any auth type */
  375|       |  set->ssh_auth_types = CURLSSH_AUTH_DEFAULT;
  376|       |  set->new_directory_perms = 0755; /* Default permissions */
  377|       |#endif
  378|       |
  379|    812|  set->new_file_perms = 0644;    /* Default permissions */
  380|    812|  set->allowed_protocols = (curl_prot_t)CURLPROTO_64ALL;
  ------------------
  |  |   66|    812|#define CURLPROTO_64ALL ((uint64_t)0xffffffffffffffff)
  ------------------
  381|    812|  set->redir_protocols = CURLPROTO_REDIR;
  ------------------
  |  |   69|    812|#define CURLPROTO_REDIR (CURLPROTO_HTTP | CURLPROTO_HTTPS | CURLPROTO_FTP | \
  |  |  ------------------
  |  |  |  | 1088|    812|#define CURLPROTO_HTTP    (1L << 0)
  |  |  ------------------
  |  |               #define CURLPROTO_REDIR (CURLPROTO_HTTP | CURLPROTO_HTTPS | CURLPROTO_FTP | \
  |  |  ------------------
  |  |  |  | 1089|    812|#define CURLPROTO_HTTPS   (1L << 1)
  |  |  ------------------
  |  |               #define CURLPROTO_REDIR (CURLPROTO_HTTP | CURLPROTO_HTTPS | CURLPROTO_FTP | \
  |  |  ------------------
  |  |  |  | 1090|    812|#define CURLPROTO_FTP     (1L << 2)
  |  |  ------------------
  |  |   70|    812|                         CURLPROTO_FTPS)
  |  |  ------------------
  |  |  |  | 1091|    812|#define CURLPROTO_FTPS    (1L << 3)
  |  |  ------------------
  ------------------
  382|       |
  383|       |#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
  384|       |  /*
  385|       |   * disallow unprotected protection negotiation NEC reference implementation
  386|       |   * seem not to follow rfc1961 section 4.3/4.4
  387|       |   */
  388|       |  set->socks5_gssapi_nec = FALSE;
  389|       |#endif
  390|       |
  391|       |  /* set default minimum TLS version */
  392|    812|#ifdef USE_SSL
  393|    812|  Curl_setopt_SSLVERSION(data, CURLOPT_SSLVERSION, CURL_SSLVERSION_DEFAULT);
  ------------------
  |  | 2394|    812|#define CURL_SSLVERSION_DEFAULT 0L
  ------------------
  394|    812|#ifndef CURL_DISABLE_PROXY
  395|    812|  Curl_setopt_SSLVERSION(data, CURLOPT_PROXY_SSLVERSION,
  396|    812|                         CURL_SSLVERSION_DEFAULT);
  ------------------
  |  | 2394|    812|#define CURL_SSLVERSION_DEFAULT 0L
  ------------------
  397|    812|#endif
  398|    812|#endif
  399|    812|#ifndef CURL_DISABLE_FTP
  400|    812|  set->wildcard_enabled = FALSE;
  ------------------
  |  | 1019|    812|#define FALSE false
  ------------------
  401|    812|  set->chunk_bgn = ZERO_NULL;
  ------------------
  |  | 1129|    812|#define ZERO_NULL 0
  ------------------
  402|    812|  set->chunk_end = ZERO_NULL;
  ------------------
  |  | 1129|    812|#define ZERO_NULL 0
  ------------------
  403|    812|  set->fnmatch = ZERO_NULL;
  ------------------
  |  | 1129|    812|#define ZERO_NULL 0
  ------------------
  404|    812|#endif
  405|    812|  set->tcp_keepalive = FALSE;
  ------------------
  |  | 1019|    812|#define FALSE false
  ------------------
  406|    812|  set->tcp_keepintvl = 60;
  407|    812|  set->tcp_keepidle = 60;
  408|    812|  set->tcp_keepcnt = 9;
  409|    812|  set->tcp_fastopen = FALSE;
  ------------------
  |  | 1019|    812|#define FALSE false
  ------------------
  410|    812|  set->tcp_nodelay = TRUE;
  ------------------
  |  | 1016|    812|#define TRUE true
  ------------------
  411|    812|  set->ssl_enable_alpn = TRUE;
  ------------------
  |  | 1016|    812|#define TRUE true
  ------------------
  412|    812|  set->expect_100_timeout = 1000L; /* Wait for a second by default. */
  413|    812|  set->sep_headers = TRUE; /* separated header lists by default */
  ------------------
  |  | 1016|    812|#define TRUE true
  ------------------
  414|    812|  set->buffer_size = READBUFFER_SIZE;
  ------------------
  |  |  120|    812|#define READBUFFER_SIZE CURL_MAX_WRITE_SIZE
  |  |  ------------------
  |  |  |  |  267|    812|#define CURL_MAX_WRITE_SIZE 16384
  |  |  ------------------
  ------------------
  415|    812|  set->upload_buffer_size = UPLOADBUFFER_DEFAULT;
  ------------------
  |  |  132|    812|#define UPLOADBUFFER_DEFAULT 65536
  ------------------
  416|    812|  set->upload_flags = CURLULFLAG_SEEN;
  ------------------
  |  | 1054|    812|#define CURLULFLAG_SEEN     (1L << 4)
  ------------------
  417|    812|  set->happy_eyeballs_timeout = CURL_HET_DEFAULT;
  ------------------
  |  |  979|    812|#define CURL_HET_DEFAULT 200L
  ------------------
  418|    812|  set->upkeep_interval_ms = CURL_UPKEEP_INTERVAL_DEFAULT;
  ------------------
  |  |  982|    812|#define CURL_UPKEEP_INTERVAL_DEFAULT 60000L
  ------------------
  419|    812|  set->maxconnects = DEFAULT_CONNCACHE_SIZE; /* for easy handles */
  ------------------
  |  |   38|    812|#define DEFAULT_CONNCACHE_SIZE 5
  ------------------
  420|    812|  set->conn_max_idle_ms = 118 * 1000;
  421|    812|  set->conn_max_age_ms = 24 * 3600 * 1000;
  422|    812|  set->http09_allowed = FALSE;
  ------------------
  |  | 1019|    812|#define FALSE false
  ------------------
  423|    812|  set->httpwant = CURL_HTTP_VERSION_NONE;
  ------------------
  |  | 2338|    812|#define CURL_HTTP_VERSION_NONE  0L /* setting this means we do not care, and
  ------------------
  424|    812|#if defined(USE_HTTP2) || defined(USE_HTTP3)
  425|    812|  set->weight = 0;
  426|    812|#endif
  427|    812|  set->quick_exit = 0L;
  428|    812|#ifndef CURL_DISABLE_WEBSOCKETS
  429|    812|  set->ws_raw_mode = FALSE;
  ------------------
  |  | 1019|    812|#define FALSE false
  ------------------
  430|       |  set->ws_no_auto_pong = FALSE;
  ------------------
  |  | 1019|    812|#define FALSE false
  ------------------
  431|    812|#endif
  432|    812|}
Curl_open:
  453|    812|{
  454|    812|  struct Curl_easy *data;
  455|       |
  456|       |  /* simple start-up: alloc the struct, init it with zeroes and return */
  457|    812|  data = curlx_calloc(1, sizeof(struct Curl_easy));
  ------------------
  |  | 1444|    812|  curl_dbg_calloc(nbelem, size, __LINE__, __FILE__)
  ------------------
  458|    812|  if(!data) {
  ------------------
  |  Branch (458:6): [True: 0, False: 812]
  ------------------
  459|       |    /* this is a serious error */
  460|      0|    DEBUGF(curl_mfprintf(stderr, "Error: calloc of Curl_easy failed\n"));
  ------------------
  |  | 1032|      0|#define DEBUGF(x) x
  ------------------
  461|      0|    return CURLE_OUT_OF_MEMORY;
  462|      0|  }
  463|       |
  464|    812|  data->magic = CURLEASY_MAGIC_NUMBER;
  ------------------
  |  |   28|    812|#define CURLEASY_MAGIC_NUMBER 0xc0dedbadU
  ------------------
  465|       |  /* most recent connection is not yet defined */
  466|    812|  data->state.last_conn_id = -1;
  467|    812|  data->state.last_cpid = UINT32_MAX;
  468|       |  /* and not assigned an id yet */
  469|    812|  data->id = -1;
  470|    812|  data->mid = UINT32_MAX;
  471|    812|  data->master_mid = UINT32_MAX;
  472|    812|  data->progress.hide = TRUE;
  ------------------
  |  | 1016|    812|#define TRUE true
  ------------------
  473|       |
  474|    812|  Curl_hash_init(&data->meta_hash, 23, CURL_HASH_TYPE_BYTES,
  475|    812|                 easy_meta_freeentry);
  476|    812|  DEBUGASSERT(STRING_LAST <= UINT8_MAX);
  ------------------
  |  | 1046|    812|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (476:3): [True: 0, Folded]
  |  Branch (476:3): [True: 812, Folded]
  ------------------
  477|    812|  Curl_u8_strset_init(&data->set.strings);
  478|    812|  curlx_dyn_init(&data->state.headerb, CURL_MAX_HTTP_HEADER);
  ------------------
  |  |  274|    812|#define CURL_MAX_HTTP_HEADER (100 * 1024)
  ------------------
  479|    812|  Curl_bufref_init(&data->state.url);
  480|    812|  Curl_bufref_init(&data->state.referer);
  481|    812|  Curl_req_init(&data->req);
  482|    812|  Curl_initinfo(data);
  483|    812|#ifndef CURL_DISABLE_HTTP
  484|    812|  Curl_llist_init(&data->state.httphdrs, NULL);
  485|    812|#endif
  486|    812|  Curl_netrc_init(&data->state.netrc);
  487|    812|  Curl_init_userdefined(data);
  488|       |
  489|    812|  *curl = data;
  490|    812|  return CURLE_OK;
  491|    812|}
url.c:up_free:
  182|    812|{
  183|    812|  struct urlpieces *up = &data->state.up;
  184|    812|  curlx_safefree(up->options);
  ------------------
  |  | 1303|    812|  do {                      \
  |  | 1304|    812|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|    812|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|    812|    (ptr) = NULL;           \
  |  | 1306|    812|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 812]
  |  |  ------------------
  ------------------
  185|    812|  curlx_safefree(up->path);
  ------------------
  |  | 1303|    812|  do {                      \
  |  | 1304|    812|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|    812|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|    812|    (ptr) = NULL;           \
  |  | 1306|    812|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 812]
  |  |  ------------------
  ------------------
  186|    812|  curlx_safefree(up->query);
  ------------------
  |  | 1303|    812|  do {                      \
  |  | 1304|    812|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|    812|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|    812|    (ptr) = NULL;           \
  |  | 1306|    812|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 812]
  |  |  ------------------
  ------------------
  187|    812|  curl_url_cleanup(data->state.uh);
  188|       |  data->state.uh = NULL;
  189|    812|}

curl_url_cleanup:
 1418|    812|{
 1419|    812|  if(u) {
  ------------------
  |  Branch (1419:6): [True: 0, False: 812]
  ------------------
 1420|      0|    free_urlhandle(u);
 1421|      0|    curlx_free(u);
  ------------------
  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  ------------------
 1422|      0|  }
 1423|    812|}

Curl_auth_digest_cleanup:
 1044|  1.62k|{
 1045|  1.62k|  Curl_peer_unlink(&digest->origin);
 1046|  1.62k|  Curl_creds_unlink(&digest->creds);
 1047|  1.62k|  curlx_safefree(digest->nonce);
  ------------------
  |  | 1303|  1.62k|  do {                      \
  |  | 1304|  1.62k|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|  1.62k|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|  1.62k|    (ptr) = NULL;           \
  |  | 1306|  1.62k|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 1.62k]
  |  |  ------------------
  ------------------
 1048|  1.62k|  curlx_safefree(digest->cnonce);
  ------------------
  |  | 1303|  1.62k|  do {                      \
  |  | 1304|  1.62k|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|  1.62k|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|  1.62k|    (ptr) = NULL;           \
  |  | 1306|  1.62k|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 1.62k]
  |  |  ------------------
  ------------------
 1049|  1.62k|  curlx_safefree(digest->realm);
  ------------------
  |  | 1303|  1.62k|  do {                      \
  |  | 1304|  1.62k|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|  1.62k|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|  1.62k|    (ptr) = NULL;           \
  |  | 1306|  1.62k|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 1.62k]
  |  |  ------------------
  ------------------
 1050|  1.62k|  curlx_safefree(digest->opaque);
  ------------------
  |  | 1303|  1.62k|  do {                      \
  |  | 1304|  1.62k|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|  1.62k|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|  1.62k|    (ptr) = NULL;           \
  |  | 1306|  1.62k|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 1.62k]
  |  |  ------------------
  ------------------
 1051|  1.62k|  curlx_safefree(digest->qop);
  ------------------
  |  | 1303|  1.62k|  do {                      \
  |  | 1304|  1.62k|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|  1.62k|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|  1.62k|    (ptr) = NULL;           \
  |  | 1306|  1.62k|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 1.62k]
  |  |  ------------------
  ------------------
 1052|  1.62k|  curlx_safefree(digest->algorithm);
  ------------------
  |  | 1303|  1.62k|  do {                      \
  |  | 1304|  1.62k|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|  1.62k|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|  1.62k|    (ptr) = NULL;           \
  |  | 1306|  1.62k|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 1.62k]
  |  |  ------------------
  ------------------
 1053|       |
 1054|  1.62k|  digest->nc = 0;
 1055|  1.62k|  digest->algo = ALGO_MD5; /* default algorithm */
  ------------------
  |  |   44|  1.62k|#define ALGO_MD5 0
  ------------------
 1056|  1.62k|  digest->stale = FALSE;   /* default means normal, not stale */
  ------------------
  |  | 1019|  1.62k|#define FALSE false
  ------------------
 1057|       |  digest->userhash = FALSE;
  ------------------
  |  | 1019|  1.62k|#define FALSE false
  ------------------
 1058|  1.62k|}

Curl_async_global_init:
   81|      2|{
   82|       |#if defined(USE_ARES) && defined(CARES_HAVE_ARES_LIBRARY_INIT)
   83|       |  if(ares_library_init(ARES_LIB_INIT_ALL)) {
   84|       |    return CURLE_FAILED_INIT;
   85|       |  }
   86|       |#endif
   87|      2|  return CURLE_OK;
   88|      2|}

Curl_resolv_destroy_all:
 1175|    812|{
 1176|    812|  while(data->state.async) {
  ------------------
  |  Branch (1176:9): [True: 0, False: 812]
  ------------------
 1177|      0|    struct Curl_resolv_async *async = data->state.async;
 1178|      0|    data->state.async = async->next;
 1179|      0|    Curl_async_destroy(data, async);
 1180|      0|  }
 1181|    812|}

Curl_tls_keylog_open:
   39|      2|{
   40|      2|  if(!keylog_file_fp) {
  ------------------
  |  Branch (40:6): [True: 2, False: 0]
  ------------------
   41|      2|    keylog_file_name = getenv("SSLKEYLOGFILE");
   42|      2|    if(keylog_file_name) {
  ------------------
  |  Branch (42:8): [True: 0, False: 2]
  ------------------
   43|      0|      keylog_file_fp = curlx_fopen(keylog_file_name, FOPEN_APPENDTEXT);
  ------------------
  |  |   83|      0|#define curlx_fopen(file, mode) curl_dbg_fopen(file, mode, __LINE__, __FILE__)
  ------------------
   44|      0|      if(keylog_file_fp) {
  ------------------
  |  Branch (44:10): [True: 0, False: 0]
  ------------------
   45|       |#ifdef _WIN32
   46|       |        if(setvbuf(keylog_file_fp, NULL, _IONBF, 0))
   47|       |#else
   48|      0|        if(setvbuf(keylog_file_fp, NULL, _IOLBF, 4096))
  ------------------
  |  Branch (48:12): [True: 0, False: 0]
  ------------------
   49|      0|#endif
   50|      0|        {
   51|      0|          curlx_fclose(keylog_file_fp);
  ------------------
  |  |   88|      0|#define curlx_fclose(file)      curl_dbg_fclose(file, __LINE__, __FILE__)
  ------------------
   52|       |          keylog_file_fp = NULL;
   53|      0|        }
   54|      0|      }
   55|      0|    }
   56|      2|  }
   57|      2|}

openssl.c:rand_enough:
  807|      4|{
  808|      4|  return RAND_status() != 0;
  809|      4|}
openssl.c:ossl_provider_cleanup:
 1738|    812|{
 1739|    812|  if(data->state.baseprov) {
  ------------------
  |  Branch (1739:6): [True: 0, False: 812]
  ------------------
 1740|      0|    OSSL_PROVIDER_unload(data->state.baseprov);
 1741|      0|    data->state.baseprov = NULL;
 1742|      0|  }
 1743|    812|  if(data->state.provider) {
  ------------------
  |  Branch (1743:6): [True: 0, False: 812]
  ------------------
 1744|      0|    OSSL_PROVIDER_unload(data->state.provider);
 1745|      0|    data->state.provider = NULL;
 1746|      0|  }
 1747|    812|  OSSL_LIB_CTX_free(data->state.libctx);
 1748|    812|  data->state.libctx = NULL;
 1749|    812|  curlx_safefree(data->state.propq);
  ------------------
  |  | 1303|    812|  do {                      \
  |  | 1304|    812|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|    812|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|    812|    (ptr) = NULL;           \
  |  | 1306|    812|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 812]
  |  |  ------------------
  ------------------
 1750|       |  data->state.provider_loaded = FALSE;
  ------------------
  |  | 1019|    812|#define FALSE false
  ------------------
 1751|    812|}
openssl.c:ossl_init:
 1622|      2|{
 1623|      2|  const uint64_t flags =
 1624|      2|#ifdef OPENSSL_INIT_ENGINE_ALL_BUILTIN
 1625|       |    /* not present in BoringSSL */
 1626|      2|    OPENSSL_INIT_ENGINE_ALL_BUILTIN |
 1627|      2|#endif
 1628|       |#ifdef CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG
 1629|       |    OPENSSL_INIT_NO_LOAD_CONFIG |
 1630|       |#else
 1631|      2|    OPENSSL_INIT_LOAD_CONFIG |
 1632|      2|#endif
 1633|      2|    0;
 1634|      2|  OPENSSL_init_ssl(flags, NULL);
 1635|       |
 1636|      2|#ifndef HAVE_KEYLOG_UPSTREAM
 1637|      2|  Curl_tls_keylog_open();
 1638|      2|#endif
 1639|       |
 1640|      2|  return 1;
 1641|      2|}
openssl.c:ossl_random:
 5481|      4|{
 5482|      4|  int rc;
 5483|      4|  if(data) {
  ------------------
  |  Branch (5483:6): [True: 0, False: 4]
  ------------------
 5484|      0|    if(ossl_seed(data)) /* Initiate the seed if not already done */
  ------------------
  |  Branch (5484:8): [True: 0, False: 0]
  ------------------
 5485|      0|      return CURLE_FAILED_INIT; /* could not seed for some reason */
 5486|      0|  }
 5487|      4|  else {
 5488|      4|    if(!rand_enough())
  ------------------
  |  Branch (5488:8): [True: 0, False: 4]
  ------------------
 5489|      0|      return CURLE_FAILED_INIT;
 5490|      4|  }
 5491|       |  /* RAND_bytes() returns 1 on success, 0 otherwise. */
 5492|      4|  rc = RAND_bytes(entropy, (ossl_valsize_t)curlx_uztosi(length));
 5493|      4|  return rc == 1 ? CURLE_OK : CURLE_FAILED_INIT;
  ------------------
  |  Branch (5493:10): [True: 4, False: 0]
  ------------------
 5494|      4|}
openssl.c:ossl_close_all:
 1985|    812|{
 1986|       |#ifdef USE_OPENSSL_ENGINE
 1987|       |  if(data->state.engine) {
 1988|       |    ENGINE_finish(data->state.engine);
 1989|       |    ENGINE_free(data->state.engine);
 1990|       |    data->state.engine = NULL;
 1991|       |  }
 1992|       |#else
 1993|    812|  (void)data;
 1994|    812|#endif
 1995|    812|#ifdef OPENSSL_HAS_PROVIDERS
 1996|    812|  ossl_provider_cleanup(data);
 1997|    812|#endif
 1998|    812|}

Curl_ssl_init:
  152|      2|{
  153|       |  /* make sure this is only done once */
  154|      2|  if(init_ssl)
  ------------------
  |  Branch (154:6): [True: 0, False: 2]
  ------------------
  155|      0|    return 1;
  156|      2|  init_ssl = TRUE; /* never again */
  ------------------
  |  | 1016|      2|#define TRUE true
  ------------------
  157|       |
  158|      2|  if(Curl_ssl->init)
  ------------------
  |  Branch (158:6): [True: 2, False: 0]
  ------------------
  159|      2|    return Curl_ssl->init();
  160|      0|  return 1;
  161|      2|}
Curl_ssl_close_all:
  228|    812|{
  229|    812|  if(Curl_ssl->close_all)
  ------------------
  |  Branch (229:6): [True: 812, False: 0]
  ------------------
  230|    812|    Curl_ssl->close_all(data);
  231|    812|}
Curl_ssl_free_certinfo:
  297|  1.62k|{
  298|  1.62k|  struct curl_certinfo *ci = &data->info.certs;
  299|       |
  300|  1.62k|  if(ci->num_of_certs) {
  ------------------
  |  Branch (300:6): [True: 0, False: 1.62k]
  ------------------
  301|       |    /* free all individual lists used */
  302|      0|    int i;
  303|      0|    for(i = 0; i < ci->num_of_certs; i++) {
  ------------------
  |  Branch (303:16): [True: 0, False: 0]
  ------------------
  304|      0|      curl_slist_free_all(ci->certinfo[i]);
  305|      0|      ci->certinfo[i] = NULL;
  306|      0|    }
  307|       |
  308|       |    curlx_safefree(ci->certinfo); /* free the actual array too */
  ------------------
  |  | 1303|      0|  do {                      \
  |  | 1304|      0|    curlx_free(ptr);        \
  |  |  ------------------
  |  |  |  | 1447|      0|#define curlx_free(ptr)            curl_dbg_free(ptr, __LINE__, __FILE__)
  |  |  ------------------
  |  | 1305|      0|    (ptr) = NULL;           \
  |  | 1306|      0|  } while(0)
  |  |  ------------------
  |  |  |  Branch (1306:11): [Folded, False: 0]
  |  |  ------------------
  ------------------
  309|      0|    ci->num_of_certs = 0;
  310|      0|  }
  311|  1.62k|}
Curl_ssl_random:
  369|      4|{
  370|      4|  DEBUGASSERT(length == sizeof(int));
  ------------------
  |  | 1046|      4|#define DEBUGASSERT(x) assert(x)
  ------------------
  |  Branch (370:3): [True: 0, False: 4]
  |  Branch (370:3): [True: 4, False: 0]
  ------------------
  371|      4|  if(Curl_ssl->random)
  ------------------
  |  Branch (371:6): [True: 4, False: 0]
  ------------------
  372|      4|    return Curl_ssl->random(data, buffer, length);
  373|      0|  else
  374|      0|    return CURLE_NOT_BUILT_IN;
  375|      4|}

Curl_ssl_config_init:
  101|  1.62k|{
  102|       |  /*
  103|       |   * libcurl 7.10 introduced SSL verification *by default*! This needs to be
  104|       |   * switched off unless wanted.
  105|       |   */
  106|  1.62k|  sslc->verifypeer = TRUE;
  ------------------
  |  | 1016|  1.62k|#define TRUE true
  ------------------
  107|  1.62k|  sslc->verifyhost = TRUE;
  ------------------
  |  | 1016|  1.62k|#define TRUE true
  ------------------
  108|       |  sslc->cache_session = TRUE; /* caching by default */
  ------------------
  |  | 1016|  1.62k|#define TRUE true
  ------------------
  109|  1.62k|}

LLVMFuzzerTestOneInput:
   73|    821|                                      std::size_t size) {
   74|    821|  if (size == 0 || !WriteNetrcInput(data + 1, size - 1) ||
  ------------------
  |  Branch (74:7): [True: 0, False: 821]
  |  Branch (74:20): [True: 9, False: 812]
  ------------------
   75|    812|      kInputFile.path() == nullptr) {
  ------------------
  |  Branch (75:7): [True: 0, False: 812]
  ------------------
   76|      9|    return 0;
   77|      9|  }
   78|       |
   79|    812|  ProbeErrorStringsOnce();
   80|       |
   81|    812|  CURL *easy = curl_easy_init();
   82|    812|  if (easy == nullptr) {
  ------------------
  |  Branch (82:7): [True: 0, False: 812]
  ------------------
   83|      0|    return 0;
   84|      0|  }
   85|       |
   86|       |  // Use curl's real private type so layout/API changes fail at compile time.
   87|    812|  struct store_netrc store;
   88|    812|  struct Curl_creds *creds = nullptr;
   89|    812|  Curl_netrc_init(&store);
   90|       |
   91|    812|  const char *hostname = (data[0] & 1U) != 0 ? "other.test" : "fuzz.test";
  ------------------
  |  Branch (91:26): [True: 298, False: 514]
  ------------------
   92|    812|  const char *user = (data[0] & 2U) != 0 ? "fuzz-user" : nullptr;
  ------------------
  |  Branch (92:22): [True: 344, False: 468]
  ------------------
   93|    812|  const NETRCcode result =
   94|    812|      Curl_netrc_scan(reinterpret_cast<struct Curl_easy *>(easy), &store,
   95|    812|                      hostname, user, kInputFile.path(), &creds);
   96|    812|  (void)Curl_netrc_strerror(result);
   97|       |
   98|    812|  Curl_creds_unlink(&creds);
   99|    812|  Curl_netrc_cleanup(&store);
  100|    812|  curl_easy_cleanup(easy);
  101|    812|  return 0;
  102|    812|}
fuzz_netrc.cc:_ZN12_GLOBAL__N_113CurlBootstrapC2Ev:
   32|      2|  CurlBootstrap() { (void)curl_global_init(CURL_GLOBAL_ALL); }
  ------------------
  |  | 3047|      2|#define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL | CURL_GLOBAL_WINSOCK)
  |  |  ------------------
  |  |  |  | 3044|      2|#define CURL_GLOBAL_SSL (1 << 0) /* no purpose since 7.57.0 */
  |  |  ------------------
  |  |               #define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL | CURL_GLOBAL_WINSOCK)
  |  |  ------------------
  |  |  |  | 3045|      2|#define CURL_GLOBAL_WINSOCK (1 << 1)
  |  |  ------------------
  ------------------
fuzz_netrc.cc:_ZN12_GLOBAL__N_115WriteNetrcInputEPKhm:
   46|    821|bool WriteNetrcInput(const std::uint8_t *data, std::size_t size) {
   47|    821|  if (size > kMaxNetrcBytes) {
  ------------------
  |  Branch (47:7): [True: 9, False: 812]
  ------------------
   48|      9|    return false;
   49|      9|  }
   50|       |
   51|    812|  std::string file_contents(1, '\n');
   52|    812|  if (size != 0) {
  ------------------
  |  Branch (52:7): [True: 809, False: 3]
  ------------------
   53|    809|    file_contents.append(reinterpret_cast<const char *>(data), size);
   54|    809|  }
   55|    812|  return kInputFile.Write(
   56|    812|      reinterpret_cast<const std::uint8_t *>(file_contents.data()),
   57|    812|      file_contents.size());
   58|    821|}
fuzz_netrc.cc:_ZN12_GLOBAL__N_121ProbeErrorStringsOnceEv:
   60|    812|void ProbeErrorStringsOnce() {
   61|    812|  static const bool probed = [] {
   62|    812|    for (int value = 0; value < static_cast<int>(NETRC_LAST); ++value) {
   63|    812|      (void)Curl_netrc_strerror(static_cast<NETRCcode>(value));
   64|    812|    }
   65|    812|    return true;
   66|    812|  }();
   67|    812|  (void)probed;
   68|    812|}
fuzz_netrc.cc:_ZZN12_GLOBAL__N_121ProbeErrorStringsOnceEvENK3$_0clEv:
   61|      1|  static const bool probed = [] {
   62|      6|    for (int value = 0; value < static_cast<int>(NETRC_LAST); ++value) {
  ------------------
  |  Branch (62:25): [True: 5, False: 1]
  ------------------
   63|      5|      (void)Curl_netrc_strerror(static_cast<NETRCcode>(value));
   64|      5|    }
   65|      1|    return true;
   66|      1|  }();

_ZN12proto_fuzzer25BoundedAnonymousInputFileC2Em:
   24|      2|    : max_bytes_(max_bytes), file_(nullptr), ready_(false) {}
_ZN12proto_fuzzer25BoundedAnonymousInputFile10EnsureOpenEv:
   35|    812|bool BoundedAnonymousInputFile::EnsureOpen() {
   36|    812|  if (file_ != nullptr) {
  ------------------
  |  Branch (36:7): [True: 811, False: 1]
  ------------------
   37|    811|    return true;
   38|    811|  }
   39|       |
   40|      1|  file_ = std::tmpfile();
   41|      1|  if (file_ == nullptr) {
  ------------------
  |  Branch (41:7): [True: 0, False: 1]
  ------------------
   42|      0|    return false;
   43|      0|  }
   44|      1|  const int fd = fileno(file_);
   45|      1|  if (fd < 0) {
  ------------------
  |  Branch (45:7): [True: 0, False: 1]
  ------------------
   46|      0|    std::fclose(file_);
   47|      0|    file_ = nullptr;
   48|      0|    return false;
   49|      0|  }
   50|      1|  path_ = "/proc/self/fd/" + std::to_string(fd);
   51|      1|  return true;
   52|      1|}
_ZN12proto_fuzzer25BoundedAnonymousInputFile5WriteEPKhm:
   60|    812|bool BoundedAnonymousInputFile::Write(const std::uint8_t* data, std::size_t size) {
   61|    812|  ready_ = false;
   62|    812|  if (size > max_bytes_ || (data == nullptr && size != 0) || !EnsureOpen()) {
  ------------------
  |  Branch (62:7): [True: 0, False: 812]
  |  Branch (62:29): [True: 0, False: 812]
  |  Branch (62:48): [True: 0, False: 0]
  |  Branch (62:62): [True: 0, False: 812]
  ------------------
   63|      0|    return false;
   64|      0|  }
   65|       |
   66|    812|  const int fd = fileno(file_);
   67|    812|  if (fd < 0 || ftruncate(fd, 0) != 0) {
  ------------------
  |  Branch (67:7): [True: 0, False: 812]
  |  Branch (67:17): [True: 0, False: 812]
  ------------------
   68|      0|    return false;
   69|      0|  }
   70|       |
   71|    812|  std::size_t offset = 0;
   72|  1.62k|  while (offset < size) {
  ------------------
  |  Branch (72:10): [True: 812, False: 812]
  ------------------
   73|    812|    const ssize_t written = pwrite(fd, data + offset, size - offset, static_cast<off_t>(offset));
   74|    812|    if (written < 0 && errno == EINTR) {
  ------------------
  |  Branch (74:9): [True: 0, False: 812]
  |  Branch (74:24): [True: 0, False: 0]
  ------------------
   75|      0|      continue;
   76|      0|    }
   77|    812|    if (written <= 0) {
  ------------------
  |  Branch (77:9): [True: 0, False: 812]
  ------------------
   78|      0|      return false;
   79|      0|    }
   80|    812|    offset += static_cast<std::size_t>(written);
   81|    812|  }
   82|       |
   83|    812|  ready_ = true;
   84|    812|  return true;
   85|    812|}
_ZNK12proto_fuzzer25BoundedAnonymousInputFile4pathEv:
   89|  1.62k|const char* BoundedAnonymousInputFile::path() const { return ready_ ? path_.c_str() : nullptr; }
  ------------------
  |  Branch (89:62): [True: 1.62k, False: 0]
  ------------------

