LLVMFuzzerTestOneInput:
   24|  1.68k|{
   25|  1.68k|	pb_tnc_batch_t *batch;
   26|  1.68k|	pb_tnc_state_machine_t *state;
   27|  1.68k|	pb_tnc_msg_t *msg;
   28|  1.68k|	pb_error_msg_t *error;
   29|  1.68k|	enumerator_t *enumerator;
   30|  1.68k|	bool from_server;
   31|  1.68k|	chunk_t chunk;
   32|       |
   33|  1.68k|	dbg_default_set_level(-1);
   34|  1.68k|	library_init(NULL, "fuzz_pb_tnc");
   35|       |
   36|  1.68k|	chunk = chunk_create((u_char*)buf, len);
   37|       |
   38|  1.68k|	INIT(state,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
   39|  1.68k|		.receive_batch = (void*)return_true,
   40|  1.68k|		.set_empty_cdata = (void*)nop,
   41|  1.68k|	);
   42|       |
   43|       |	/* parse incoming PB-TNC batch */
   44|  1.68k|	batch = pb_tnc_batch_create_from_data(chunk);
   45|  1.68k|	if (batch->process_header(batch, TRUE, FALSE, &from_server) == SUCCESS ||
  ------------------
  |  |   44|  1.68k|# define TRUE  true
  ------------------
              	if (batch->process_header(batch, TRUE, FALSE, &from_server) == SUCCESS ||
  ------------------
  |  |   41|  1.68k|# define FALSE false
  ------------------
  |  Branch (45:6): [True: 498, False: 1.18k]
  ------------------
   46|  1.18k|		batch->process_header(batch, TRUE, TRUE, &from_server) == SUCCESS)
  ------------------
  |  |   44|  1.18k|# define TRUE  true
  ------------------
              		batch->process_header(batch, TRUE, TRUE, &from_server) == SUCCESS)
  ------------------
  |  |   44|  1.18k|# define TRUE  true
  ------------------
  |  Branch (46:3): [True: 1.07k, False: 111]
  ------------------
   47|  1.57k|	{
   48|  1.57k|		batch->process(batch, state);
   49|  1.57k|	}
   50|       |
   51|       |	/* enumerate correctly decoded PB-TNC messages */
   52|  1.68k|	enumerator = batch->create_msg_enumerator(batch);
   53|  90.8k|	while (enumerator->enumerate(enumerator, &msg))
  ------------------
  |  Branch (53:9): [True: 89.1k, False: 1.68k]
  ------------------
   54|  89.1k|	{
   55|  89.1k|		msg->get_type(msg);
   56|  89.1k|	}
   57|  1.68k|	enumerator->destroy(enumerator);
   58|       |
   59|       |	/* enumerate errors detected while parsing PB-TNC batch and messages */
   60|  1.68k|	enumerator = batch->create_error_enumerator(batch);
   61|  4.07k|	while (enumerator->enumerate(enumerator, &msg))
  ------------------
  |  Branch (61:9): [True: 2.39k, False: 1.68k]
  ------------------
   62|  2.39k|	{
   63|  2.39k|		error = (pb_error_msg_t*)msg;
   64|  2.39k|		error->get_error_code(error);
   65|  2.39k|	}
   66|  1.68k|	enumerator->destroy(enumerator);
   67|       |
   68|  1.68k|	batch->destroy(batch);
   69|       |
   70|  1.68k|	free(state);
   71|  1.68k|	library_deinit();
   72|  1.68k|	return 0;
   73|  1.68k|}

bio_reader_create:
  320|   195k|{
  321|   195k|	private_bio_reader_t *this;
  322|       |
  323|   195k|	INIT(this,
  ------------------
  |  |   44|   195k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|   195k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  324|   195k|		.public = {
  325|   195k|			.remaining = _remaining,
  326|   195k|			.peek = _peek,
  327|   195k|			.read_uint8 = _read_uint8,
  328|   195k|			.read_uint16 = _read_uint16,
  329|   195k|			.read_uint24 = _read_uint24,
  330|   195k|			.read_uint32 = _read_uint32,
  331|   195k|			.read_uint64 = _read_uint64,
  332|   195k|			.read_data = _read_data,
  333|   195k|			.read_uint8_end = _read_uint8_end,
  334|   195k|			.read_uint16_end = _read_uint16_end,
  335|   195k|			.read_uint24_end = _read_uint24_end,
  336|   195k|			.read_uint32_end = _read_uint32_end,
  337|   195k|			.read_uint64_end = _read_uint64_end,
  338|   195k|			.read_data_end = _read_data_end,
  339|   195k|			.read_data8 = _read_data8,
  340|   195k|			.read_data16 = _read_data16,
  341|   195k|			.read_data24 = _read_data24,
  342|   195k|			.read_data32 = _read_data32,
  343|   195k|			.destroy = _destroy,
  344|   195k|		},
  345|   195k|		.buf = data,
  346|   195k|	);
  347|       |
  348|   195k|	return &this->public;
  349|   195k|}
bio_reader.c:remaining:
   47|  44.3k|{
   48|  44.3k|	return this->buf.len;
   49|  44.3k|}
bio_reader.c:read_uint8:
  191|   206k|{
  192|       |	return read_uint8_internal(this, res, FALSE);
  ------------------
  |  |   41|   206k|# define FALSE false
  ------------------
  193|   206k|}
bio_reader.c:read_uint8_internal:
   89|   206k|{
   90|   206k|	if (this->buf.len < 1)
  ------------------
  |  Branch (90:6): [True: 14, False: 206k]
  ------------------
   91|     14|	{
   92|     14|		DBG1(DBG_LIB, "%d bytes insufficient to parse u_int8 data",
  ------------------
  |  |  133|     14|# define DBG1(...) {}
  ------------------
   93|     14|			 this->buf.len);
   94|     14|		return FALSE;
  ------------------
  |  |   41|     14|# define FALSE false
  ------------------
   95|     14|	}
   96|   206k|	*res = *get_ptr_end(this, 1, from_end);
   97|   206k|	this->buf = chunk_skip_end(this->buf, 1, from_end);
   98|       |	return TRUE;
  ------------------
  |  |   44|   206k|# define TRUE  true
  ------------------
   99|   206k|}
bio_reader.c:get_ptr_end:
   80|   788k|{
   81|   788k|	return from_end ? this->buf.ptr + (this->buf.len - len) : this->buf.ptr;
  ------------------
  |  Branch (81:9): [True: 0, False: 788k]
  ------------------
   82|   788k|}
bio_reader.c:chunk_skip_end:
   62|   788k|{
   63|   788k|	if (chunk.len > bytes)
  ------------------
  |  Branch (63:6): [True: 710k, False: 77.9k]
  ------------------
   64|   710k|	{
   65|   710k|		if (!from_end)
  ------------------
  |  Branch (65:7): [True: 710k, False: 0]
  ------------------
   66|   710k|		{
   67|   710k|			chunk.ptr += bytes;
   68|   710k|		}
   69|   710k|		chunk.len -= bytes;
   70|   710k|		return chunk;
   71|   710k|	}
   72|  77.9k|	return chunk_empty;
   73|   788k|}
bio_reader.c:read_uint16:
  197|  27.5k|{
  198|       |	return read_uint16_internal(this, res, FALSE);
  ------------------
  |  |   41|  27.5k|# define FALSE false
  ------------------
  199|  27.5k|}
bio_reader.c:read_uint16_internal:
  106|  27.5k|{
  107|  27.5k|	if (this->buf.len < 2)
  ------------------
  |  Branch (107:6): [True: 0, False: 27.5k]
  ------------------
  108|      0|	{
  109|      0|		DBG1(DBG_LIB, "%d bytes insufficient to parse u_int16 data",
  ------------------
  |  |  133|      0|# define DBG1(...) {}
  ------------------
  110|      0|			 this->buf.len);
  111|      0|		return FALSE;
  ------------------
  |  |   41|      0|# define FALSE false
  ------------------
  112|      0|	}
  113|  27.5k|	*res = untoh16(get_ptr_end(this, 2, from_end));
  114|  27.5k|	this->buf = chunk_skip_end(this->buf, 2, from_end);
  115|       |	return TRUE;
  ------------------
  |  |   44|  27.5k|# define TRUE  true
  ------------------
  116|  27.5k|}
bio_reader.c:read_uint24:
  203|   185k|{
  204|       |	return read_uint24_internal(this, res, FALSE);
  ------------------
  |  |   41|   185k|# define FALSE false
  ------------------
  205|   185k|}
bio_reader.c:read_uint24_internal:
  123|   185k|{
  124|   185k|	uint32_t tmp;
  125|       |
  126|   185k|	if (this->buf.len < 3)
  ------------------
  |  Branch (126:6): [True: 0, False: 185k]
  ------------------
  127|      0|	{
  128|      0|		DBG1(DBG_LIB, "%d bytes insufficient to parse u_int24 data",
  ------------------
  |  |  133|      0|# define DBG1(...) {}
  ------------------
  129|      0|			 this->buf.len);
  130|      0|		return FALSE;
  ------------------
  |  |   41|      0|# define FALSE false
  ------------------
  131|      0|	}
  132|   185k|	memcpy(&tmp, get_ptr_end(this, 3, from_end), 3);
  ------------------
  |  |   55|   185k|#define memcpy(d,s,n) memcpy_noop(d,s,n)
  ------------------
  133|   185k|	*res = ntohl(tmp) >> 8;
  134|   185k|	this->buf = chunk_skip_end(this->buf, 3, from_end);
  135|       |	return TRUE;
  ------------------
  |  |   44|   185k|# define TRUE  true
  ------------------
  136|   185k|}
bio_reader.c:read_uint32:
  209|   323k|{
  210|       |	return read_uint32_internal(this, res, FALSE);
  ------------------
  |  |   41|   323k|# define FALSE false
  ------------------
  211|   323k|}
bio_reader.c:read_uint32_internal:
  143|   323k|{
  144|   323k|	if (this->buf.len < 4)
  ------------------
  |  Branch (144:6): [True: 3, False: 323k]
  ------------------
  145|      3|	{
  146|      3|		DBG1(DBG_LIB, "%d bytes insufficient to parse u_int32 data",
  ------------------
  |  |  133|      3|# define DBG1(...) {}
  ------------------
  147|      3|			 this->buf.len);
  148|      3|		return FALSE;
  ------------------
  |  |   41|      3|# define FALSE false
  ------------------
  149|      3|	}
  150|   323k|	*res = untoh32(get_ptr_end(this, 4, from_end));
  151|   323k|	this->buf = chunk_skip_end(this->buf, 4, from_end);
  152|       |	return TRUE;
  ------------------
  |  |   44|   323k|# define TRUE  true
  ------------------
  153|   323k|}
bio_reader.c:read_data:
  221|  45.9k|{
  222|       |	return read_data_internal(this, len, res, FALSE);
  ------------------
  |  |   41|  45.9k|# define FALSE false
  ------------------
  223|  45.9k|}
bio_reader.c:read_data_internal:
  177|  45.9k|{
  178|  45.9k|	if (this->buf.len < len)
  ------------------
  |  Branch (178:6): [True: 70, False: 45.9k]
  ------------------
  179|     70|	{
  180|     70|		DBG1(DBG_LIB, "%d bytes insufficient to parse %d bytes of data",
  ------------------
  |  |  133|     70|# define DBG1(...) {}
  ------------------
  181|     70|			 this->buf.len, len);
  182|     70|		return FALSE;
  ------------------
  |  |   41|     70|# define FALSE false
  ------------------
  183|     70|	}
  184|  45.9k|	*res = chunk_create(get_ptr_end(this, len, from_end), len);
  185|  45.9k|	this->buf = chunk_skip_end(this->buf, len, from_end);
  186|       |	return TRUE;
  ------------------
  |  |   44|  45.9k|# define TRUE  true
  ------------------
  187|  45.9k|}
bio_reader.c:read_data8:
  263|  4.98k|{
  264|  4.98k|	uint8_t len;
  265|       |
  266|  4.98k|	if (!read_uint8(this, &len))
  ------------------
  |  Branch (266:6): [True: 14, False: 4.96k]
  ------------------
  267|     14|	{
  268|     14|		return FALSE;
  ------------------
  |  |   41|     14|# define FALSE false
  ------------------
  269|     14|	}
  270|  4.96k|	return read_data(this, len, res);
  271|  4.98k|}
bio_reader.c:read_data32:
  299|  5.04k|{
  300|  5.04k|	uint32_t len;
  301|       |
  302|  5.04k|	if (!read_uint32(this, &len))
  ------------------
  |  Branch (302:6): [True: 3, False: 5.04k]
  ------------------
  303|      3|	{
  304|      3|		return FALSE;
  ------------------
  |  |   41|      3|# define FALSE false
  ------------------
  305|      3|	}
  306|  5.04k|	return read_data(this, len, res);
  307|  5.04k|}
bio_reader.c:destroy:
  311|   195k|{
  312|   195k|	free(this->cleanup.ptr);
  313|   195k|	free(this);
  314|   195k|}

bio_writer_create:
  224|  1.68k|{
  225|  1.68k|	private_bio_writer_t *this;
  226|       |
  227|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  3.37k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  |  |  ------------------
  |  |  |  Branch (45:39): [True: 0, False: 0]
  |  |  |  Branch (45:39): [True: 0, False: 1.68k]
  |  |  ------------------
  ------------------
  228|  1.68k|		.public = {
  229|  1.68k|			.write_uint8 = _write_uint8,
  230|  1.68k|			.write_uint16 = _write_uint16,
  231|  1.68k|			.write_uint24 = _write_uint24,
  232|  1.68k|			.write_uint32 = _write_uint32,
  233|  1.68k|			.write_uint64 = _write_uint64,
  234|  1.68k|			.write_data = _write_data,
  235|  1.68k|			.write_data8 = _write_data8,
  236|  1.68k|			.write_data16 = _write_data16,
  237|  1.68k|			.write_data24 = _write_data24,
  238|  1.68k|			.write_data32 = _write_data32,
  239|  1.68k|			.wrap8 = _wrap8,
  240|  1.68k|			.wrap16 = _wrap16,
  241|  1.68k|			.wrap24 = _wrap24,
  242|  1.68k|			.wrap32 = _wrap32,
  243|  1.68k|			.skip = _skip,
  244|  1.68k|			.get_buf = _get_buf,
  245|  1.68k|			.extract_buf = _extract_buf,
  246|  1.68k|			.destroy = _destroy,
  247|  1.68k|		},
  248|  1.68k|		.increase = bufsize ? max(bufsize, 4) : 32,
  249|  1.68k|	);
  250|  1.68k|	if (bufsize)
  ------------------
  |  Branch (250:6): [True: 0, False: 1.68k]
  ------------------
  251|      0|	{
  252|      0|		this->buf = chunk_alloc(bufsize);
  ------------------
  |  |  268|      0|#define chunk_alloc(bytes) ({size_t x = (bytes); chunk_create(x ? malloc(x) : NULL, x);})
  |  |  ------------------
  |  |  |  Branch (268:63): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  253|      0|	}
  254|       |
  255|  1.68k|	return &this->public;
  256|  1.68k|}
bio_writer.c:destroy:
  215|  1.68k|{
  216|  1.68k|	free(this->buf.ptr);
  217|  1.68k|	free(this);
  218|  1.68k|}

array_create:
  161|  16.8k|{
  162|  16.8k|	array_t *array;
  163|       |
  164|  16.8k|	INIT(array,
  ------------------
  |  |   44|  16.8k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  16.8k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  165|  16.8k|		.esize = esize,
  166|  16.8k|		.tail = reserve,
  167|  16.8k|	);
  168|  16.8k|	if (array->tail)
  ------------------
  |  Branch (168:6): [True: 0, False: 16.8k]
  ------------------
  169|      0|	{
  170|      0|		array->data = malloc(get_size(array, array->tail));
  171|      0|	}
  172|  16.8k|	return array;
  173|  16.8k|}
array_count:
  176|   133k|{
  177|   133k|	if (array)
  ------------------
  |  Branch (177:6): [True: 107k, False: 25.2k]
  ------------------
  178|   107k|	{
  179|   107k|		return array->count;
  180|   107k|	}
  181|  25.2k|	return 0;
  182|   133k|}
array_create_enumerator:
  254|  3.37k|{
  255|  3.37k|	array_enumerator_t *enumerator;
  256|       |
  257|  3.37k|	if (!array)
  ------------------
  |  Branch (257:6): [True: 3.37k, False: 0]
  ------------------
  258|  3.37k|	{
  259|  3.37k|		return enumerator_create_empty();
  260|  3.37k|	}
  261|       |
  262|  3.37k|	INIT(enumerator,
  ------------------
  |  |   44|  3.37k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|      0|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  263|      0|		.public = {
  264|      0|			.enumerate = enumerator_enumerate_default,
  265|      0|			.venumerate = _enumerate,
  266|      0|			.destroy = (void*)free,
  267|      0|		},
  268|      0|		.array = array,
  269|      0|	);
  270|      0|	return &enumerator->public;
  271|  3.37k|}
array_insert_create:
  284|  13.4k|{
  285|  13.4k|	if (*array == NULL)
  ------------------
  |  Branch (285:6): [True: 13.4k, False: 0]
  ------------------
  286|  13.4k|	{
  287|  13.4k|		*array = array_create(0, 0);
  288|  13.4k|	}
  289|  13.4k|	array_insert(*array, idx, ptr);
  290|  13.4k|}
array_insert:
  314|  15.1k|{
  315|  15.1k|	if (idx < 0 || idx <= array_count(array))
  ------------------
  |  Branch (315:6): [True: 13.4k, False: 1.68k]
  |  Branch (315:17): [True: 1.68k, False: 0]
  ------------------
  316|  15.1k|	{
  317|  15.1k|		void *pos;
  318|       |
  319|  15.1k|		if (idx < 0)
  ------------------
  |  Branch (319:7): [True: 13.4k, False: 1.68k]
  ------------------
  320|  13.4k|		{
  321|  13.4k|			idx = array_count(array);
  322|  13.4k|		}
  323|       |
  324|  15.1k|		if (array->head && !array->tail)
  ------------------
  |  Branch (324:7): [True: 0, False: 15.1k]
  |  Branch (324:22): [True: 0, False: 0]
  ------------------
  325|      0|		{
  326|      0|			insert_head(array, idx);
  327|      0|		}
  328|  15.1k|		else if (array->tail && !array->head)
  ------------------
  |  Branch (328:12): [True: 0, False: 15.1k]
  |  Branch (328:27): [True: 0, False: 0]
  ------------------
  329|      0|		{
  330|      0|			insert_tail(array, idx);
  331|      0|		}
  332|  15.1k|		else if (idx > array_count(array) / 2)
  ------------------
  |  Branch (332:12): [True: 0, False: 15.1k]
  ------------------
  333|      0|		{
  334|      0|			insert_tail(array, idx);
  335|      0|		}
  336|  15.1k|		else
  337|  15.1k|		{
  338|  15.1k|			insert_head(array, idx);
  339|  15.1k|		}
  340|       |
  341|  15.1k|		pos = array->data + get_size(array, array->head + idx);
  342|  15.1k|		if (array->esize)
  ------------------
  |  Branch (342:7): [True: 0, False: 15.1k]
  ------------------
  343|      0|		{
  344|      0|			memcpy(pos, data, get_size(array, 1));
  ------------------
  |  |   55|      0|#define memcpy(d,s,n) memcpy_noop(d,s,n)
  ------------------
  345|      0|		}
  346|  15.1k|		else
  347|  15.1k|		{
  348|       |			/* pointer based array, copy pointer value */
  349|  15.1k|			*(void**)pos = data;
  350|  15.1k|		}
  351|  15.1k|	}
  352|  15.1k|}
array_get:
  355|  33.7k|{
  356|  33.7k|	if (!array)
  ------------------
  |  Branch (356:6): [True: 6.74k, False: 26.9k]
  ------------------
  357|  6.74k|	{
  358|  6.74k|		return FALSE;
  ------------------
  |  |   41|  6.74k|# define FALSE false
  ------------------
  359|  6.74k|	}
  360|  26.9k|	if (idx >= 0 && idx >= array_count(array))
  ------------------
  |  Branch (360:6): [True: 23.6k, False: 3.37k]
  |  Branch (360:18): [True: 0, False: 23.6k]
  ------------------
  361|      0|	{
  362|      0|		return FALSE;
  ------------------
  |  |   41|      0|# define FALSE false
  ------------------
  363|      0|	}
  364|  26.9k|	if (idx < 0)
  ------------------
  |  Branch (364:6): [True: 3.37k, False: 23.6k]
  ------------------
  365|  3.37k|	{
  366|  3.37k|		if (array_count(array) == 0)
  ------------------
  |  Branch (366:7): [True: 0, False: 3.37k]
  ------------------
  367|      0|		{
  368|      0|			return FALSE;
  ------------------
  |  |   41|      0|# define FALSE false
  ------------------
  369|      0|		}
  370|  3.37k|		idx = array_count(array) - 1;
  371|  3.37k|	}
  372|  26.9k|	if (data)
  ------------------
  |  Branch (372:6): [True: 26.9k, False: 0]
  ------------------
  373|  26.9k|	{
  374|  26.9k|		memcpy(data, array->data + get_size(array, array->head + idx),
  ------------------
  |  |   55|  26.9k|#define memcpy(d,s,n) memcpy_noop(d,s,n)
  ------------------
  375|  26.9k|			   get_size(array, 1));
  376|  26.9k|	}
  377|       |	return TRUE;
  ------------------
  |  |   44|  26.9k|# define TRUE  true
  ------------------
  378|  26.9k|}
array_remove:
  381|  6.74k|{
  382|  6.74k|	if (!array_get(array, idx, data))
  ------------------
  |  Branch (382:6): [True: 6.74k, False: 0]
  ------------------
  383|  6.74k|	{
  384|  6.74k|		return FALSE;
  ------------------
  |  |   41|  6.74k|# define FALSE false
  ------------------
  385|  6.74k|	}
  386|      0|	if (idx < 0)
  ------------------
  |  Branch (386:6): [True: 0, False: 0]
  ------------------
  387|      0|	{
  388|      0|		idx = array_count(array) - 1;
  389|      0|	}
  390|      0|	if (idx > array_count(array) / 2)
  ------------------
  |  Branch (390:6): [True: 0, False: 0]
  ------------------
  391|      0|	{
  392|      0|		remove_tail(array, idx);
  393|      0|	}
  394|      0|	else
  395|      0|	{
  396|      0|		remove_head(array, idx);
  397|      0|	}
  398|      0|	if (array->head + array->tail > ARRAY_MAX_UNUSED)
  ------------------
  |  |   61|      0|#define ARRAY_MAX_UNUSED 32
  ------------------
  |  Branch (398:6): [True: 0, False: 0]
  ------------------
  399|      0|	{
  400|      0|		array_compress(array);
  401|      0|	}
  402|       |	return TRUE;
  ------------------
  |  |   44|      0|# define TRUE  true
  ------------------
  403|  6.74k|}
array_sort:
  437|  1.68k|{
  438|  1.68k|	if (array)
  ------------------
  |  Branch (438:6): [True: 1.68k, False: 0]
  ------------------
  439|  1.68k|	{
  440|  1.68k|		sort_data_t data = {
  441|  1.68k|			.array = array,
  442|  1.68k|			.cmp = cmp,
  443|  1.68k|			.arg = user,
  444|  1.68k|		};
  445|  1.68k|		void *start;
  446|       |
  447|  1.68k|		start = array->data + get_size(array, array->head);
  448|       |
  449|  1.68k|#ifdef HAVE_QSORT_R_GNU
  450|  1.68k|		qsort_r(start, array->count, get_size(array, 1), compare_elements,
  451|  1.68k|				&data);
  452|       |#elif defined(HAVE_QSORT_R_BSD)
  453|       |		qsort_r(start, array->count, get_size(array, 1), &data,
  454|       |				compare_elements);
  455|       |#else /* !HAVE_QSORT_R */
  456|       |		sort_data_t *recursive;
  457|       |
  458|       |		recursive = sort_data->get(sort_data);
  459|       |		sort_data->set(sort_data, &data);
  460|       |		qsort(start, array->count, get_size(array, 1), compare_elements);
  461|       |		sort_data->set(sort_data, recursive);
  462|       |#endif
  463|  1.68k|	}
  464|  1.68k|}
array_bsearch:
  488|  74.1k|{
  489|  74.1k|	int idx = -1;
  490|       |
  491|  74.1k|	if (array)
  ------------------
  |  Branch (491:6): [True: 47.2k, False: 26.9k]
  ------------------
  492|  47.2k|	{
  493|  47.2k|		bsearch_data_t data = {
  494|  47.2k|			.array = array,
  495|  47.2k|			.key = key,
  496|  47.2k|			.cmp = cmp,
  497|  47.2k|		};
  498|  47.2k|		void *start, *item;
  499|       |
  500|  47.2k|		start = array->data + get_size(array, array->head);
  501|       |
  502|  47.2k|		item = bsearch(&data, start, array->count, get_size(array, 1),
  503|  47.2k|					   search_elements);
  504|  47.2k|		if (item)
  ------------------
  |  Branch (504:7): [True: 23.6k, False: 23.6k]
  ------------------
  505|  23.6k|		{
  506|  23.6k|			if (out)
  ------------------
  |  Branch (506:8): [True: 23.6k, False: 0]
  ------------------
  507|  23.6k|			{
  508|  23.6k|				memcpy(out, item, get_size(array, 1));
  ------------------
  |  |   55|  23.6k|#define memcpy(d,s,n) memcpy_noop(d,s,n)
  ------------------
  509|  23.6k|			}
  510|  23.6k|			idx = (item - start) / get_size(array, 1);
  511|  23.6k|		}
  512|  47.2k|	}
  513|  74.1k|	return idx;
  514|  74.1k|}
array_invoke:
  517|  23.6k|{
  518|  23.6k|	if (array)
  ------------------
  |  Branch (518:6): [True: 6.74k, False: 16.8k]
  ------------------
  519|  6.74k|	{
  520|  6.74k|		void *obj;
  521|  6.74k|		int i;
  522|       |
  523|  11.8k|		for (i = array->head; i < array->count + array->head; i++)
  ------------------
  |  Branch (523:25): [True: 5.05k, False: 6.74k]
  ------------------
  524|  5.05k|		{
  525|  5.05k|			obj = array->data + get_size(array, i);
  526|  5.05k|			if (!array->esize)
  ------------------
  |  Branch (526:8): [True: 5.05k, False: 0]
  ------------------
  527|  5.05k|			{
  528|       |				/* dereference if we store store pointers */
  529|  5.05k|				obj = *(void**)obj;
  530|  5.05k|			}
  531|  5.05k|			cb(obj, i - array->head, user);
  532|  5.05k|		}
  533|  6.74k|	}
  534|  23.6k|}
array_destroy:
  559|  89.3k|{
  560|  89.3k|	if (array)
  ------------------
  |  Branch (560:6): [True: 16.8k, False: 72.4k]
  ------------------
  561|  16.8k|	{
  562|  16.8k|		free(array->data);
  563|  16.8k|		free(array);
  564|  16.8k|	}
  565|  89.3k|}
array_destroy_function:
  568|  23.6k|{
  569|  23.6k|	array_invoke(array, cb, user);
  570|  23.6k|	array_destroy(array);
  571|  23.6k|}
arrays_init:
  580|  1.68k|{
  581|       |#ifndef HAVE_QSORT_R
  582|       |	sort_data =  thread_value_create(NULL);
  583|       |#endif
  584|  1.68k|}
arrays_deinit:
  587|  1.68k|{
  588|       |#ifndef HAVE_QSORT_R
  589|       |	sort_data->destroy(sort_data);
  590|       |#endif
  591|  1.68k|}
array.c:get_size:
   67|   310k|{
   68|   310k|	if (array->esize)
  ------------------
  |  Branch (68:6): [True: 0, False: 310k]
  ------------------
   69|      0|	{
   70|      0|		return (size_t)array->esize * num;
   71|      0|	}
   72|   310k|	return sizeof(void*) * num;
   73|   310k|}
array.c:insert_head:
  124|  15.1k|{
  125|  15.1k|	make_head_room(array, 1);
  126|       |	/* move down all elements before idx by one */
  127|  15.1k|	memmove(array->data + get_size(array, array->head - 1),
  ------------------
  |  |   78|  15.1k|#define memmove(d,s,n) memmove_noop(d,s,n)
  ------------------
  128|  15.1k|			array->data + get_size(array, array->head),
  129|  15.1k|			get_size(array, idx));
  130|       |
  131|  15.1k|	array->head--;
  132|  15.1k|	array->count++;
  133|  15.1k|}
array.c:make_head_room:
   92|  15.1k|{
   93|  15.1k|	if (array->head < room)
  ------------------
  |  Branch (93:6): [True: 15.1k, False: 0]
  ------------------
   94|  15.1k|	{
   95|  15.1k|		uint8_t increase = room - array->head;
   96|       |
   97|  15.1k|		array->data = realloc(array->data,
   98|  15.1k|						get_size(array, array->count + array->tail + room));
   99|  15.1k|		memmove(array->data + get_size(array, increase), array->data,
  ------------------
  |  |   78|  15.1k|#define memmove(d,s,n) memmove_noop(d,s,n)
  ------------------
  100|  15.1k|				get_size(array, array->count + array->tail + array->head));
  101|  15.1k|		array->head = room;
  102|  15.1k|	}
  103|  15.1k|}
array.c:search_elements:
  476|  47.2k|{
  477|  47.2k|	bsearch_data_t *data = (bsearch_data_t*)a;
  478|       |
  479|  47.2k|	if (data->array->esize)
  ------------------
  |  Branch (479:6): [True: 0, False: 47.2k]
  ------------------
  480|      0|	{
  481|      0|		return data->cmp(data->key, b);
  482|      0|	}
  483|  47.2k|	return data->cmp(data->key, *(void**)b);
  484|  47.2k|}

enumerator_enumerate_default:
   41|   135k|{
   42|   135k|	va_list args;
   43|   135k|	bool result;
   44|       |
   45|   135k|	if (!enumerator->venumerate)
  ------------------
  |  Branch (45:6): [True: 0, False: 135k]
  ------------------
   46|      0|	{
   47|      0|		DBG1(DBG_LIB, "!!! ENUMERATE DEFAULT: venumerate() missing !!!");
  ------------------
  |  |  133|      0|# define DBG1(...) {}
  ------------------
   48|      0|		return FALSE;
  ------------------
  |  |   41|      0|# define FALSE false
  ------------------
   49|      0|	}
   50|   135k|	va_start(args, enumerator);
   51|   135k|	result = enumerator->venumerate(enumerator, args);
   52|       |	va_end(args);
   53|   135k|	return result;
   54|   135k|}
enumerator_create_empty:
   66|  3.37k|{
   67|  3.37k|	enumerator_t *this;
   68|       |
   69|  3.37k|	INIT(this,
  ------------------
  |  |   44|  3.37k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  3.37k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
   70|  3.37k|		.enumerate = enumerator_enumerate_default,
   71|  3.37k|		.venumerate = _enumerate_empty,
   72|  3.37k|		.destroy = (void*)free,
   73|  3.37k|	);
   74|  3.37k|	return this;
   75|  3.37k|}
enumerator_create_glob:
  247|  1.68k|{
  248|  1.68k|	glob_enum_t *this;
  249|  1.68k|	int status;
  250|       |
  251|  1.68k|	if (!pattern)
  ------------------
  |  Branch (251:6): [True: 0, False: 1.68k]
  ------------------
  252|      0|	{
  253|      0|		return enumerator_create_empty();
  254|      0|	}
  255|       |
  256|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  257|  1.68k|		.public = {
  258|  1.68k|			.enumerate = enumerator_enumerate_default,
  259|  1.68k|			.venumerate = _enumerate_glob_enum,
  260|  1.68k|			.destroy = _destroy_glob_enum,
  261|  1.68k|		},
  262|  1.68k|	);
  263|       |
  264|  1.68k|	status = glob(pattern, GLOB_ERR, NULL, &this->glob);
  265|  1.68k|	if (status == GLOB_NOMATCH)
  ------------------
  |  Branch (265:6): [True: 1.68k, False: 0]
  ------------------
  266|  1.68k|	{
  267|  1.68k|		DBG1(DBG_LIB, "no files found matching '%s'", pattern);
  ------------------
  |  |  133|  1.68k|# define DBG1(...) {}
  ------------------
  268|  1.68k|	}
  269|      0|	else if (status != 0)
  ------------------
  |  Branch (269:11): [True: 0, False: 0]
  ------------------
  270|      0|	{
  271|      0|		DBG1(DBG_LIB, "expanding file pattern '%s' failed: %s", pattern,
  ------------------
  |  |  133|      0|# define DBG1(...) {}
  ------------------
  272|      0|			 strerror(errno));
  273|      0|	}
  274|  1.68k|	return &this->public;
  275|  1.68k|}
enumerator.c:enumerate_empty:
   58|  3.37k|{
   59|       |	return FALSE;
  ------------------
  |  |   41|  3.37k|# define FALSE false
  ------------------
   60|  3.37k|}
enumerator.c:enumerate_glob_enum:
  218|  1.68k|{
  219|  1.68k|	struct stat *st;
  220|  1.68k|	char *match;
  221|  1.68k|	char **file;
  222|       |
  223|  1.68k|	VA_ARGS_VGET(args, file, st);
  ------------------
  |  |  189|  1.68k|#define VA_ARGS_VGET(list, ...) ({ \
  |  |  190|  1.68k|	va_list _va_args_get_ap; \
  |  |  191|  1.68k|	va_copy(_va_args_get_ap, list); \
  |  |  192|  1.68k|	_VA_ARGS_GET_ASGN(__VA_ARGS__) \
  |  |  ------------------
  |  |  |  |  196|  1.68k|#define _VA_ARGS_GET_ASGN(...) VA_ARGS_DISPATCH(_VA_ARGS_GET_ASGN, __VA_ARGS__)(__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  160|  1.68k|#define VA_ARGS_DISPATCH(func, ...) _VA_ARGS_DISPATCH(func, VA_ARGS_NUM(__VA_ARGS__))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  161|  1.68k|#define _VA_ARGS_DISPATCH(func, num) __VA_ARGS_DISPATCH(func, num)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  162|  1.68k|#define __VA_ARGS_DISPATCH(func, num) func ## num
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  198|  1.68k|#define _VA_ARGS_GET_ASGN2(v1,v2) __VA_ARGS_GET_ASGN(v1) __VA_ARGS_GET_ASGN(v2)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  205|  1.68k|#define __VA_ARGS_GET_ASGN(v) v = va_arg(_va_args_get_ap, typeof(v));
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define _VA_ARGS_GET_ASGN2(v1,v2) __VA_ARGS_GET_ASGN(v1) __VA_ARGS_GET_ASGN(v2)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  205|  1.68k|#define __VA_ARGS_GET_ASGN(v) v = va_arg(_va_args_get_ap, typeof(v));
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  193|  1.68k|	va_end(_va_args_get_ap); \
  |  |  194|  1.68k|})
  ------------------
  224|       |
  225|  1.68k|	if (this->pos >= this->glob.gl_pathc)
  ------------------
  |  Branch (225:6): [True: 1.68k, False: 0]
  ------------------
  226|  1.68k|	{
  227|  1.68k|		return FALSE;
  ------------------
  |  |   41|  1.68k|# define FALSE false
  ------------------
  228|  1.68k|	}
  229|      0|	match = this->glob.gl_pathv[this->pos++];
  230|      0|	if (file)
  ------------------
  |  Branch (230:6): [True: 0, False: 0]
  ------------------
  231|      0|	{
  232|      0|		*file = match;
  233|      0|	}
  234|      0|	if (st && stat(match, st))
  ------------------
  |  Branch (234:6): [True: 0, False: 0]
  |  Branch (234:12): [True: 0, False: 0]
  ------------------
  235|      0|	{
  236|      0|		DBG1(DBG_LIB, "stat() on '%s' failed: %s", match,
  ------------------
  |  |  133|      0|# define DBG1(...) {}
  ------------------
  237|      0|			 strerror(errno));
  238|      0|		return FALSE;
  ------------------
  |  |   41|      0|# define FALSE false
  ------------------
  239|      0|	}
  240|      0|	return TRUE;
  ------------------
  |  |   44|      0|# define TRUE  true
  ------------------
  241|      0|}
enumerator.c:destroy_glob_enum:
  211|  1.68k|{
  212|  1.68k|	globfree(&this->glob);
  213|  1.68k|	free(this);
  214|  1.68k|}

hashlist_create:
  530|  1.68k|{
  531|  1.68k|	private_hashlist_t *this = hashlist_create_internal(hash, size);
  532|       |
  533|  1.68k|	this->equals = equals;
  534|       |
  535|  1.68k|	return &this->public;
  536|  1.68k|}
hashlist.c:hashlist_create_internal:
  497|  1.68k|{
  498|  1.68k|	private_hashlist_t *this;
  499|       |
  500|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  501|  1.68k|		.public = {
  502|  1.68k|			.ht = {
  503|  1.68k|				.put = _put,
  504|  1.68k|				.get = _get,
  505|  1.68k|				.remove = _remove_,
  506|  1.68k|				.remove_at = (void*)_remove_at,
  507|  1.68k|				.get_count = _get_count,
  508|  1.68k|				.create_enumerator = _create_enumerator,
  509|  1.68k|				.destroy = _destroy,
  510|  1.68k|				.destroy_function = _destroy_function,
  511|  1.68k|			},
  512|  1.68k|			.get_match = _get_match,
  513|  1.68k|			.destroy = _destroy,
  514|  1.68k|		},
  515|  1.68k|		.hash = hash,
  516|  1.68k|	);
  517|       |
  518|  1.68k|	init_hashtable(this, size);
  519|       |
  520|  1.68k|	profiler_init(&this->profile, 3);
  ------------------
  |  |  110|  1.68k|#define profiler_init(...) {}
  ------------------
  521|       |
  522|  1.68k|	return this;
  523|  1.68k|}
hashlist.c:destroy:
  482|  1.68k|{
  483|       |	destroy_internal(this, NULL);
  484|  1.68k|}
hashlist.c:destroy_internal:
  456|  1.68k|{
  457|  1.68k|	pair_t *pair, *next;
  458|  1.68k|	u_int row;
  459|       |
  460|  1.68k|	profiler_cleanup(&this->profile, this->count, this->size);
  ------------------
  |  |  109|  1.68k|#define profiler_cleanup(...) {}
  ------------------
  461|       |
  462|   109k|	for (row = 0; row < this->size; row++)
  ------------------
  |  Branch (462:16): [True: 107k, False: 1.68k]
  ------------------
  463|   107k|	{
  464|   107k|		pair = this->table[row];
  465|   107k|		while (pair)
  ------------------
  |  Branch (465:10): [True: 0, False: 107k]
  ------------------
  466|      0|		{
  467|      0|			if (fn)
  ------------------
  |  Branch (467:8): [True: 0, False: 0]
  ------------------
  468|      0|			{
  469|      0|				fn(pair->value, pair->key);
  470|      0|			}
  471|      0|			next = pair->next;
  472|      0|			free(pair);
  473|      0|			pair = next;
  474|      0|		}
  475|   107k|	}
  476|  1.68k|	free(this->table);
  477|  1.68k|	free(this);
  478|  1.68k|}
hashlist.c:init_hashtable:
  160|  1.68k|{
  161|  1.68k|	size = max(MIN_SIZE, min(size, MAX_SIZE));
  ------------------
  |  |   29|  1.68k|#define max(x,y) ({ \
  |  |   30|  1.68k|	typeof(x) _x = (x); \
  |  |   31|  3.37k|	typeof(y) _y = (y); \
  |  |  ------------------
  |  |  |  Branch (31:18): [True: 1.68k, False: 0]
  |  |  ------------------
  |  |   32|  1.68k|	_x > _y ? _x : _y; })
  |  |  ------------------
  |  |  |  Branch (32:2): [True: 0, False: 1.68k]
  |  |  ------------------
  ------------------
  162|  1.68k|	this->size = hashtable_get_nearest_powerof2(size);
  163|  1.68k|	this->mask = this->size - 1;
  164|  1.68k|	profile_size(&this->profile, this->size);
  ------------------
  |  |  115|  1.68k|#define profile_size(...) {}
  ------------------
  165|       |
  166|  1.68k|	this->table = calloc(this->size, sizeof(pair_t*));
  167|  1.68k|}

hashtable_hash_str:
  172|  3.40k|{
  173|  3.40k|	return chunk_hash(chunk_from_str((char*)key));
  ------------------
  |  |  263|  3.40k|#define chunk_from_str(str) ({char *x = (str); chunk_create((u_char*)x, strlen(x));})
  ------------------
  174|  3.40k|}
hashtable_get_nearest_powerof2:
  237|  38.7k|{
  238|  38.7k|	u_int i;
  239|       |
  240|  38.7k|	--n;
  241|   232k|	for (i = 1; i < sizeof(u_int) * 8; i <<= 1)
  ------------------
  |  Branch (241:14): [True: 193k, False: 38.7k]
  ------------------
  242|   193k|	{
  243|   193k|		n |= n >> i;
  244|   193k|	}
  245|  38.7k|	return ++n;
  246|  38.7k|}
hashtable_create:
  563|  37.0k|{
  564|  37.0k|	private_hashtable_t *this;
  565|       |
  566|  37.0k|	INIT(this,
  ------------------
  |  |   44|  37.0k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  37.0k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  567|  37.0k|		.public = {
  568|  37.0k|			.put = _put,
  569|  37.0k|			.get = _get,
  570|  37.0k|			.remove = _remove_,
  571|  37.0k|			.remove_at = (void*)_remove_at,
  572|  37.0k|			.get_count = _get_count,
  573|  37.0k|			.create_enumerator = _create_enumerator,
  574|  37.0k|			.destroy = _destroy,
  575|  37.0k|			.destroy_function = _destroy_function,
  576|  37.0k|		},
  577|  37.0k|		.hash = hash,
  578|  37.0k|		.equals = equals,
  579|  37.0k|	);
  580|       |
  581|  37.0k|	init_hashtable(this, size);
  582|       |
  583|  37.0k|	profiler_init(&this->profile, 2);
  ------------------
  |  |  110|  37.0k|#define profiler_init(...) {}
  ------------------
  584|       |
  585|  37.0k|	return &this->public;
  586|  37.0k|}
hashtable.c:create_enumerator:
  508|  1.68k|{
  509|  1.68k|	private_enumerator_t *enumerator;
  510|       |
  511|  1.68k|	INIT(enumerator,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  512|  1.68k|		.enumerator = {
  513|  1.68k|			.enumerate = enumerator_enumerate_default,
  514|  1.68k|			.venumerate = _enumerate,
  515|  1.68k|			.destroy = (void*)free,
  516|  1.68k|		},
  517|  1.68k|		.table = this,
  518|  1.68k|	);
  519|  1.68k|	return &enumerator->enumerator;
  520|  1.68k|}
hashtable.c:enumerate:
  480|  1.68k|{
  481|  1.68k|	const void **key;
  482|  1.68k|	void **value;
  483|  1.68k|	pair_t *pair;
  484|       |
  485|  1.68k|	VA_ARGS_VGET(args, key, value);
  ------------------
  |  |  189|  1.68k|#define VA_ARGS_VGET(list, ...) ({ \
  |  |  190|  1.68k|	va_list _va_args_get_ap; \
  |  |  191|  1.68k|	va_copy(_va_args_get_ap, list); \
  |  |  192|  1.68k|	_VA_ARGS_GET_ASGN(__VA_ARGS__) \
  |  |  ------------------
  |  |  |  |  196|  1.68k|#define _VA_ARGS_GET_ASGN(...) VA_ARGS_DISPATCH(_VA_ARGS_GET_ASGN, __VA_ARGS__)(__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  160|  1.68k|#define VA_ARGS_DISPATCH(func, ...) _VA_ARGS_DISPATCH(func, VA_ARGS_NUM(__VA_ARGS__))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  161|  1.68k|#define _VA_ARGS_DISPATCH(func, num) __VA_ARGS_DISPATCH(func, num)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  162|  1.68k|#define __VA_ARGS_DISPATCH(func, num) func ## num
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  198|  1.68k|#define _VA_ARGS_GET_ASGN2(v1,v2) __VA_ARGS_GET_ASGN(v1) __VA_ARGS_GET_ASGN(v2)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  205|  1.68k|#define __VA_ARGS_GET_ASGN(v) v = va_arg(_va_args_get_ap, typeof(v));
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |               #define _VA_ARGS_GET_ASGN2(v1,v2) __VA_ARGS_GET_ASGN(v1) __VA_ARGS_GET_ASGN(v2)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  205|  1.68k|#define __VA_ARGS_GET_ASGN(v) v = va_arg(_va_args_get_ap, typeof(v));
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  193|  1.68k|	va_end(_va_args_get_ap); \
  |  |  194|  1.68k|})
  ------------------
  486|       |
  487|  1.68k|	while (this->index < this->table->items_count)
  ------------------
  |  Branch (487:9): [True: 0, False: 1.68k]
  ------------------
  488|      0|	{
  489|      0|		pair = &this->table->items[this->index++];
  490|      0|		if (pair->key)
  ------------------
  |  Branch (490:7): [True: 0, False: 0]
  ------------------
  491|      0|		{
  492|      0|			if (key)
  ------------------
  |  Branch (492:8): [True: 0, False: 0]
  ------------------
  493|      0|			{
  494|      0|				*key = pair->key;
  495|      0|			}
  496|      0|			if (value)
  ------------------
  |  Branch (496:8): [True: 0, False: 0]
  ------------------
  497|      0|			{
  498|      0|				*value = pair->value;
  499|      0|			}
  500|      0|			return TRUE;
  ------------------
  |  |   44|      0|# define TRUE  true
  ------------------
  501|      0|		}
  502|      0|	}
  503|  1.68k|	return FALSE;
  ------------------
  |  |   41|  1.68k|# define FALSE false
  ------------------
  504|  1.68k|}
hashtable.c:put:
  400|  3.40k|{
  401|  3.40k|	void *old_value = NULL;
  402|  3.40k|	pair_t *pair;
  403|  3.40k|	u_int index, hash = 0, row = 0;
  404|       |
  405|  3.40k|	if (this->items_count >= this->capacity &&
  ------------------
  |  Branch (405:6): [True: 0, False: 3.40k]
  ------------------
  406|      0|		!rehash(this, this->count * RESIZE_FACTOR))
  ------------------
  |  |   33|      0|#define RESIZE_FACTOR 3
  ------------------
  |  Branch (406:3): [True: 0, False: 0]
  ------------------
  407|      0|	{
  408|      0|		DBG1(DBG_LIB, "!!! FAILED TO RESIZE HASHTABLE TO %u !!!",
  ------------------
  |  |  133|      0|# define DBG1(...) {}
  ------------------
  409|      0|			 this->count * RESIZE_FACTOR);
  410|      0|		return NULL;
  411|      0|	}
  412|  3.40k|	pair = find_key(this, key, &hash, &row);
  413|  3.40k|	if (pair)
  ------------------
  |  Branch (413:6): [True: 0, False: 3.40k]
  ------------------
  414|      0|	{
  415|      0|		old_value = pair->value;
  416|      0|		pair->value = value;
  417|      0|		pair->key = key;
  418|      0|		return old_value;
  419|      0|	}
  420|  3.40k|	index = insert_item(this, row);
  421|  3.40k|	this->items[index] = (pair_t){
  422|  3.40k|		.hash = hash,
  423|  3.40k|		.key = key,
  424|  3.40k|		.value = value,
  425|  3.40k|	};
  426|  3.40k|	this->count++;
  427|  3.40k|	profile_count(&this->profile, this->count);
  ------------------
  |  |  116|  3.40k|#define profile_count(...) {}
  ------------------
  428|       |	return NULL;
  429|  3.40k|}
hashtable.c:get_index:
  197|  3.41k|{
  198|  3.41k|	if (this->capacity <= 0xff)
  ------------------
  |  Branch (198:6): [True: 3.41k, False: 0]
  ------------------
  199|  3.41k|	{
  200|  3.41k|		return ((uint8_t*)this->table)[row];
  201|  3.41k|	}
  202|      0|	else if (this->capacity <= 0xffff)
  ------------------
  |  Branch (202:11): [True: 0, False: 0]
  ------------------
  203|      0|	{
  204|      0|		return ((uint16_t*)this->table)[row];
  205|      0|	}
  206|      0|	return ((u_int*)this->table)[row];
  207|  3.41k|}
hashtable.c:get_next:
  280|     11|{
  281|     11|	*p += 1;
  282|     11|	return (row + *p) & this->mask;
  283|     11|}
hashtable.c:find_key:
  291|  3.40k|{
  292|  3.40k|	pair_t *pair;
  293|  3.40k|	u_int hash, row, p = 0, removed = 0, index;
  294|  3.40k|	bool found_removed = FALSE;
  ------------------
  |  |   41|  3.40k|# define FALSE false
  ------------------
  295|       |
  296|  3.40k|	if (!this->count && !out_hash && !out_row)
  ------------------
  |  Branch (296:6): [True: 1.68k, False: 1.72k]
  |  Branch (296:22): [True: 0, False: 1.68k]
  |  Branch (296:35): [True: 0, False: 0]
  ------------------
  297|      0|	{
  298|      0|		return NULL;
  299|      0|	}
  300|       |
  301|  3.40k|	lookup_start();
  ------------------
  |  |  111|  3.40k|#define lookup_start(...) {}
  ------------------
  302|       |
  303|  3.40k|	hash = this->hash(key);
  304|  3.40k|	row = hash & this->mask;
  305|  3.40k|	index = get_index(this, row);
  306|  3.41k|	while (index)
  ------------------
  |  Branch (306:9): [True: 11, False: 3.40k]
  ------------------
  307|     11|	{
  308|     11|		lookup_probing();
  ------------------
  |  |  112|     11|#define lookup_probing(...) {}
  ------------------
  309|     11|		pair = &this->items[index-1];
  310|       |
  311|     11|		if (!pair->key)
  ------------------
  |  Branch (311:7): [True: 0, False: 11]
  ------------------
  312|      0|		{
  313|      0|			if (!found_removed && out_row)
  ------------------
  |  Branch (313:8): [True: 0, False: 0]
  |  Branch (313:26): [True: 0, False: 0]
  ------------------
  314|      0|			{
  315|      0|				removed = row;
  316|      0|				found_removed = TRUE;
  ------------------
  |  |   44|      0|# define TRUE  true
  ------------------
  317|      0|			}
  318|      0|		}
  319|     11|		else if (pair->hash == hash && this->equals(key, pair->key))
  ------------------
  |  Branch (319:12): [True: 0, False: 11]
  |  Branch (319:34): [True: 0, False: 0]
  ------------------
  320|      0|		{
  321|      0|			lookup_success(&this->profile);
  ------------------
  |  |  113|      0|#define lookup_success(...) {}
  ------------------
  322|      0|			return pair;
  323|      0|		}
  324|     11|		row = get_next(this, row, &p);
  325|     11|		index = get_index(this, row);
  326|     11|	}
  327|  3.40k|	if (out_hash)
  ------------------
  |  Branch (327:6): [True: 3.40k, False: 0]
  ------------------
  328|  3.40k|	{
  329|  3.40k|		*out_hash = hash;
  330|  3.40k|	}
  331|  3.40k|	if (out_row)
  ------------------
  |  Branch (331:6): [True: 3.40k, False: 0]
  ------------------
  332|  3.40k|	{
  333|  3.40k|		*out_row = found_removed ? removed : row;
  ------------------
  |  Branch (333:14): [True: 0, False: 3.40k]
  ------------------
  334|  3.40k|	}
  335|  3.40k|	lookup_failure(&this->profile);
  ------------------
  |  |  114|  3.40k|#define lookup_failure(...) {}
  ------------------
  336|       |	return NULL;
  337|  3.40k|}
hashtable.c:insert_item:
  344|  3.40k|{
  345|  3.40k|	u_int index = this->items_count++;
  346|       |
  347|       |	/* we use 0 to mark unused buckets, so increase the index */
  348|  3.40k|	set_index(this, row, index + 1);
  349|  3.40k|	return index;
  350|  3.40k|}
hashtable.c:set_index:
  213|  3.40k|{
  214|  3.40k|	if (this->capacity <= 0xff)
  ------------------
  |  Branch (214:6): [True: 3.40k, False: 0]
  ------------------
  215|  3.40k|	{
  216|  3.40k|		((uint8_t*)this->table)[row] = index;
  217|  3.40k|	}
  218|      0|	else if (this->capacity <= 0xffff)
  ------------------
  |  Branch (218:11): [True: 0, False: 0]
  ------------------
  219|      0|	{
  220|      0|		((uint16_t*)this->table)[row] = index;
  221|      0|	}
  222|      0|	else
  223|      0|	{
  224|      0|		((u_int*)this->table)[row] = index;
  225|      0|	}
  226|  3.40k|}
hashtable.c:destroy:
  548|  33.7k|{
  549|       |	destroy_internal(this, NULL);
  550|  33.7k|}
hashtable.c:destroy_internal:
  524|  37.0k|{
  525|  37.0k|	pair_t *pair;
  526|  37.0k|	u_int i;
  527|       |
  528|  37.0k|	profiler_cleanup(&this->profile, this->count, this->size);
  ------------------
  |  |  109|  37.0k|#define profiler_cleanup(...) {}
  ------------------
  529|       |
  530|  37.0k|	if (fn)
  ------------------
  |  Branch (530:6): [True: 3.37k, False: 33.7k]
  ------------------
  531|  3.37k|	{
  532|  6.74k|		for (i = 0; i < this->items_count; i++)
  ------------------
  |  Branch (532:15): [True: 3.37k, False: 3.37k]
  ------------------
  533|  3.37k|		{
  534|  3.37k|			pair = &this->items[i];
  535|  3.37k|			if (pair->key)
  ------------------
  |  Branch (535:8): [True: 3.37k, False: 0]
  ------------------
  536|  3.37k|			{
  537|  3.37k|				fn(pair->value, pair->key);
  538|  3.37k|			}
  539|  3.37k|		}
  540|  3.37k|	}
  541|  37.0k|	free(this->items);
  542|  37.0k|	free(this->table);
  543|  37.0k|	free(this);
  544|  37.0k|}
hashtable.c:destroy_function:
  554|  3.37k|{
  555|  3.37k|	destroy_internal(this, fn);
  556|  3.37k|}
hashtable.c:init_hashtable:
  252|  37.0k|{
  253|  37.0k|	u_int index_size = sizeof(u_int);
  254|       |
  255|  37.0k|	this->size = max(MIN_SIZE, min(size, MAX_SIZE));
  ------------------
  |  |   29|  37.0k|#define max(x,y) ({ \
  |  |   30|  37.0k|	typeof(x) _x = (x); \
  |  |   31|  74.1k|	typeof(y) _y = (y); \
  |  |  ------------------
  |  |  |  Branch (31:18): [True: 37.0k, False: 0]
  |  |  ------------------
  |  |   32|  37.0k|	_x > _y ? _x : _y; })
  |  |  ------------------
  |  |  |  Branch (32:2): [True: 5.05k, False: 32.0k]
  |  |  ------------------
  ------------------
  256|  37.0k|	this->size = hashtable_get_nearest_powerof2(this->size);
  257|  37.0k|	this->mask = this->size - 1;
  258|  37.0k|	profile_size(&this->profile, this->size);
  ------------------
  |  |  115|  37.0k|#define profile_size(...) {}
  ------------------
  259|       |
  260|  37.0k|	this->capacity = CAPACITY(this->size);
  ------------------
  |  |   30|  37.0k|#define CAPACITY(size) (size / 3 * 2)
  ------------------
  261|  37.0k|	this->items = calloc(this->capacity, sizeof(pair_t));
  262|  37.0k|	this->items_count = 0;
  263|       |
  264|  37.0k|	if (this->capacity <= 0xff)
  ------------------
  |  Branch (264:6): [True: 37.0k, False: 0]
  ------------------
  265|  37.0k|	{
  266|  37.0k|		index_size = sizeof(uint8_t);
  267|  37.0k|	}
  268|      0|	else if (this->capacity <= 0xffff)
  ------------------
  |  Branch (268:11): [True: 0, False: 0]
  ------------------
  269|      0|	{
  270|      0|		index_size = sizeof(uint16_t);
  271|      0|	}
  272|  37.0k|	this->table = calloc(this->size, index_size);
  273|  37.0k|}

linked_list_create:
  565|  79.2k|{
  566|  79.2k|	private_linked_list_t *this;
  567|       |
  568|  79.2k|	INIT(this,
  ------------------
  |  |   44|  79.2k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  79.2k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  569|  79.2k|		.public = {
  570|  79.2k|			.get_count = _get_count,
  571|  79.2k|			.create_enumerator = _create_enumerator,
  572|  79.2k|			.reset_enumerator = (void*)_reset_enumerator,
  573|  79.2k|			.get_first = _get_first,
  574|  79.2k|			.get_last = _get_last,
  575|  79.2k|			.find_first = _find_first,
  576|  79.2k|			.insert_first = _insert_first,
  577|  79.2k|			.insert_last = _insert_last,
  578|  79.2k|			.insert_before = (void*)_insert_before,
  579|  79.2k|			.remove_first = _remove_first,
  580|  79.2k|			.remove_last = _remove_last,
  581|  79.2k|			.remove = _remove_,
  582|  79.2k|			.remove_at = (void*)_remove_at,
  583|  79.2k|			.invoke_offset = _invoke_offset,
  584|  79.2k|			.invoke_function = _invoke_function,
  585|  79.2k|			.clone_offset = _clone_offset,
  586|  79.2k|			.equals_offset = _equals_offset,
  587|  79.2k|			.equals_function = _equals_function,
  588|  79.2k|			.destroy = _destroy,
  589|  79.2k|			.destroy_offset = _destroy_offset,
  590|  79.2k|			.destroy_function = _destroy_function,
  591|  79.2k|		},
  592|  79.2k|	);
  593|       |
  594|  79.2k|	return &this->public;
  595|  79.2k|}
linked_list.c:get_count:
  192|  1.68k|{
  193|  1.68k|	return this->count;
  194|  1.68k|}
linked_list.c:create_enumerator:
  167|  16.8k|{
  168|  16.8k|	private_enumerator_t *enumerator;
  169|       |
  170|  16.8k|	INIT(enumerator,
  ------------------
  |  |   44|  16.8k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  16.8k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  171|  16.8k|		.public = {
  172|  16.8k|			.enumerate = enumerator_enumerate_default,
  173|  16.8k|			.venumerate = _enumerate_current,
  174|  16.8k|			.destroy = (void*)free,
  175|  16.8k|		},
  176|  16.8k|		.list = this,
  177|  16.8k|		.current = this->first,
  178|  16.8k|	);
  179|       |
  180|  16.8k|	return &enumerator->public;
  181|  16.8k|}
linked_list.c:enumerate_current:
  160|  26.9k|{
  161|  26.9k|	this->public.venumerate = _enumerate_next;
  162|  26.9k|	return do_enumerate(this, args);
  163|  26.9k|}
linked_list.c:enumerate_next:
  150|   101k|{
  151|   101k|	if (this->current)
  ------------------
  |  Branch (151:6): [True: 101k, False: 0]
  ------------------
  152|   101k|	{
  153|   101k|		this->current = this->current->next;
  154|   101k|	}
  155|   101k|	return do_enumerate(this, args);
  156|   101k|}
linked_list.c:do_enumerate:
  132|   128k|{
  133|   128k|	void **item;
  134|       |
  135|   128k|	VA_ARGS_VGET(args, item);
  ------------------
  |  |  189|   128k|#define VA_ARGS_VGET(list, ...) ({ \
  |  |  190|   128k|	va_list _va_args_get_ap; \
  |  |  191|   128k|	va_copy(_va_args_get_ap, list); \
  |  |  192|   128k|	_VA_ARGS_GET_ASGN(__VA_ARGS__) \
  |  |  ------------------
  |  |  |  |  196|   128k|#define _VA_ARGS_GET_ASGN(...) VA_ARGS_DISPATCH(_VA_ARGS_GET_ASGN, __VA_ARGS__)(__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  160|   128k|#define VA_ARGS_DISPATCH(func, ...) _VA_ARGS_DISPATCH(func, VA_ARGS_NUM(__VA_ARGS__))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  161|   128k|#define _VA_ARGS_DISPATCH(func, num) __VA_ARGS_DISPATCH(func, num)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  162|   128k|#define __VA_ARGS_DISPATCH(func, num) func ## num
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  197|   128k|#define _VA_ARGS_GET_ASGN1(v1) __VA_ARGS_GET_ASGN(v1)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  205|   128k|#define __VA_ARGS_GET_ASGN(v) v = va_arg(_va_args_get_ap, typeof(v));
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  193|   128k|	va_end(_va_args_get_ap); \
  |  |  194|   128k|})
  ------------------
  136|       |
  137|   128k|	if (!this->current)
  ------------------
  |  Branch (137:6): [True: 16.8k, False: 111k]
  ------------------
  138|  16.8k|	{
  139|  16.8k|		return FALSE;
  ------------------
  |  |   41|  16.8k|# define FALSE false
  ------------------
  140|  16.8k|	}
  141|   111k|	if (item)
  ------------------
  |  Branch (141:6): [True: 111k, False: 0]
  ------------------
  142|   111k|	{
  143|   111k|		*item = this->current->value;
  144|   111k|	}
  145|       |	return TRUE;
  ------------------
  |  |   44|   111k|# define TRUE  true
  ------------------
  146|   128k|}
linked_list.c:insert_first:
  198|  3.37k|{
  199|  3.37k|	element_t *element;
  200|       |
  201|  3.37k|	element = element_create(item);
  202|  3.37k|	if (this->count == 0)
  ------------------
  |  Branch (202:6): [True: 3.37k, False: 0]
  ------------------
  203|  3.37k|	{
  204|       |		/* first entry in list */
  205|  3.37k|		this->first = element;
  206|  3.37k|		this->last = element;
  207|  3.37k|	}
  208|      0|	else
  209|      0|	{
  210|      0|		element->next = this->first;
  211|      0|		this->first->previous = element;
  212|      0|		this->first = element;
  213|      0|	}
  214|  3.37k|	this->count++;
  215|  3.37k|}
linked_list.c:element_create:
   66|   106k|{
   67|   106k|	element_t *this;
   68|   106k|	INIT(this,
  ------------------
  |  |   44|   106k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|   106k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
   69|   106k|		.value = value,
   70|   106k|	);
   71|   106k|	return this;
   72|   106k|}
linked_list.c:remove_first:
  265|  85.9k|{
  266|  85.9k|	if (get_first(this, item) == SUCCESS)
  ------------------
  |  Branch (266:6): [True: 3.37k, False: 82.6k]
  ------------------
  267|  3.37k|	{
  268|  3.37k|		remove_element(this, this->first);
  269|  3.37k|		return SUCCESS;
  270|  3.37k|	}
  271|  82.6k|	return NOT_FOUND;
  272|  85.9k|}
linked_list.c:get_first:
  254|  85.9k|{
  255|  85.9k|	if (this->count == 0)
  ------------------
  |  Branch (255:6): [True: 82.6k, False: 3.37k]
  ------------------
  256|  82.6k|	{
  257|  82.6k|		return NOT_FOUND;
  258|  82.6k|	}
  259|  3.37k|	*item = this->first->value;
  260|  3.37k|	return SUCCESS;
  261|  85.9k|}
linked_list.c:remove_element:
  222|  15.1k|{
  223|  15.1k|	element_t *next, *previous;
  224|       |
  225|  15.1k|	next = element->next;
  226|  15.1k|	previous = element->previous;
  227|  15.1k|	free(element);
  228|  15.1k|	if (next)
  ------------------
  |  Branch (228:6): [True: 6.74k, False: 8.43k]
  ------------------
  229|  6.74k|	{
  230|  6.74k|		next->previous = previous;
  231|  6.74k|	}
  232|  8.43k|	else
  233|  8.43k|	{
  234|  8.43k|		this->last = previous;
  235|  8.43k|	}
  236|  15.1k|	if (previous)
  ------------------
  |  Branch (236:6): [True: 0, False: 15.1k]
  ------------------
  237|      0|	{
  238|      0|		previous->next = next;
  239|      0|	}
  240|  15.1k|	else
  241|  15.1k|	{
  242|  15.1k|		this->first = next;
  243|  15.1k|	}
  244|  15.1k|	if (--this->count == 0)
  ------------------
  |  Branch (244:6): [True: 8.43k, False: 6.74k]
  ------------------
  245|  8.43k|	{
  246|  8.43k|		this->first = NULL;
  247|       |		this->last = NULL;
  248|  8.43k|	}
  249|  15.1k|	return next;
  250|  15.1k|}
linked_list.c:insert_last:
  276|   103k|{
  277|   103k|	element_t *element;
  278|       |
  279|   103k|	element = element_create(item);
  280|   103k|	if (this->count == 0)
  ------------------
  |  Branch (280:6): [True: 7.45k, False: 95.9k]
  ------------------
  281|  7.45k|	{
  282|       |		/* first entry in list */
  283|  7.45k|		this->first = element;
  284|  7.45k|		this->last = element;
  285|  7.45k|	}
  286|  95.9k|	else
  287|  95.9k|	{
  288|  95.9k|		element->previous = this->last;
  289|  95.9k|		this->last->next = element;
  290|  95.9k|		this->last = element;
  291|  95.9k|	}
  292|   103k|	this->count++;
  293|   103k|}
linked_list.c:remove_at:
  370|  10.1k|{
  371|  10.1k|	element_t *current;
  372|       |
  373|  10.1k|	if (enumerator->current)
  ------------------
  |  Branch (373:6): [True: 10.1k, False: 0]
  ------------------
  374|  10.1k|	{
  375|  10.1k|		current = enumerator->current;
  376|  10.1k|		enumerator->current = current->next;
  377|       |		/* the enumerator already points to the next item */
  378|  10.1k|		enumerator->public.venumerate = _enumerate_current;
  379|  10.1k|		remove_element(this, current);
  380|  10.1k|	}
  381|  10.1k|}
linked_list.c:remove_:
  348|  1.68k|{
  349|  1.68k|	element_t *current = this->first;
  350|  1.68k|	int removed = 0;
  351|       |
  352|  3.37k|	while (current)
  ------------------
  |  Branch (352:9): [True: 1.68k, False: 1.68k]
  ------------------
  353|  1.68k|	{
  354|  1.68k|		if ((compare && compare(current->value, item)) ||
  ------------------
  |  Branch (354:8): [True: 0, False: 1.68k]
  |  Branch (354:19): [True: 0, False: 0]
  ------------------
  355|  1.68k|			(!compare && current->value == item))
  ------------------
  |  Branch (355:5): [True: 1.68k, False: 0]
  |  Branch (355:17): [True: 1.68k, False: 0]
  ------------------
  356|  1.68k|		{
  357|  1.68k|			removed++;
  358|  1.68k|			current = remove_element(this, current);
  359|  1.68k|		}
  360|      0|		else
  361|      0|		{
  362|      0|			current = current->next;
  363|      0|		}
  364|  1.68k|	}
  365|  1.68k|	return removed;
  366|  1.68k|}
linked_list.c:remove_last:
  337|  1.68k|{
  338|  1.68k|	if (get_last(this, item) == SUCCESS)
  ------------------
  |  Branch (338:6): [True: 0, False: 1.68k]
  ------------------
  339|      0|	{
  340|      0|		remove_element(this, this->last);
  341|      0|		return SUCCESS;
  342|      0|	}
  343|  1.68k|	return NOT_FOUND;
  344|  1.68k|}
linked_list.c:get_last:
  326|  1.68k|{
  327|  1.68k|	if (this->count == 0)
  ------------------
  |  Branch (327:6): [True: 1.68k, False: 0]
  ------------------
  328|  1.68k|	{
  329|  1.68k|		return NOT_FOUND;
  330|  1.68k|	}
  331|      0|	*item = this->last->value;
  332|      0|	return SUCCESS;
  333|  1.68k|}
linked_list.c:invoke_offset:
  422|  1.68k|{
  423|  1.68k|	element_t *current = this->first;
  424|  1.68k|	void (**method)(void*);
  425|       |
  426|  1.68k|	while (current)
  ------------------
  |  Branch (426:9): [True: 0, False: 1.68k]
  ------------------
  427|      0|	{
  428|      0|		method = current->value + offset;
  429|      0|		(*method)(current->value);
  430|      0|		current = current->next;
  431|      0|	}
  432|  1.68k|}
linked_list.c:destroy:
  518|  70.8k|{
  519|  70.8k|	void *value;
  520|       |
  521|       |	/* Remove all list items before destroying list */
  522|  72.4k|	while (remove_first(this, &value) == SUCCESS)
  ------------------
  |  Branch (522:9): [True: 1.68k, False: 70.8k]
  ------------------
  523|  1.68k|	{
  524|       |		/* values are not destroyed so memory leaks are possible
  525|       |		 * if list is not empty when deleting */
  526|  1.68k|	}
  527|  70.8k|	free(this);
  528|  70.8k|}
linked_list.c:destroy_offset:
  532|  3.37k|{
  533|  3.37k|	element_t *current = this->first, *next;
  534|       |
  535|  94.9k|	while (current)
  ------------------
  |  Branch (535:9): [True: 91.5k, False: 3.37k]
  ------------------
  536|  91.5k|	{
  537|  91.5k|		void (**method)(void*) = current->value + offset;
  538|  91.5k|		(*method)(current->value);
  539|  91.5k|		next = current->next;
  540|  91.5k|		free(current);
  541|  91.5k|		current = next;
  542|  91.5k|	}
  543|  3.37k|	free(this);
  544|  3.37k|}
linked_list.c:destroy_function:
  548|  5.05k|{
  549|  5.05k|	element_t *current = this->first, *next;
  550|       |
  551|  5.05k|	while (current)
  ------------------
  |  Branch (551:9): [True: 0, False: 5.05k]
  ------------------
  552|      0|	{
  553|      0|		fn(current->value);
  554|      0|		next = current->next;
  555|      0|		free(current);
  556|      0|		current = next;
  557|      0|	}
  558|  5.05k|	free(this);
  559|  5.05k|}

cred_encoding_create:
  253|  1.68k|{
  254|  1.68k|	private_cred_encoding_t *this;
  255|  1.68k|	cred_encoding_type_t type;
  256|       |
  257|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  258|  1.68k|		.public = {
  259|  1.68k|			.encode = (bool(*)(cred_encoding_t*, cred_encoding_type_t type, void *cache, chunk_t *encoding, ...))encode,
  260|  1.68k|			.get_cache = _get_cache,
  261|  1.68k|			.cache = _cache,
  262|  1.68k|			.clear_cache = _clear_cache,
  263|  1.68k|			.add_encoder = _add_encoder,
  264|  1.68k|			.remove_encoder = _remove_encoder,
  265|  1.68k|			.destroy = _destroy,
  266|  1.68k|		},
  267|  1.68k|		.encoders = linked_list_create(),
  268|  1.68k|		.lock = rwlock_create(RWLOCK_TYPE_DEFAULT),
  269|  1.68k|	);
  270|       |
  271|  32.0k|	for (type = 0; type < CRED_ENCODING_MAX; type++)
  ------------------
  |  Branch (271:17): [True: 30.3k, False: 1.68k]
  ------------------
  272|  30.3k|	{
  273|  30.3k|		this->cache[type] = hashtable_create(hashtable_hash_ptr,
  274|  30.3k|											 hashtable_equals_ptr, 8);
  275|  30.3k|	}
  276|       |
  277|  1.68k|	return &this->public;
  278|  1.68k|}
cred_encoding.c:destroy:
  233|  1.68k|{
  234|  1.68k|	cred_encoding_type_t type;
  235|       |
  236|  32.0k|	for (type = 0; type < CRED_ENCODING_MAX; type++)
  ------------------
  |  Branch (236:17): [True: 30.3k, False: 1.68k]
  ------------------
  237|  30.3k|	{
  238|       |		/* We explicitly do not free remaining encodings. All creds should
  239|       |		 * have gone now, and they are responsible for cleaning out their
  240|       |		 * cache entries. Not flushing here allows the leak detective to
  241|       |		 * complain if a credential did not flush cached encodings. */
  242|  30.3k|		this->cache[type]->destroy(this->cache[type]);
  243|  30.3k|	}
  244|  1.68k|	this->encoders->destroy(this->encoders);
  245|  1.68k|	this->lock->destroy(this->lock);
  246|  1.68k|	free(this);
  247|  1.68k|}

credential_factory_create:
  229|  1.68k|{
  230|  1.68k|	private_credential_factory_t *this;
  231|       |
  232|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  233|  1.68k|		.public = {
  234|  1.68k|			.create = _create,
  235|  1.68k|			.create_builder_enumerator = _create_builder_enumerator,
  236|  1.68k|			.add_builder = _add_builder,
  237|  1.68k|			.remove_builder = _remove_builder,
  238|  1.68k|			.destroy = _destroy,
  239|  1.68k|		},
  240|  1.68k|		.constructors = linked_list_create(),
  241|  1.68k|		.recursive = thread_value_create(NULL),
  242|  1.68k|		.lock = rwlock_create(RWLOCK_TYPE_DEFAULT),
  243|  1.68k|	);
  244|       |
  245|  1.68k|	return &this->public;
  246|  1.68k|}
credential_factory.c:destroy:
  218|  1.68k|{
  219|  1.68k|	this->constructors->destroy_function(this->constructors, free);
  220|  1.68k|	this->recursive->destroy(this->recursive);
  221|  1.68k|	this->lock->destroy(this->lock);
  222|  1.68k|	free(this);
  223|  1.68k|}

credential_manager_create:
 1444|  1.68k|{
 1445|  1.68k|	private_credential_manager_t *this;
 1446|       |
 1447|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
 1448|  1.68k|		.public = {
 1449|  1.68k|			.create_cert_enumerator = _create_cert_enumerator,
 1450|  1.68k|			.create_shared_enumerator = _create_shared_enumerator,
 1451|  1.68k|			.create_cdp_enumerator = _create_cdp_enumerator,
 1452|  1.68k|			.get_cert = _get_cert,
 1453|  1.68k|			.get_shared = _get_shared,
 1454|  1.68k|			.get_private = _get_private,
 1455|  1.68k|			.get_ocsp = _get_ocsp,
 1456|  1.68k|			.create_trusted_enumerator = _create_trusted_enumerator,
 1457|  1.68k|			.create_public_enumerator = _create_public_enumerator,
 1458|  1.68k|			.flush_cache = _flush_cache,
 1459|  1.68k|			.cache_cert = _cache_cert,
 1460|  1.68k|			.issued_by = _issued_by,
 1461|  1.68k|			.add_set = _add_set,
 1462|  1.68k|			.remove_set = _remove_set,
 1463|  1.68k|			.add_local_set = _add_local_set,
 1464|  1.68k|			.remove_local_set = _remove_local_set,
 1465|  1.68k|			.add_validator = _add_validator,
 1466|  1.68k|			.remove_validator = _remove_validator,
 1467|  1.68k|			.set_hook = _set_hook,
 1468|  1.68k|			.call_hook = _call_hook,
 1469|  1.68k|			.destroy = _destroy,
 1470|  1.68k|		},
 1471|  1.68k|		.sets = linked_list_create(),
 1472|  1.68k|		.validators = linked_list_create(),
 1473|  1.68k|		.cache_queue = linked_list_create(),
 1474|  1.68k|		.lock = rwlock_create(RWLOCK_TYPE_DEFAULT),
 1475|  1.68k|		.queue_mutex = mutex_create(MUTEX_TYPE_DEFAULT),
 1476|  1.68k|		.reject_pretrusted = lib->settings->get_bool(lib->settings,
 1477|  1.68k|								"%s.reject_trusted_end_entity", FALSE, lib->ns),
 1478|  1.68k|	);
 1479|       |
 1480|  1.68k|	this->local_sets = thread_value_create((thread_cleanup_t)this->sets->destroy);
 1481|  1.68k|	this->exclusive_local_sets = thread_value_create((thread_cleanup_t)this->sets->destroy);
 1482|  1.68k|	if (lib->settings->get_bool(lib->settings, "%s.cert_cache", TRUE, lib->ns))
  ------------------
  |  |   44|  1.68k|# define TRUE  true
  ------------------
  |  Branch (1482:6): [True: 1.68k, False: 0]
  ------------------
 1483|  1.68k|	{
 1484|  1.68k|		this->cache = cert_cache_create();
 1485|  1.68k|		this->sets->insert_first(this->sets, this->cache);
 1486|  1.68k|	}
 1487|       |
 1488|  1.68k|	return &this->public;
 1489|  1.68k|}
credential_manager.c:cache_queue:
  534|  1.68k|{
  535|  1.68k|	credential_set_t *set;
  536|  1.68k|	certificate_t *cert;
  537|  1.68k|	enumerator_t *enumerator;
  538|       |
  539|  1.68k|	this->queue_mutex->lock(this->queue_mutex);
  540|  1.68k|	if (this->cache_queue->get_count(this->cache_queue) > 0 &&
  ------------------
  |  Branch (540:6): [True: 0, False: 1.68k]
  ------------------
  541|      0|		this->lock->try_write_lock(this->lock))
  ------------------
  |  Branch (541:3): [True: 0, False: 0]
  ------------------
  542|      0|	{
  543|      0|		while (this->cache_queue->remove_last(this->cache_queue,
  ------------------
  |  Branch (543:10): [True: 0, False: 0]
  ------------------
  544|      0|											  (void**)&cert) == SUCCESS)
  545|      0|		{
  546|      0|			enumerator = this->sets->create_enumerator(this->sets);
  547|      0|			while (enumerator->enumerate(enumerator, &set))
  ------------------
  |  Branch (547:11): [True: 0, False: 0]
  ------------------
  548|      0|			{
  549|      0|				set->cache_cert(set, cert);
  550|      0|			}
  551|      0|			enumerator->destroy(enumerator);
  552|      0|			cert->destroy(cert);
  553|      0|		}
  554|      0|		this->lock->unlock(this->lock);
  555|      0|	}
  556|  1.68k|	this->queue_mutex->unlock(this->queue_mutex);
  557|  1.68k|}
credential_manager.c:flush_cache:
 1382|  1.68k|{
 1383|  1.68k|	if (this->cache)
  ------------------
  |  Branch (1383:6): [True: 1.68k, False: 0]
  ------------------
 1384|  1.68k|	{
 1385|  1.68k|		this->cache->flush(this->cache, type);
 1386|  1.68k|	}
 1387|  1.68k|}
credential_manager.c:destroy:
 1423|  1.68k|{
 1424|  1.68k|	cache_queue(this);
 1425|  1.68k|	this->cache_queue->destroy(this->cache_queue);
 1426|  1.68k|	if (this->cache)
  ------------------
  |  Branch (1426:6): [True: 1.68k, False: 0]
  ------------------
 1427|  1.68k|	{
 1428|       |		this->sets->remove(this->sets, this->cache, NULL);
 1429|  1.68k|		this->cache->destroy(this->cache);
 1430|  1.68k|	}
 1431|  1.68k|	this->sets->destroy(this->sets);
 1432|  1.68k|	this->local_sets->destroy(this->local_sets);
 1433|  1.68k|	this->exclusive_local_sets->destroy(this->exclusive_local_sets);
 1434|  1.68k|	this->validators->destroy(this->validators);
 1435|  1.68k|	this->lock->destroy(this->lock);
 1436|  1.68k|	this->queue_mutex->destroy(this->queue_mutex);
 1437|  1.68k|	free(this);
 1438|  1.68k|}

ocsp_responders_create:
  104|  1.68k|{
  105|  1.68k|	private_ocsp_responders_t *this;
  106|       |
  107|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  108|  1.68k|		.public = {
  109|  1.68k|			.get_status = _get_status,
  110|  1.68k|			.add_responder = _add_responder,
  111|  1.68k|			.remove_responder = _remove_responder,
  112|  1.68k|			.destroy = _destroy,
  113|  1.68k|		},
  114|  1.68k|		.responders = linked_list_create(),
  115|  1.68k|		.lock = rwlock_create(RWLOCK_TYPE_DEFAULT),
  116|  1.68k|	);
  117|       |
  118|  1.68k|	return &this->public;
  119|  1.68k|}
ocsp_responders.c:destroy:
   94|  1.68k|{
   95|  1.68k|	this->responders->destroy(this->responders);
   96|  1.68k|	this->lock->destroy(this->lock);
   97|  1.68k|	free(this);
   98|  1.68k|}

cert_cache_create:
  478|  1.68k|{
  479|  1.68k|	private_cert_cache_t *this;
  480|  1.68k|	int i;
  481|       |
  482|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  483|  1.68k|		.public = {
  484|  1.68k|			.set = {
  485|  1.68k|				.create_cert_enumerator = _create_enumerator,
  486|  1.68k|				.create_private_enumerator = (void*)return_null,
  487|  1.68k|				.create_shared_enumerator = (void*)return_null,
  488|  1.68k|				.create_cdp_enumerator = (void*)return_null,
  489|  1.68k|				.cache_cert = (void*)nop,
  490|  1.68k|			},
  491|  1.68k|			.issued_by = _issued_by,
  492|  1.68k|			.flush = _flush,
  493|  1.68k|			.destroy = _destroy,
  494|  1.68k|		},
  495|  1.68k|	);
  496|       |
  497|  55.6k|	for (i = 0; i < CACHE_SIZE; i++)
  ------------------
  |  |   29|  55.6k|#define CACHE_SIZE 32
  ------------------
  |  Branch (497:14): [True: 53.9k, False: 1.68k]
  ------------------
  498|  53.9k|	{
  499|  53.9k|		this->relations[i].subject = NULL;
  500|  53.9k|		this->relations[i].issuer = NULL;
  501|  53.9k|		this->relations[i].scheme = NULL;
  502|  53.9k|		this->relations[i].hits = 0;
  503|  53.9k|		this->relations[i].lock = rwlock_create(RWLOCK_TYPE_DEFAULT);
  504|  53.9k|	}
  505|       |
  506|  1.68k|	return &this->public;
  507|  1.68k|}
cert_cache.c:flush:
  413|  1.68k|{
  414|  1.68k|	relation_t *rel;
  415|  1.68k|	int i;
  416|       |
  417|  55.6k|	for (i = 0; i < CACHE_SIZE; i++)
  ------------------
  |  |   29|  55.6k|#define CACHE_SIZE 32
  ------------------
  |  Branch (417:14): [True: 53.9k, False: 1.68k]
  ------------------
  418|  53.9k|	{
  419|  53.9k|		rel = &this->relations[i];
  420|  53.9k|		if (!rel->subject)
  ------------------
  |  Branch (420:7): [True: 53.9k, False: 0]
  ------------------
  421|  53.9k|		{
  422|  53.9k|			continue;
  423|  53.9k|		}
  424|       |		/* check with cheap read lock first */
  425|      0|		if (type != CERT_ANY)
  ------------------
  |  Branch (425:7): [True: 0, False: 0]
  ------------------
  426|      0|		{
  427|      0|			rel->lock->read_lock(rel->lock);
  428|      0|			if (!rel->subject || type != rel->subject->get_type(rel->subject))
  ------------------
  |  Branch (428:8): [True: 0, False: 0]
  |  Branch (428:25): [True: 0, False: 0]
  ------------------
  429|      0|			{
  430|      0|				rel->lock->unlock(rel->lock);
  431|      0|				continue;
  432|      0|			}
  433|      0|			rel->lock->unlock(rel->lock);
  434|      0|		}
  435|       |		/* double check in write lock */
  436|      0|		rel->lock->write_lock(rel->lock);
  437|      0|		if (rel->subject)
  ------------------
  |  Branch (437:7): [True: 0, False: 0]
  ------------------
  438|      0|		{
  439|      0|			if (type == CERT_ANY || type == rel->subject->get_type(rel->subject))
  ------------------
  |  Branch (439:8): [True: 0, False: 0]
  |  Branch (439:28): [True: 0, False: 0]
  ------------------
  440|      0|			{
  441|      0|				rel->subject->destroy(rel->subject);
  442|      0|				rel->issuer->destroy(rel->issuer);
  443|      0|				signature_params_destroy(rel->scheme);
  444|      0|				rel->subject = NULL;
  445|      0|				rel->issuer = NULL;
  446|       |				rel->scheme = NULL;
  447|      0|				rel->hits = 0;
  448|      0|			}
  449|      0|		}
  450|      0|		rel->lock->unlock(rel->lock);
  451|      0|	}
  452|  1.68k|}
cert_cache.c:destroy:
  456|  1.68k|{
  457|  1.68k|	relation_t *rel;
  458|  1.68k|	int i;
  459|       |
  460|  55.6k|	for (i = 0; i < CACHE_SIZE; i++)
  ------------------
  |  |   29|  55.6k|#define CACHE_SIZE 32
  ------------------
  |  Branch (460:14): [True: 53.9k, False: 1.68k]
  ------------------
  461|  53.9k|	{
  462|  53.9k|		rel = &this->relations[i];
  463|  53.9k|		if (rel->subject)
  ------------------
  |  Branch (463:7): [True: 0, False: 53.9k]
  ------------------
  464|      0|		{
  465|      0|			rel->subject->destroy(rel->subject);
  466|      0|			rel->issuer->destroy(rel->issuer);
  467|      0|			signature_params_destroy(rel->scheme);
  468|      0|		}
  469|  53.9k|		rel->lock->destroy(rel->lock);
  470|  53.9k|	}
  471|  1.68k|	free(this);
  472|  1.68k|}

crypto_factory_create:
 1453|  1.68k|{
 1454|  1.68k|	private_crypto_factory_t *this;
 1455|       |
 1456|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
 1457|  1.68k|		.public = {
 1458|  1.68k|			.create_crypter = _create_crypter,
 1459|  1.68k|			.create_aead = _create_aead,
 1460|  1.68k|			.create_signer = _create_signer,
 1461|  1.68k|			.create_hasher = _create_hasher,
 1462|  1.68k|			.create_prf = _create_prf,
 1463|  1.68k|			.create_xof = _create_xof,
 1464|  1.68k|			.create_kdf = _create_kdf,
 1465|  1.68k|			.create_drbg = _create_drbg,
 1466|  1.68k|			.create_rng = _create_rng,
 1467|  1.68k|			.create_nonce_gen = _create_nonce_gen,
 1468|  1.68k|			.create_ke = _create_ke,
 1469|  1.68k|			.add_crypter = _add_crypter,
 1470|  1.68k|			.remove_crypter = _remove_crypter,
 1471|  1.68k|			.add_aead = _add_aead,
 1472|  1.68k|			.remove_aead = _remove_aead,
 1473|  1.68k|			.add_signer = _add_signer,
 1474|  1.68k|			.remove_signer = _remove_signer,
 1475|  1.68k|			.add_hasher = _add_hasher,
 1476|  1.68k|			.remove_hasher = _remove_hasher,
 1477|  1.68k|			.add_prf = _add_prf,
 1478|  1.68k|			.remove_prf = _remove_prf,
 1479|  1.68k|			.add_xof = _add_xof,
 1480|  1.68k|			.remove_xof = _remove_xof,
 1481|  1.68k|			.add_kdf = _add_kdf,
 1482|  1.68k|			.remove_kdf = _remove_kdf,
 1483|  1.68k|			.add_drbg = _add_drbg,
 1484|  1.68k|			.remove_drbg = _remove_drbg,
 1485|  1.68k|			.add_rng = _add_rng,
 1486|  1.68k|			.remove_rng = _remove_rng,
 1487|  1.68k|			.add_nonce_gen = _add_nonce_gen,
 1488|  1.68k|			.remove_nonce_gen = _remove_nonce_gen,
 1489|  1.68k|			.add_ke = _add_ke,
 1490|  1.68k|			.remove_ke = _remove_ke,
 1491|  1.68k|			.create_crypter_enumerator = _create_crypter_enumerator,
 1492|  1.68k|			.create_aead_enumerator = _create_aead_enumerator,
 1493|  1.68k|			.create_signer_enumerator = _create_signer_enumerator,
 1494|  1.68k|			.create_hasher_enumerator = _create_hasher_enumerator,
 1495|  1.68k|			.create_prf_enumerator = _create_prf_enumerator,
 1496|  1.68k|			.create_xof_enumerator = _create_xof_enumerator,
 1497|  1.68k|			.create_kdf_enumerator = _create_kdf_enumerator,
 1498|  1.68k|			.create_drbg_enumerator = _create_drbg_enumerator,
 1499|  1.68k|			.create_ke_enumerator = _create_ke_enumerator,
 1500|  1.68k|			.create_rng_enumerator = _create_rng_enumerator,
 1501|  1.68k|			.create_nonce_gen_enumerator = _create_nonce_gen_enumerator,
 1502|  1.68k|			.add_test_vector = _add_test_vector,
 1503|  1.68k|			.create_verify_enumerator = _create_verify_enumerator,
 1504|  1.68k|			.destroy = _destroy,
 1505|  1.68k|		},
 1506|  1.68k|		.crypters = linked_list_create(),
 1507|  1.68k|		.aeads = linked_list_create(),
 1508|  1.68k|		.signers = linked_list_create(),
 1509|  1.68k|		.hashers = linked_list_create(),
 1510|  1.68k|		.prfs = linked_list_create(),
 1511|  1.68k|		.xofs = linked_list_create(),
 1512|  1.68k|		.kdfs = linked_list_create(),
 1513|  1.68k|		.drbgs = linked_list_create(),
 1514|  1.68k|		.rngs = linked_list_create(),
 1515|  1.68k|		.nonce_gens = linked_list_create(),
 1516|  1.68k|		.kes = linked_list_create(),
 1517|  1.68k|		.lock = rwlock_create(RWLOCK_TYPE_DEFAULT),
 1518|  1.68k|		.tester = crypto_tester_create(),
 1519|  1.68k|		.test_on_add = lib->settings->get_bool(lib->settings,
 1520|  1.68k|								"%s.crypto_test.on_add", FALSE, lib->ns),
 1521|  1.68k|		.test_on_create = lib->settings->get_bool(lib->settings,
 1522|  1.68k|								"%s.crypto_test.on_create", FALSE, lib->ns),
 1523|  1.68k|		.bench = lib->settings->get_bool(lib->settings,
 1524|  1.68k|								"%s.crypto_test.bench", FALSE, lib->ns),
 1525|  1.68k|	);
 1526|       |
 1527|  1.68k|	return &this->public;
 1528|  1.68k|}
crypto_factory.c:destroy:
 1432|  1.68k|{
 1433|  1.68k|	this->crypters->destroy(this->crypters);
 1434|  1.68k|	this->aeads->destroy(this->aeads);
 1435|  1.68k|	this->signers->destroy(this->signers);
 1436|  1.68k|	this->hashers->destroy(this->hashers);
 1437|  1.68k|	this->prfs->destroy(this->prfs);
 1438|  1.68k|	this->xofs->destroy(this->xofs);
 1439|  1.68k|	this->kdfs->destroy(this->kdfs);
 1440|  1.68k|	this->drbgs->destroy(this->drbgs);
 1441|  1.68k|	this->rngs->destroy(this->rngs);
 1442|  1.68k|	this->nonce_gens->destroy(this->nonce_gens);
 1443|  1.68k|	this->kes->destroy(this->kes);
 1444|  1.68k|	this->tester->destroy(this->tester);
 1445|  1.68k|	this->lock->destroy(this->lock);
 1446|  1.68k|	free(this);
 1447|  1.68k|}

crypto_tester_create:
 1983|  1.68k|{
 1984|  1.68k|	private_crypto_tester_t *this;
 1985|       |
 1986|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
 1987|  1.68k|		.public = {
 1988|  1.68k|			.test_crypter = _test_crypter,
 1989|  1.68k|			.test_aead = _test_aead,
 1990|  1.68k|			.test_signer = _test_signer,
 1991|  1.68k|			.test_hasher = _test_hasher,
 1992|  1.68k|			.test_prf = _test_prf,
 1993|  1.68k|			.test_xof = _test_xof,
 1994|  1.68k|			.test_kdf = _test_kdf,
 1995|  1.68k|			.test_drbg = _test_drbg,
 1996|  1.68k|			.test_rng = _test_rng,
 1997|  1.68k|			.test_ke = _test_ke,
 1998|  1.68k|			.add_crypter_vector = _add_crypter_vector,
 1999|  1.68k|			.add_aead_vector = _add_aead_vector,
 2000|  1.68k|			.add_signer_vector = _add_signer_vector,
 2001|  1.68k|			.add_hasher_vector = _add_hasher_vector,
 2002|  1.68k|			.add_prf_vector = _add_prf_vector,
 2003|  1.68k|			.add_xof_vector = _add_xof_vector,
 2004|  1.68k|			.add_kdf_vector = _add_kdf_vector,
 2005|  1.68k|			.add_drbg_vector = _add_drbg_vector,
 2006|  1.68k|			.add_rng_vector = _add_rng_vector,
 2007|  1.68k|			.add_ke_vector = _add_ke_vector,
 2008|  1.68k|			.destroy = _destroy,
 2009|  1.68k|		},
 2010|  1.68k|		.crypter = linked_list_create(),
 2011|  1.68k|		.aead = linked_list_create(),
 2012|  1.68k|		.signer = linked_list_create(),
 2013|  1.68k|		.hasher = linked_list_create(),
 2014|  1.68k|		.prf = linked_list_create(),
 2015|  1.68k|		.xof = linked_list_create(),
 2016|  1.68k|		.kdf = linked_list_create(),
 2017|  1.68k|		.drbg = linked_list_create(),
 2018|  1.68k|		.rng = linked_list_create(),
 2019|  1.68k|		.ke = linked_list_create(),
 2020|       |
 2021|  1.68k|		.required = lib->settings->get_bool(lib->settings,
 2022|  1.68k|								"%s.crypto_test.required", FALSE, lib->ns),
 2023|  1.68k|		.rng_true = lib->settings->get_bool(lib->settings,
 2024|  1.68k|								"%s.crypto_test.rng_true", FALSE, lib->ns),
 2025|  1.68k|		.bench_time = lib->settings->get_int(lib->settings,
 2026|  1.68k|								"%s.crypto_test.bench_time", 50, lib->ns),
 2027|  1.68k|		.bench_size = lib->settings->get_int(lib->settings,
 2028|  1.68k|								"%s.crypto_test.bench_size", 1024, lib->ns),
 2029|  1.68k|	);
 2030|       |
 2031|       |	/* enforce a block size of 16, should be fine for all algorithms */
 2032|  1.68k|	this->bench_size = this->bench_size / 16 * 16;
 2033|       |
 2034|  1.68k|	return &this->public;
 2035|  1.68k|}
crypto_tester.c:destroy:
 1965|  1.68k|{
 1966|  1.68k|	this->crypter->destroy(this->crypter);
 1967|  1.68k|	this->aead->destroy(this->aead);
 1968|  1.68k|	this->signer->destroy(this->signer);
 1969|  1.68k|	this->hasher->destroy(this->hasher);
 1970|  1.68k|	this->prf->destroy(this->prf);
 1971|  1.68k|	this->xof->destroy(this->xof);
 1972|  1.68k|	this->kdf->destroy(this->kdf);
 1973|  1.68k|	this->drbg->destroy(this->drbg);
 1974|  1.68k|	this->rng->destroy(this->rng);
 1975|  1.68k|	this->ke->destroy(this->ke);
 1976|  1.68k|	free(this);
 1977|  1.68k|}

key_exchange_init:
  540|  1.68k|{
  541|  1.68k|	int i;
  542|       |
  543|       |	/* the default exponent size set above is based on the optimal length
  544|       |	 * according to RFC 3526 */
  545|  1.68k|	if (lib->settings->get_bool(lib->settings,
  ------------------
  |  Branch (545:6): [True: 1.68k, False: 0]
  ------------------
  546|  1.68k|					"%s.dh_exponent_ansi_x9_42", TRUE, lib->ns))
  ------------------
  |  |   44|  1.68k|# define TRUE  true
  ------------------
  547|  1.68k|	{
  548|  20.2k|		for (i = 0; i < countof(dh_params); i++)
  ------------------
  |  |  215|  20.2k|#define countof(array) (sizeof(array)/sizeof((array)[0]) \
  |  |  216|  20.2k|						+ BUILD_ASSERT_ARRAY(array))
  |  |  ------------------
  |  |  |  |  114|  20.2k|		BUILD_ASSERT(!__builtin_types_compatible_p(typeof(a), typeof(&(a)[0])))
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|  20.2k|#define BUILD_ASSERT(x) (sizeof(char[(x) ? 0 : -1]))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (548:15): [True: 18.5k, False: 1.68k]
  ------------------
  549|  18.5k|		{
  550|       |			/* according to RFC 5114 the size of the exponent for these DH
  551|       |			 * groups should equal the size of their prime order subgroup */
  552|  18.5k|			if (dh_params[i].public.subgroup.len)
  ------------------
  |  Branch (552:8): [True: 5.05k, False: 13.4k]
  ------------------
  553|  5.05k|			{
  554|  5.05k|				continue;
  555|  5.05k|			}
  556|  13.4k|			dh_params[i].public.exp_len = dh_params[i].public.prime.len;
  557|  13.4k|		}
  558|  1.68k|	}
  559|       |
  560|  1.68k|	mutex = mutex_create(MUTEX_TYPE_RECURSIVE);
  561|  1.68k|	tokens = hashtable_create(hashtable_hash_str, hashtable_equals_str, 4);
  562|  1.68k|	lib->proposal->register_algname_parser(lib->proposal,
  563|  1.68k|										   additional_key_exchange_parser);
  564|  1.68k|}
key_exchange_deinit:
  570|  1.68k|{
  571|  1.68k|	tokens->destroy_function(tokens, (void*)token_destroy);
  572|  1.68k|	mutex->destroy(mutex);
  573|  1.68k|}

proposal_keywords_create:
  182|  1.68k|{
  183|  1.68k|	private_proposal_keywords_t *this;
  184|       |
  185|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  186|  1.68k|		.public = {
  187|  1.68k|			.get_token = _get_token,
  188|  1.68k|			.register_token = _register_token,
  189|  1.68k|			.register_algname_parser = _register_algname_parser,
  190|  1.68k|			.destroy = _destroy,
  191|  1.68k|		},
  192|  1.68k|		.tokens = linked_list_create(),
  193|  1.68k|		.parsers = linked_list_create(),
  194|  1.68k|		.lock = rwlock_create(RWLOCK_TYPE_DEFAULT),
  195|  1.68k|	);
  196|       |
  197|  1.68k|	return &this->public;
  198|  1.68k|}
proposal_keywords.c:register_algname_parser:
  156|  1.68k|{
  157|  1.68k|	this->lock->write_lock(this->lock);
  158|  1.68k|	this->parsers->insert_first(this->parsers, parser);
  159|  1.68k|	this->lock->unlock(this->lock);
  160|  1.68k|}
proposal_keywords.c:destroy:
  164|  1.68k|{
  165|  1.68k|	proposal_token_t *token;
  166|       |
  167|  1.68k|	while (this->tokens->remove_first(this->tokens, (void**)&token) == SUCCESS)
  ------------------
  |  Branch (167:9): [True: 0, False: 1.68k]
  ------------------
  168|      0|	{
  169|      0|		free(token->name);
  170|      0|		free(token);
  171|      0|	}
  172|  1.68k|	this->tokens->destroy(this->tokens);
  173|  1.68k|	this->parsers->destroy(this->parsers);
  174|  1.68k|	this->lock->destroy(this->lock);
  175|  1.68k|	free(this);
  176|  1.68k|}

database_factory_create:
   95|  1.68k|{
   96|  1.68k|	private_database_factory_t *this;
   97|       |
   98|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
   99|  1.68k|		.public = {
  100|  1.68k|			.create = _create,
  101|  1.68k|			.add_database = _add_database,
  102|  1.68k|			.remove_database = _remove_database,
  103|  1.68k|			.destroy = _destroy,
  104|  1.68k|		},
  105|  1.68k|		.databases = linked_list_create(),
  106|  1.68k|		.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
  107|  1.68k|	);
  108|       |
  109|  1.68k|	return &this->public;
  110|  1.68k|}
database_factory.c:destroy:
   85|  1.68k|{
   86|  1.68k|	this->databases->destroy(this->databases);
   87|  1.68k|	this->mutex->destroy(this->mutex);
   88|  1.68k|	free(this);
   89|  1.68k|}

fetcher_manager_create:
  202|  1.68k|{
  203|  1.68k|	private_fetcher_manager_t *this;
  204|       |
  205|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  206|  1.68k|		.public = {
  207|  1.68k|			.fetch = _fetch,
  208|  1.68k|			.add_fetcher = _add_fetcher,
  209|  1.68k|			.remove_fetcher = _remove_fetcher,
  210|  1.68k|			.destroy = _destroy,
  211|  1.68k|		},
  212|  1.68k|		.fetchers = linked_list_create(),
  213|  1.68k|		.lock = rwlock_create(RWLOCK_TYPE_DEFAULT),
  214|  1.68k|	);
  215|       |
  216|  1.68k|	return &this->public;
  217|  1.68k|}
fetcher_manager.c:destroy:
  192|  1.68k|{
  193|  1.68k|	this->fetchers->destroy_function(this->fetchers, (void*)entry_destroy);
  194|  1.68k|	this->lock->destroy(this->lock);
  195|  1.68k|	free(this);
  196|  1.68k|}

library_deinit:
  173|  1.68k|{
  174|  1.68k|	private_library_t *this = (private_library_t*)lib;
  175|  1.68k|	bool detailed;
  176|  1.68k|	int i;
  177|       |
  178|  1.68k|	if (!this || !ref_put(&this->ref))
  ------------------
  |  |   54|  1.68k|#define ref_put(ref) (!__atomic_sub_fetch(ref, 1, __ATOMIC_ACQ_REL))
  ------------------
  |  Branch (178:6): [True: 0, False: 1.68k]
  |  Branch (178:15): [True: 0, False: 1.68k]
  ------------------
  179|      0|	{	/* have more users */
  180|      0|		return;
  181|      0|	}
  182|       |
  183|  1.68k|	detailed = lib->settings->get_bool(lib->settings,
  184|  1.68k|								"%s.leak_detective.detailed", TRUE, lib->ns);
  ------------------
  |  |   44|  1.68k|# define TRUE  true
  ------------------
  185|       |
  186|       |	/* make sure the cache is clear before unloading plugins */
  187|  1.68k|	lib->credmgr->flush_cache(lib->credmgr, CERT_ANY);
  188|       |
  189|  1.68k|	for (i = 0; i < init_function_count; ++i)
  ------------------
  |  Branch (189:14): [True: 0, False: 1.68k]
  ------------------
  190|      0|	{
  191|      0|		init_functions[i](FALSE);
  ------------------
  |  |   41|      0|# define FALSE false
  ------------------
  192|      0|	}
  193|       |
  194|  1.68k|	key_exchange_deinit();
  195|       |
  196|  1.68k|	this->public.streams->destroy(this->public.streams);
  197|  1.68k|	this->public.watcher->destroy(this->public.watcher);
  198|  1.68k|	this->public.scheduler->destroy(this->public.scheduler);
  199|  1.68k|	this->public.processor->destroy(this->public.processor);
  200|  1.68k|	this->public.plugins->destroy(this->public.plugins);
  201|  1.68k|	this->public.hosts->destroy(this->public.hosts);
  202|  1.68k|	this->public.settings->destroy(this->public.settings);
  203|  1.68k|	this->public.credmgr->destroy(this->public.credmgr);
  204|  1.68k|	this->public.creds->destroy(this->public.creds);
  205|  1.68k|	this->public.encoding->destroy(this->public.encoding);
  206|  1.68k|	this->public.ocsp->destroy(this->public.ocsp);
  207|  1.68k|	this->public.metadata->destroy(this->public.metadata);
  208|  1.68k|	this->public.crypto->destroy(this->public.crypto);
  209|  1.68k|	this->public.caps->destroy(this->public.caps);
  210|  1.68k|	this->public.proposal->destroy(this->public.proposal);
  211|  1.68k|	this->public.fetcher->destroy(this->public.fetcher);
  212|  1.68k|	this->public.resolver->destroy(this->public.resolver);
  213|  1.68k|	this->public.db->destroy(this->public.db);
  214|  1.68k|	this->public.printf_hook->destroy(this->public.printf_hook);
  215|  1.68k|	this->objects->destroy(this->objects);
  216|  1.68k|	if (this->public.integrity)
  ------------------
  |  Branch (216:6): [True: 0, False: 1.68k]
  ------------------
  217|      0|	{
  218|      0|		this->public.integrity->destroy(this->public.integrity);
  219|      0|	}
  220|       |
  221|  1.68k|	if (lib->leak_detective)
  ------------------
  |  Branch (221:6): [True: 0, False: 1.68k]
  ------------------
  222|      0|	{
  223|      0|		lib->leak_detective->report(lib->leak_detective, detailed);
  224|      0|		lib->leak_detective->destroy(lib->leak_detective);
  225|      0|		lib->leak_detective = NULL;
  226|      0|	}
  227|       |#ifdef LEAK_DETECTIVE
  228|       |	if (this->ld_out && this->ld_out != stderr)
  229|       |	{
  230|       |		fclose(this->ld_out);
  231|       |	}
  232|       |#endif /* LEAK_DETECTIVE */
  233|       |
  234|  1.68k|	backtrace_deinit();
  235|  1.68k|	arrays_deinit();
  236|  1.68k|	utils_deinit();
  237|  1.68k|	threads_deinit();
  238|       |
  239|  1.68k|	free(this->public.conf);
  240|  1.68k|	free((void*)this->public.ns);
  241|  1.68k|	free(this);
  242|       |	lib = NULL;
  243|  1.68k|}
library_init:
  336|  1.68k|{
  337|  1.68k|	private_library_t *this;
  338|  1.68k|	printf_hook_t *pfh;
  339|  1.68k|	int i;
  340|       |
  341|  1.68k|	if (lib)
  ------------------
  |  Branch (341:6): [True: 0, False: 1.68k]
  ------------------
  342|      0|	{	/* already initialized, increase refcount */
  343|      0|		this = (private_library_t*)lib;
  344|      0|		ref_get(&this->ref);
  ------------------
  |  |   46|      0|#define ref_get(ref) __atomic_add_fetch(ref, 1, __ATOMIC_RELAXED)
  ------------------
  345|      0|		return !this->init_failed;
  346|      0|	}
  347|       |
  348|  1.68k|	chunk_hash_seed();
  349|       |
  350|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  8.43k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  |  |  ------------------
  |  |  |  Branch (45:39): [True: 1.68k, False: 0]
  |  |  |  Branch (45:39): [True: 0, False: 1.68k]
  |  |  |  Branch (45:39): [True: 0, False: 1.68k]
  |  |  ------------------
  ------------------
  351|  1.68k|		.public = {
  352|  1.68k|			.get = _get,
  353|  1.68k|			.set = _set,
  354|  1.68k|			.ns = strdup(namespace ?: "libstrongswan"),
  355|  1.68k|			.conf = strdupnull(settings ?: (getenv("STRONGSWAN_CONF") ?: STRONGSWAN_CONF)),
  356|  1.68k|		},
  357|  1.68k|		.ref = 1,
  358|  1.68k|	);
  359|  1.68k|	lib = &this->public;
  360|       |
  361|  1.68k|	threads_init();
  362|  1.68k|	utils_init();
  363|  1.68k|	arrays_init();
  364|  1.68k|	backtrace_init();
  365|       |
  366|       |#ifdef LEAK_DETECTIVE
  367|       |	{
  368|       |		FILE *out = NULL;
  369|       |		char *log;
  370|       |
  371|       |		log = getenv("LEAK_DETECTIVE_LOG");
  372|       |		if (log)
  373|       |		{
  374|       |			out = fopen(log, "a");
  375|       |		}
  376|       |		this->ld_out = out ?: stderr;
  377|       |	}
  378|       |	lib->leak_detective = leak_detective_create();
  379|       |	if (lib->leak_detective)
  380|       |	{
  381|       |		lib->leak_detective->set_report_cb(lib->leak_detective,
  382|       |										   report_leaks, sum_leaks, this);
  383|       |	}
  384|       |#endif /* LEAK_DETECTIVE */
  385|       |
  386|  1.68k|	pfh = printf_hook_create();
  387|  1.68k|	this->public.printf_hook = pfh;
  388|       |
  389|  1.68k|	pfh->add_handler(pfh, 'b', mem_printf_hook,
  390|  1.68k|					 PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_INT,
  391|  1.68k|					 PRINTF_HOOK_ARGTYPE_END);
  392|  1.68k|	pfh->add_handler(pfh, 'B', chunk_printf_hook,
  393|  1.68k|					 PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_END);
  394|  1.68k|	pfh->add_handler(pfh, 'H', host_printf_hook,
  395|  1.68k|					 PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_END);
  396|  1.68k|	pfh->add_handler(pfh, 'N', enum_printf_hook,
  397|  1.68k|					 PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_INT,
  398|  1.68k|					 PRINTF_HOOK_ARGTYPE_END);
  399|  1.68k|	pfh->add_handler(pfh, 'T', time_printf_hook,
  400|  1.68k|					 PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_INT,
  401|  1.68k|					 PRINTF_HOOK_ARGTYPE_END);
  402|  1.68k|	pfh->add_handler(pfh, 'V', time_delta_printf_hook,
  403|  1.68k|					 PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_POINTER,
  404|  1.68k|					 PRINTF_HOOK_ARGTYPE_END);
  405|  1.68k|	pfh->add_handler(pfh, 'Y', identification_printf_hook,
  406|  1.68k|					 PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_END);
  407|  1.68k|	pfh->add_handler(pfh, 'R', traffic_selector_printf_hook,
  408|  1.68k|					 PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_END);
  409|  1.68k|	pfh->add_handler(pfh, 'P', proposal_printf_hook,
  410|  1.68k|					 PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_END);
  411|       |
  412|  1.68k|	this->objects = hashtable_create((hashtable_hash_t)hash,
  413|  1.68k|									 (hashtable_equals_t)equals, 4);
  414|       |
  415|  1.68k|	this->public.settings = settings_create(NULL);
  416|  1.68k|	if (!this->public.settings->load_files(this->public.settings,
  ------------------
  |  Branch (416:6): [True: 1.68k, False: 0]
  ------------------
  417|  1.68k|										   this->public.conf, FALSE))
  ------------------
  |  |   41|  1.68k|# define FALSE false
  ------------------
  418|  1.68k|	{
  419|  1.68k|		DBG1(DBG_LIB, "abort initialization due to invalid configuration");
  ------------------
  |  |  133|  1.68k|# define DBG1(...) {}
  ------------------
  420|  1.68k|		this->init_failed = TRUE;
  ------------------
  |  |   44|  1.68k|# define TRUE  true
  ------------------
  421|  1.68k|	}
  422|       |
  423|       |	/* add registered aliases */
  424|  1.68k|	for (i = 0; i < ns_count; ++i)
  ------------------
  |  Branch (424:14): [True: 0, False: 1.68k]
  ------------------
  425|      0|	{
  426|      0|		lib->settings->add_fallback(lib->settings, lib->ns, namespaces[i]);
  427|      0|	}
  428|       |	/* all namespace settings may fall back to libstrongswan */
  429|  1.68k|	lib->settings->add_fallback(lib->settings, lib->ns, "libstrongswan");
  430|       |
  431|  1.68k|	this->public.hosts = host_resolver_create();
  432|  1.68k|	this->public.proposal = proposal_keywords_create();
  433|  1.68k|	this->public.caps = capabilities_create();
  434|  1.68k|	this->public.crypto = crypto_factory_create();
  435|  1.68k|	this->public.creds = credential_factory_create();
  436|  1.68k|	this->public.credmgr = credential_manager_create();
  437|  1.68k|	this->public.encoding = cred_encoding_create();
  438|  1.68k|	this->public.ocsp = ocsp_responders_create();
  439|  1.68k|	this->public.metadata = metadata_factory_create();
  440|  1.68k|	this->public.fetcher = fetcher_manager_create();
  441|  1.68k|	this->public.resolver = resolver_manager_create();
  442|  1.68k|	this->public.db = database_factory_create();
  443|  1.68k|	this->public.processor = processor_create();
  444|  1.68k|	this->public.scheduler = scheduler_create();
  445|  1.68k|	this->public.watcher = watcher_create();
  446|  1.68k|	this->public.streams = stream_manager_create();
  447|  1.68k|	this->public.plugins = plugin_loader_create();
  448|       |
  449|       |#ifndef NO_CHECK_MEMWIPE
  450|       |	if (!check_memwipe())
  451|       |	{
  452|       |		return FALSE;
  453|       |	}
  454|       |#endif
  455|       |
  456|  1.68k|	if (lib->settings->get_bool(lib->settings,
  ------------------
  |  Branch (456:6): [True: 0, False: 1.68k]
  ------------------
  457|  1.68k|								"%s.integrity_test", FALSE, lib->ns))
  ------------------
  |  |   41|  1.68k|# define FALSE false
  ------------------
  458|      0|	{
  459|       |#ifdef INTEGRITY_TEST
  460|       |		this->public.integrity = integrity_checker_create(CHECKSUM_LIBRARY);
  461|       |		if (!lib->integrity->check(lib->integrity, "libstrongswan", library_init))
  462|       |		{
  463|       |			DBG1(DBG_LIB, "integrity check of libstrongswan failed");
  464|       |			this->init_failed = TRUE;
  465|       |		}
  466|       |#else /* !INTEGRITY_TEST */
  467|      0|		DBG1(DBG_LIB, "integrity test enabled, but not supported");
  ------------------
  |  |  133|      0|# define DBG1(...) {}
  ------------------
  468|      0|		this->init_failed = TRUE;
  ------------------
  |  |   44|      0|# define TRUE  true
  ------------------
  469|      0|#endif /* INTEGRITY_TEST */
  470|      0|	}
  471|       |
  472|  1.68k|	key_exchange_init();
  473|       |
  474|  1.68k|	for (i = 0; i < init_function_count; ++i)
  ------------------
  |  Branch (474:14): [True: 0, False: 1.68k]
  ------------------
  475|      0|	{
  476|      0|		if (!init_functions[i](TRUE))
  ------------------
  |  |   44|      0|# define TRUE  true
  ------------------
  |  Branch (476:7): [True: 0, False: 0]
  ------------------
  477|      0|		{
  478|       |			this->init_failed = TRUE;
  ------------------
  |  |   44|      0|# define TRUE  true
  ------------------
  479|      0|		}
  480|      0|	}
  481|  1.68k|	return !this->init_failed;
  482|  1.68k|}

metadata_factory_create:
  103|  1.68k|{
  104|  1.68k|	private_metadata_factory_t *this;
  105|       |
  106|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  107|  1.68k|		.public = {
  108|  1.68k|			.create = _create,
  109|  1.68k|			.register_type = _register_type,
  110|  1.68k|			.destroy = _destroy,
  111|  1.68k|		},
  112|  1.68k|		.types = hashtable_create(hashtable_hash_str, hashtable_equals_str, 0),
  113|  1.68k|	);
  114|       |
  115|       |	/* register pre-defined types */
  116|  1.68k|	register_type(this, METADATA_TYPE_INT, metadata_create_int);
  ------------------
  |  |   39|  1.68k|#define METADATA_TYPE_INT "int"
  ------------------
  117|  1.68k|	register_type(this, METADATA_TYPE_UINT64, metadata_create_int);
  ------------------
  |  |   46|  1.68k|#define METADATA_TYPE_UINT64 "uint64"
  ------------------
  118|       |
  119|  1.68k|	return &this->public;
  120|  1.68k|}
metadata_factory.c:destroy:
   97|  1.68k|{
   98|  1.68k|	this->types->destroy_function(this->types, (void*)destroy_entry);
   99|  1.68k|	free(this);
  100|  1.68k|}
metadata_factory.c:destroy_entry:
   56|  6.74k|{
   57|  6.74k|	if (this)
  ------------------
  |  Branch (57:6): [True: 3.37k, False: 3.37k]
  ------------------
   58|  3.37k|	{
   59|  3.37k|		free(this->type);
   60|  3.37k|		free(this);
   61|  3.37k|	}
   62|  6.74k|}
metadata_factory.c:register_type:
   84|  3.37k|{
   85|  3.37k|	entry_t *entry;
   86|       |
   87|  3.37k|	INIT(entry,
  ------------------
  |  |   44|  3.37k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  3.37k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
   88|  3.37k|		.type = strdup(type),
   89|  3.37k|		.create = create,
   90|  3.37k|	);
   91|       |
   92|  3.37k|	destroy_entry(this->types->put(this->types, entry->type, entry));
   93|  3.37k|}

host_resolver_create:
  357|  1.68k|{
  358|  1.68k|	private_host_resolver_t *this;
  359|       |
  360|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  361|  1.68k|		.public = {
  362|  1.68k|			.resolve = _resolve,
  363|  1.68k|			.flush = _flush,
  364|  1.68k|			.destroy = _destroy,
  365|  1.68k|		},
  366|  1.68k|		.queries = hashtable_create((hashtable_hash_t)query_hash,
  367|  1.68k|									(hashtable_equals_t)query_equals, 8),
  368|  1.68k|		.queue = linked_list_create(),
  369|  1.68k|		.pool = linked_list_create(),
  370|  1.68k|		.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
  371|  1.68k|		.new_query = condvar_create(CONDVAR_TYPE_DEFAULT),
  372|  1.68k|	);
  373|       |
  374|  1.68k|	this->min_threads = max(0, lib->settings->get_int(lib->settings,
  ------------------
  |  |   29|  1.68k|#define max(x,y) ({ \
  |  |   30|  1.68k|	typeof(x) _x = (x); \
  |  |   31|  1.68k|	typeof(y) _y = (y); \
  |  |   32|  1.68k|	_x > _y ? _x : _y; })
  |  |  ------------------
  |  |  |  Branch (32:2): [True: 0, False: 1.68k]
  |  |  ------------------
  ------------------
  375|  1.68k|												"%s.host_resolver.min_threads",
  376|  1.68k|												MIN_THREADS_DEFAULT, lib->ns));
  377|  1.68k|	this->max_threads = max(this->min_threads ?: 1,
  ------------------
  |  |   29|  1.68k|#define max(x,y) ({ \
  |  |   30|  3.37k|	typeof(x) _x = (x); \
  |  |  ------------------
  |  |  |  Branch (30:18): [True: 0, False: 1.68k]
  |  |  ------------------
  |  |   31|  1.68k|	typeof(y) _y = (y); \
  |  |   32|  1.68k|	_x > _y ? _x : _y; })
  |  |  ------------------
  |  |  |  Branch (32:2): [True: 0, False: 1.68k]
  |  |  ------------------
  ------------------
  378|  1.68k|							lib->settings->get_int(lib->settings,
  379|  1.68k|												"%s.host_resolver.max_threads",
  380|  1.68k|												MAX_THREADS_DEFAULT, lib->ns));
  381|  1.68k|	return &this->public;
  382|  1.68k|}
host_resolver.c:flush:
  314|  1.68k|{
  315|  1.68k|	enumerator_t *enumerator;
  316|  1.68k|	query_t *query;
  317|       |
  318|  1.68k|	this->mutex->lock(this->mutex);
  319|  1.68k|	enumerator = this->queries->create_enumerator(this->queries);
  320|  1.68k|	while (enumerator->enumerate(enumerator, &query, NULL))
  ------------------
  |  Branch (320:9): [True: 0, False: 1.68k]
  ------------------
  321|      0|	{	/* use the hashtable here as we also want to signal dequeued queries */
  322|      0|		this->queries->remove_at(this->queries, enumerator);
  323|      0|		query->done->broadcast(query->done);
  324|      0|	}
  325|  1.68k|	enumerator->destroy(enumerator);
  326|  1.68k|	this->queue->destroy_function(this->queue, (void*)query_destroy);
  327|  1.68k|	this->queue = linked_list_create();
  328|  1.68k|	this->disabled = TRUE;
  ------------------
  |  |   44|  1.68k|# define TRUE  true
  ------------------
  329|       |	/* this will already terminate most idle threads */
  330|  1.68k|	this->new_query->broadcast(this->new_query);
  331|  1.68k|	this->mutex->unlock(this->mutex);
  332|  1.68k|}
host_resolver.c:destroy:
  336|  1.68k|{
  337|  1.68k|	thread_t *thread;
  338|       |
  339|  1.68k|	flush(this);
  340|  1.68k|	this->pool->invoke_offset(this->pool, offsetof(thread_t, cancel));
  341|  1.68k|	while (this->pool->remove_first(this->pool, (void**)&thread) == SUCCESS)
  ------------------
  |  Branch (341:9): [True: 0, False: 1.68k]
  ------------------
  342|      0|	{
  343|      0|		thread->join(thread);
  344|      0|	}
  345|  1.68k|	this->pool->destroy(this->pool);
  346|  1.68k|	this->queue->destroy(this->queue);
  347|  1.68k|	this->queries->destroy(this->queries);
  348|  1.68k|	this->new_query->destroy(this->new_query);
  349|  1.68k|	this->mutex->destroy(this->mutex);
  350|  1.68k|	free(this);
  351|  1.68k|}

stream_manager_create:
  235|  1.68k|{
  236|  1.68k|	private_stream_manager_t *this;
  237|       |
  238|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  239|  1.68k|		.public = {
  240|  1.68k|			.connect = _connect_,
  241|  1.68k|			.create_service = _create_service,
  242|  1.68k|			.add_stream = _add_stream,
  243|  1.68k|			.remove_stream = _remove_stream,
  244|  1.68k|			.add_service = _add_service,
  245|  1.68k|			.remove_service = _remove_service,
  246|  1.68k|			.destroy = _destroy,
  247|  1.68k|		},
  248|  1.68k|		.streams = linked_list_create(),
  249|  1.68k|		.services = linked_list_create(),
  250|  1.68k|		.lock = rwlock_create(RWLOCK_TYPE_DEFAULT),
  251|  1.68k|	);
  252|       |
  253|  1.68k|	add_stream(this, "tcp://", stream_create_tcp);
  254|  1.68k|	add_service(this, "tcp://", stream_service_create_tcp);
  255|  1.68k|#ifndef WIN32
  256|  1.68k|	add_stream(this, "unix://", stream_create_unix);
  257|  1.68k|	add_service(this, "unix://", stream_service_create_unix);
  258|  1.68k|#endif
  259|  1.68k|#ifdef HAVE_LINUX_VM_SOCKETS_H
  260|  1.68k|	add_stream(this, "vsock://", stream_create_vsock);
  261|  1.68k|	add_service(this, "vsock://", stream_service_create_vsock);
  262|  1.68k|#endif
  263|       |#ifdef USE_SYSTEMD
  264|       |	add_service(this, "systemd://", stream_service_create_systemd);
  265|       |#endif
  266|       |
  267|  1.68k|	return &this->public;
  268|  1.68k|}
stream_manager.c:remove_stream:
  152|  5.05k|{
  153|  5.05k|	enumerator_t *enumerator;
  154|  5.05k|	stream_entry_t *entry;
  155|       |
  156|  5.05k|	this->lock->write_lock(this->lock);
  157|  5.05k|	enumerator = this->streams->create_enumerator(this->streams);
  158|  15.1k|	while (enumerator->enumerate(enumerator, &entry))
  ------------------
  |  Branch (158:9): [True: 10.1k, False: 5.05k]
  ------------------
  159|  10.1k|	{
  160|  10.1k|		if (entry->create == create)
  ------------------
  |  Branch (160:7): [True: 5.05k, False: 5.05k]
  ------------------
  161|  5.05k|		{
  162|  5.05k|			this->streams->remove_at(this->streams, enumerator);
  163|  5.05k|			free(entry->prefix);
  164|  5.05k|			free(entry);
  165|  5.05k|		}
  166|  10.1k|	}
  167|  5.05k|	enumerator->destroy(enumerator);
  168|  5.05k|	this->lock->unlock(this->lock);
  169|  5.05k|}
stream_manager.c:remove_service:
  189|  5.05k|{
  190|  5.05k|	enumerator_t *enumerator;
  191|  5.05k|	service_entry_t *entry;
  192|       |
  193|  5.05k|	this->lock->write_lock(this->lock);
  194|  5.05k|	enumerator = this->services->create_enumerator(this->services);
  195|  15.1k|	while (enumerator->enumerate(enumerator, &entry))
  ------------------
  |  Branch (195:9): [True: 10.1k, False: 5.05k]
  ------------------
  196|  10.1k|	{
  197|  10.1k|		if (entry->create == create)
  ------------------
  |  Branch (197:7): [True: 5.05k, False: 5.05k]
  ------------------
  198|  5.05k|		{
  199|  5.05k|			this->services->remove_at(this->services, enumerator);
  200|  5.05k|			free(entry->prefix);
  201|  5.05k|			free(entry);
  202|  5.05k|		}
  203|  10.1k|	}
  204|  5.05k|	enumerator->destroy(enumerator);
  205|  5.05k|	this->lock->unlock(this->lock);
  206|  5.05k|}
stream_manager.c:destroy:
  210|  1.68k|{
  211|  1.68k|	remove_stream(this, stream_create_tcp);
  212|  1.68k|	remove_service(this, stream_service_create_tcp);
  213|  1.68k|#ifndef WIN32
  214|  1.68k|	remove_stream(this, stream_create_unix);
  215|  1.68k|	remove_service(this, stream_service_create_unix);
  216|  1.68k|#endif
  217|  1.68k|#ifdef HAVE_LINUX_VM_SOCKETS_H
  218|  1.68k|	remove_stream(this, stream_create_vsock);
  219|  1.68k|	remove_service(this, stream_service_create_vsock);
  220|  1.68k|#endif
  221|       |#ifdef USE_SYSTEMD
  222|       |	remove_service(this, stream_service_create_systemd);
  223|       |#endif
  224|       |
  225|  1.68k|	this->streams->destroy(this->streams);
  226|  1.68k|	this->services->destroy(this->services);
  227|  1.68k|	this->lock->destroy(this->lock);
  228|  1.68k|	free(this);
  229|  1.68k|}
stream_manager.c:add_stream:
  137|  5.05k|{
  138|  5.05k|	stream_entry_t *entry;
  139|       |
  140|  5.05k|	INIT(entry,
  ------------------
  |  |   44|  5.05k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  5.05k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  141|  5.05k|		.prefix = strdup(prefix),
  142|  5.05k|		.create = create,
  143|  5.05k|	);
  144|       |
  145|  5.05k|	this->lock->write_lock(this->lock);
  146|  5.05k|	this->streams->insert_last(this->streams, entry);
  147|  5.05k|	this->lock->unlock(this->lock);
  148|  5.05k|}
stream_manager.c:add_service:
  174|  5.05k|{
  175|  5.05k|	service_entry_t *entry;
  176|       |
  177|  5.05k|	INIT(entry,
  ------------------
  |  |   44|  5.05k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  5.05k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  178|  5.05k|		.prefix = strdup(prefix),
  179|  5.05k|		.create = create,
  180|  5.05k|	);
  181|       |
  182|  5.05k|	this->lock->write_lock(this->lock);
  183|  5.05k|	this->services->insert_last(this->services, entry);
  184|  5.05k|	this->lock->unlock(this->lock);
  185|  5.05k|}

pb_tnc_batch.c:pen_type_create:
   74|  89.5k|{
   75|  89.5k|	pen_type_t pen_type = { vendor_id, type };
   76|  89.5k|	return pen_type;
   77|  89.5k|}

library.c:register_plugins:
   30|      2|{
   31|      2|	plugin_constructor_register("random", random_plugin_create);
   32|      2|	plugin_constructor_register("nonce", nonce_plugin_create);
   33|      2|	plugin_constructor_register("x509", x509_plugin_create);
   34|      2|	plugin_constructor_register("revocation", revocation_plugin_create);
   35|      2|	plugin_constructor_register("constraints", constraints_plugin_create);
   36|      2|	plugin_constructor_register("pubkey", pubkey_plugin_create);
   37|      2|	plugin_constructor_register("pkcs1", pkcs1_plugin_create);
   38|      2|	plugin_constructor_register("pkcs7", pkcs7_plugin_create);
   39|      2|	plugin_constructor_register("pgp", pgp_plugin_create);
   40|      2|	plugin_constructor_register("dnskey", dnskey_plugin_create);
   41|      2|	plugin_constructor_register("sshkey", sshkey_plugin_create);
   42|      2|	plugin_constructor_register("pem", pem_plugin_create);
   43|      2|	plugin_constructor_register("openssl", openssl_plugin_create);
   44|      2|	plugin_constructor_register("pkcs8", pkcs8_plugin_create);
   45|      2|	plugin_constructor_register("xcbc", xcbc_plugin_create);
   46|      2|	plugin_constructor_register("cmac", cmac_plugin_create);
   47|      2|	plugin_constructor_register("kdf", kdf_plugin_create);
   48|      2|	plugin_constructor_register("drbg", drbg_plugin_create);
   49|      2|}

plugin_constructor_register:
  326|     36|{
  327|     36|	bool old = FALSE;
  ------------------
  |  |   41|     36|# define FALSE false
  ------------------
  328|       |
  329|     36|	if (lib && lib->leak_detective)
  ------------------
  |  Branch (329:6): [True: 0, False: 36]
  |  Branch (329:13): [True: 0, False: 0]
  ------------------
  330|      0|	{
  331|      0|		old = lib->leak_detective->set_state(lib->leak_detective, FALSE);
  ------------------
  |  |   41|      0|# define FALSE false
  ------------------
  332|      0|	}
  333|       |
  334|     36|	if (!plugin_constructors)
  ------------------
  |  Branch (334:6): [True: 2, False: 34]
  ------------------
  335|      2|	{
  336|      2|		chunk_hash_seed();
  337|      2|		plugin_constructors = hashtable_create(hashtable_hash_str,
  338|      2|											   hashtable_equals_str, 32);
  339|      2|	}
  340|     36|	if (constructor)
  ------------------
  |  Branch (340:6): [True: 36, False: 0]
  ------------------
  341|     36|	{
  342|     36|		plugin_constructors->put(plugin_constructors, name, constructor);
  343|     36|	}
  344|      0|	else
  345|      0|	{
  346|      0|		plugin_constructors->remove(plugin_constructors, name);
  347|      0|		if (!plugin_constructors->get_count(plugin_constructors))
  ------------------
  |  Branch (347:7): [True: 0, False: 0]
  ------------------
  348|      0|		{
  349|      0|			plugin_constructors->destroy(plugin_constructors);
  350|      0|			plugin_constructors = NULL;
  351|      0|		}
  352|      0|	}
  353|       |
  354|     36|	if (lib && lib->leak_detective)
  ------------------
  |  Branch (354:6): [True: 0, False: 36]
  |  Branch (354:13): [True: 0, False: 0]
  ------------------
  355|      0|	{
  356|      0|		lib->leak_detective->set_state(lib->leak_detective, old);
  357|      0|	}
  358|     36|}
plugin_loader_create:
 1517|  1.68k|{
 1518|  1.68k|	private_plugin_loader_t *this;
 1519|       |
 1520|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
 1521|  1.68k|		.public = {
 1522|  1.68k|			.add_static_features = _add_static_features,
 1523|  1.68k|			.load = _load_plugins,
 1524|  1.68k|			.add_path = _add_path,
 1525|  1.68k|			.reload = _reload,
 1526|  1.68k|			.unload = _unload,
 1527|  1.68k|			.create_plugin_enumerator = _create_plugin_enumerator,
 1528|  1.68k|			.has_feature = _has_feature,
 1529|  1.68k|			.loaded_plugins = _loaded_plugins,
 1530|  1.68k|			.status = _status,
 1531|  1.68k|			.destroy = _destroy,
 1532|  1.68k|		},
 1533|  1.68k|		.plugins = linked_list_create(),
 1534|  1.68k|		.loaded = linked_list_create(),
 1535|  1.68k|		.features = hashlist_create(
 1536|  1.68k|							(hashtable_hash_t)registered_feature_hash,
 1537|  1.68k|							(hashtable_equals_t)registered_feature_equals, 64),
 1538|  1.68k|	);
 1539|       |
 1540|  1.68k|#ifdef HAVE_DLADDR
 1541|  1.68k|	this->get_features = dlsym(RTLD_DEFAULT, "plugin_loader_feature_filter");
 1542|  1.68k|#endif
 1543|       |
 1544|  1.68k|	if (!this->get_features)
  ------------------
  |  Branch (1544:6): [True: 1.68k, False: 0]
  ------------------
 1545|  1.68k|	{
 1546|  1.68k|		this->get_features = get_features_default;
 1547|  1.68k|	}
 1548|       |
 1549|  1.68k|	return &this->public;
 1550|  1.68k|}
plugin_loader.c:unload:
 1402|  1.68k|{
 1403|  1.68k|	plugin_entry_t *entry;
 1404|       |
 1405|       |	/* unload features followed by plugins, in reverse order */
 1406|  1.68k|	unload_features(this);
 1407|  1.68k|	while (this->plugins->remove_last(this->plugins, (void**)&entry) == SUCCESS)
  ------------------
  |  Branch (1407:9): [True: 0, False: 1.68k]
  ------------------
 1408|      0|	{
 1409|      0|#ifdef HAVE_DLADDR
 1410|      0|		if (lib->leak_detective)
  ------------------
  |  Branch (1410:7): [True: 0, False: 0]
  ------------------
 1411|      0|		{	/* keep handle to report leaks properly */
 1412|      0|			entry->handle = NULL;
 1413|      0|		}
 1414|      0|#endif
 1415|      0|		unregister_features(this, entry);
 1416|      0|		plugin_entry_destroy(entry);
 1417|      0|	}
 1418|  1.68k|	free(this->loaded_plugins);
 1419|  1.68k|	this->loaded_plugins = NULL;
 1420|  1.68k|	memset(&this->stats, 0, sizeof(this->stats));
  ------------------
  |  |   92|  1.68k|#define memset(s,c,n) memset_noop(s,c,n)
  ------------------
 1421|  1.68k|}
plugin_loader.c:unload_features:
 1383|  1.68k|{
 1384|  1.68k|	enumerator_t *enumerator;
 1385|  1.68k|	provided_feature_t *provided;
 1386|  1.68k|	plugin_entry_t *entry;
 1387|       |
 1388|  1.68k|	enumerator = this->loaded->create_enumerator(this->loaded);
 1389|  1.68k|	while (enumerator->enumerate(enumerator, &provided))
  ------------------
  |  Branch (1389:9): [True: 0, False: 1.68k]
  ------------------
 1390|      0|	{
 1391|      0|		entry = provided->entry;
 1392|      0|		plugin_feature_unload(entry->plugin, provided->feature, provided->reg);
 1393|      0|		this->loaded->remove_at(this->loaded, enumerator);
 1394|       |		entry->features->remove(entry->features, provided, NULL);
 1395|      0|		unregister_feature(this, provided);
 1396|      0|	}
 1397|  1.68k|	enumerator->destroy(enumerator);
 1398|  1.68k|}
plugin_loader.c:destroy:
 1503|  1.68k|{
 1504|  1.68k|	unload(this);
 1505|  1.68k|	this->features->destroy(this->features);
 1506|  1.68k|	this->loaded->destroy(this->loaded);
 1507|  1.68k|	this->plugins->destroy(this->plugins);
 1508|  1.68k|	DESTROY_FUNCTION_IF(this->paths, free);
  ------------------
  |  |   39|  1.68k|#define DESTROY_FUNCTION_IF(obj, fn) if (obj) obj->destroy_function(obj, fn)
  |  |  ------------------
  |  |  |  Branch (39:42): [True: 0, False: 1.68k]
  |  |  ------------------
  ------------------
 1509|  1.68k|	free(this->loaded_plugins);
 1510|  1.68k|	free(this);
 1511|  1.68k|}

callback_job_create_with_prio:
   98|  1.68k|{
   99|  1.68k|	private_callback_job_t *this;
  100|       |
  101|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  102|  1.68k|		.public = {
  103|  1.68k|			.job = {
  104|  1.68k|				.execute = _execute,
  105|  1.68k|				.get_priority = _get_priority,
  106|  1.68k|				.destroy = _destroy,
  107|  1.68k|			},
  108|  1.68k|		},
  109|  1.68k|		.callback = cb,
  110|  1.68k|		.data = data,
  111|  1.68k|		.cleanup = cleanup,
  112|  1.68k|		.cancel = cancel,
  113|  1.68k|		.prio = prio,
  114|  1.68k|	);
  115|       |
  116|  1.68k|	if (cancel)
  ------------------
  |  Branch (116:6): [True: 1.68k, False: 0]
  ------------------
  117|  1.68k|	{
  118|  1.68k|		this->public.job.cancel = _cancel;
  119|  1.68k|	}
  120|       |
  121|  1.68k|	return &this->public;
  122|  1.68k|}
callback_job.c:get_priority:
   88|  1.68k|{
   89|  1.68k|	return this->prio;
   90|  1.68k|}
callback_job.c:destroy:
   66|  1.68k|{
   67|  1.68k|	if (this->cleanup)
  ------------------
  |  Branch (67:6): [True: 0, False: 1.68k]
  ------------------
   68|      0|	{
   69|      0|		this->cleanup(this->data);
   70|      0|	}
   71|  1.68k|	free(this);
   72|  1.68k|}

processor_create:
  539|  1.68k|{
  540|  1.68k|	private_processor_t *this;
  541|  1.68k|	int i;
  542|       |
  543|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  544|  1.68k|		.public = {
  545|  1.68k|			.get_total_threads = _get_total_threads,
  546|  1.68k|			.get_idle_threads = _get_idle_threads,
  547|  1.68k|			.get_working_threads = _get_working_threads,
  548|  1.68k|			.get_job_load = _get_job_load,
  549|  1.68k|			.queue_job = _queue_job,
  550|  1.68k|			.execute_job = _execute_job,
  551|  1.68k|			.set_threads = _set_threads,
  552|  1.68k|			.cancel = _cancel,
  553|  1.68k|			.destroy = _destroy,
  554|  1.68k|		},
  555|  1.68k|		.threads = linked_list_create(),
  556|  1.68k|		.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
  557|  1.68k|		.job_added = condvar_create(CONDVAR_TYPE_DEFAULT),
  558|  1.68k|		.thread_terminated = condvar_create(CONDVAR_TYPE_DEFAULT),
  559|  1.68k|	);
  560|       |
  561|  8.43k|	for (i = 0; i < JOB_PRIO_MAX; i++)
  ------------------
  |  Branch (561:14): [True: 6.74k, False: 1.68k]
  ------------------
  562|  6.74k|	{
  563|  6.74k|		this->jobs[i] = linked_list_create();
  564|  6.74k|	}
  565|  1.68k|	return &this->public;
  566|  1.68k|}
processor.c:sane_prio:
  357|  1.68k|{
  358|  1.68k|	if ((int)prio < 0 || prio >= JOB_PRIO_MAX)
  ------------------
  |  Branch (358:6): [True: 0, False: 1.68k]
  |  Branch (358:23): [True: 0, False: 1.68k]
  ------------------
  359|      0|	{
  360|      0|		return JOB_PRIO_MAX - 1;
  361|      0|	}
  362|  1.68k|	return prio;
  363|  1.68k|}
processor.c:queue_job:
  390|  1.68k|{
  391|  1.68k|	job_priority_t prio;
  392|       |
  393|  1.68k|	prio = sane_prio(job->get_priority(job));
  394|  1.68k|	job->status = JOB_STATUS_QUEUED;
  395|       |
  396|  1.68k|	this->mutex->lock(this->mutex);
  397|  1.68k|	this->jobs[prio]->insert_last(this->jobs[prio], job);
  398|  1.68k|	this->job_added->signal(this->job_added);
  399|  1.68k|	this->mutex->unlock(this->mutex);
  400|  1.68k|}
processor.c:cancel:
  473|  1.68k|{
  474|  1.68k|	enumerator_t *enumerator;
  475|  1.68k|	worker_thread_t *worker;
  476|  1.68k|	job_t *job;
  477|  1.68k|	int i;
  478|       |
  479|  1.68k|	this->mutex->lock(this->mutex);
  480|  1.68k|	this->desired_threads = 0;
  481|       |	/* cancel potentially blocking jobs */
  482|  1.68k|	enumerator = this->threads->create_enumerator(this->threads);
  483|  1.68k|	while (enumerator->enumerate(enumerator, (void**)&worker))
  ------------------
  |  Branch (483:9): [True: 0, False: 1.68k]
  ------------------
  484|      0|	{
  485|      0|		if (worker->job && worker->job->cancel)
  ------------------
  |  Branch (485:7): [True: 0, False: 0]
  |  Branch (485:22): [True: 0, False: 0]
  ------------------
  486|      0|		{
  487|      0|			worker->job->status = JOB_STATUS_CANCELED;
  488|      0|			if (!worker->job->cancel(worker->job))
  ------------------
  |  Branch (488:8): [True: 0, False: 0]
  ------------------
  489|      0|			{	/* job requests to be canceled explicitly, otherwise we assume
  490|       |				 * the thread terminates itself and can be joined */
  491|      0|				worker->thread->cancel(worker->thread);
  492|      0|			}
  493|      0|		}
  494|      0|	}
  495|  1.68k|	enumerator->destroy(enumerator);
  496|  1.68k|	while (this->total_threads > 0)
  ------------------
  |  Branch (496:9): [True: 0, False: 1.68k]
  ------------------
  497|      0|	{
  498|      0|		this->job_added->broadcast(this->job_added);
  499|      0|		this->thread_terminated->wait(this->thread_terminated, this->mutex);
  500|      0|	}
  501|  1.68k|	while (this->threads->remove_first(this->threads,
  ------------------
  |  Branch (501:9): [True: 0, False: 1.68k]
  ------------------
  502|  1.68k|									  (void**)&worker) == SUCCESS)
  503|      0|	{
  504|      0|		worker->thread->join(worker->thread);
  505|      0|		free(worker);
  506|      0|	}
  507|  8.43k|	for (i = 0; i < JOB_PRIO_MAX; i++)
  ------------------
  |  Branch (507:14): [True: 6.74k, False: 1.68k]
  ------------------
  508|  6.74k|	{
  509|  8.43k|		while (this->jobs[i]->remove_first(this->jobs[i],
  ------------------
  |  Branch (509:10): [True: 1.68k, False: 6.74k]
  ------------------
  510|  8.43k|										   (void**)&job) == SUCCESS)
  511|  1.68k|		{
  512|  1.68k|			job->destroy(job);
  513|  1.68k|		}
  514|  6.74k|	}
  515|  1.68k|	this->mutex->unlock(this->mutex);
  516|  1.68k|}
processor.c:destroy:
  520|  1.68k|{
  521|  1.68k|	int i;
  522|       |
  523|  1.68k|	cancel(this);
  524|  1.68k|	this->thread_terminated->destroy(this->thread_terminated);
  525|  1.68k|	this->job_added->destroy(this->job_added);
  526|  1.68k|	this->mutex->destroy(this->mutex);
  527|  8.43k|	for (i = 0; i < JOB_PRIO_MAX; i++)
  ------------------
  |  Branch (527:14): [True: 6.74k, False: 1.68k]
  ------------------
  528|  6.74k|	{
  529|  6.74k|		this->jobs[i]->destroy(this->jobs[i]);
  530|  6.74k|	}
  531|  1.68k|	this->threads->destroy(this->threads);
  532|  1.68k|	free(this);
  533|  1.68k|}

scheduler_create:
  311|  1.68k|{
  312|  1.68k|	private_scheduler_t *this;
  313|  1.68k|	callback_job_t *job;
  314|       |
  315|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  316|  1.68k|		.public = {
  317|  1.68k|			.get_job_load = _get_job_load,
  318|  1.68k|			.schedule_job = _schedule_job,
  319|  1.68k|			.schedule_job_ms = _schedule_job_ms,
  320|  1.68k|			.schedule_job_tv = _schedule_job_tv,
  321|  1.68k|			.flush = _flush,
  322|  1.68k|			.destroy = _destroy,
  323|  1.68k|		},
  324|  1.68k|		.heap_size = HEAP_SIZE_DEFAULT,
  325|  1.68k|		.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
  326|  1.68k|		.condvar = condvar_create(CONDVAR_TYPE_DEFAULT),
  327|  1.68k|	);
  328|       |
  329|  1.68k|	this->heap = (event_t**)calloc(this->heap_size + 1, sizeof(event_t*));
  330|       |
  331|  1.68k|	job = callback_job_create_with_prio((callback_job_cb_t)schedule, this,
  332|  1.68k|										NULL, callback_job_cancel_thread,
  333|  1.68k|										JOB_PRIO_CRITICAL);
  334|  1.68k|	lib->processor->queue_job(lib->processor, (job_t*)job);
  335|       |
  336|  1.68k|	return &this->public;
  337|  1.68k|}
scheduler.c:flush:
  285|  1.68k|{
  286|  1.68k|	event_t *event;
  287|       |
  288|  1.68k|	this->mutex->lock(this->mutex);
  289|  1.68k|	while ((event = remove_event(this)) != NULL)
  ------------------
  |  Branch (289:9): [True: 0, False: 1.68k]
  ------------------
  290|      0|	{
  291|      0|		event_destroy(event);
  292|      0|	}
  293|  1.68k|	this->condvar->signal(this->condvar);
  294|  1.68k|	this->mutex->unlock(this->mutex);
  295|  1.68k|}
scheduler.c:remove_event:
  110|  1.68k|{
  111|  1.68k|	event_t *event, *top;
  112|       |
  113|  1.68k|	if (!this->event_count)
  ------------------
  |  Branch (113:6): [True: 1.68k, False: 0]
  ------------------
  114|  1.68k|	{
  115|  1.68k|		return NULL;
  116|  1.68k|	}
  117|       |
  118|       |	/* store the value to return */
  119|      0|	event = this->heap[1];
  120|       |	/* move the bottom event to the top */
  121|      0|	top = this->heap[1] = this->heap[this->event_count];
  122|       |
  123|      0|	if (--this->event_count > 1)
  ------------------
  |  Branch (123:6): [True: 0, False: 0]
  ------------------
  124|      0|	{
  125|      0|		u_int position = 1;
  126|       |
  127|       |		/* seep down the top event */
  128|      0|		while ((position << 1) <= this->event_count)
  ------------------
  |  Branch (128:10): [True: 0, False: 0]
  ------------------
  129|      0|		{
  130|      0|			u_int child = position << 1;
  131|       |
  132|      0|			if ((child + 1) <= this->event_count &&
  ------------------
  |  Branch (132:8): [True: 0, False: 0]
  ------------------
  133|      0|				timercmp(&this->heap[child + 1]->time,
  ------------------
  |  Branch (133:5): [True: 0, False: 0]
  |  Branch (133:5): [True: 0, False: 0]
  ------------------
  134|      0|						 &this->heap[child]->time, <))
  135|      0|			{
  136|       |				/* the "right" child is smaller */
  137|      0|				child++;
  138|      0|			}
  139|       |
  140|      0|			if (!timercmp(&top->time, &this->heap[child]->time, >))
  ------------------
  |  Branch (140:8): [True: 0, False: 0]
  |  Branch (140:9): [True: 0, False: 0]
  ------------------
  141|      0|			{
  142|       |				/* the top event fires before the smaller of the two children,
  143|       |				 * stop */
  144|      0|				break;
  145|      0|			}
  146|       |
  147|       |			/* swap with the smaller child */
  148|      0|			this->heap[position] = this->heap[child];
  149|      0|			position = child;
  150|      0|		}
  151|      0|		this->heap[position] = top;
  152|      0|	}
  153|      0|	return event;
  154|  1.68k|}
scheduler.c:destroy:
  299|  1.68k|{
  300|  1.68k|	flush(this);
  301|  1.68k|	this->condvar->destroy(this->condvar);
  302|  1.68k|	this->mutex->destroy(this->mutex);
  303|  1.68k|	free(this->heap);
  304|  1.68k|	free(this);
  305|  1.68k|}

watcher_create:
  699|  1.68k|{
  700|  1.68k|	private_watcher_t *this;
  701|       |
  702|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  703|  1.68k|		.public = {
  704|  1.68k|			.add = _add,
  705|  1.68k|			.remove = _remove_,
  706|  1.68k|			.get_state = _get_state,
  707|  1.68k|			.destroy = _destroy,
  708|  1.68k|		},
  709|  1.68k|		.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
  710|  1.68k|		.condvar = condvar_create(CONDVAR_TYPE_DEFAULT),
  711|  1.68k|		.jobs = linked_list_create(),
  712|  1.68k|		.notify = {-1, -1},
  713|  1.68k|		.state = WATCHER_STOPPED,
  714|  1.68k|	);
  715|       |
  716|  1.68k|	if (!create_notify(this))
  ------------------
  |  Branch (716:6): [True: 0, False: 1.68k]
  ------------------
  717|      0|	{
  718|      0|		DBG1(DBG_LIB, "creating watcher notify pipe failed: %s",
  ------------------
  |  |  133|      0|# define DBG1(...) {}
  ------------------
  719|      0|			 strerror(errno));
  720|      0|	}
  721|  1.68k|	return &this->public;
  722|  1.68k|}
watcher.c:destroy:
  632|  1.68k|{
  633|  1.68k|	this->mutex->destroy(this->mutex);
  634|  1.68k|	this->condvar->destroy(this->condvar);
  635|  1.68k|	if (this->notify[0] != -1)
  ------------------
  |  Branch (635:6): [True: 1.68k, False: 0]
  ------------------
  636|  1.68k|	{
  637|  1.68k|		close(this->notify[0]);
  638|  1.68k|	}
  639|  1.68k|	if (this->notify[1] != -1)
  ------------------
  |  Branch (639:6): [True: 1.68k, False: 0]
  ------------------
  640|  1.68k|	{
  641|  1.68k|		close(this->notify[1]);
  642|  1.68k|	}
  643|  1.68k|	this->jobs->destroy(this->jobs);
  644|  1.68k|	free(this);
  645|  1.68k|}
watcher.c:create_notify:
  675|  1.68k|{
  676|  1.68k|	int flags;
  677|       |
  678|  1.68k|	if (pipe(this->notify) == 0)
  ------------------
  |  Branch (678:6): [True: 1.68k, False: 0]
  ------------------
  679|  1.68k|	{
  680|       |		/* use non-blocking I/O on read-end of notify pipe */
  681|  1.68k|		flags = fcntl(this->notify[0], F_GETFL);
  682|  1.68k|		if (flags != -1 &&
  ------------------
  |  Branch (682:7): [True: 1.68k, False: 0]
  ------------------
  683|  1.68k|			fcntl(this->notify[0], F_SETFL, flags | O_NONBLOCK) != -1)
  ------------------
  |  Branch (683:4): [True: 1.68k, False: 0]
  ------------------
  684|  1.68k|		{
  685|  1.68k|			return TRUE;
  ------------------
  |  |   44|  1.68k|# define TRUE  true
  ------------------
  686|  1.68k|		}
  687|      0|		DBG1(DBG_LIB, "setting watcher notify pipe read-end non-blocking "
  ------------------
  |  |  133|      0|# define DBG1(...) {}
  ------------------
  688|      0|			 "failed: %s", strerror(errno));
  689|      0|	}
  690|      0|	return FALSE;
  ------------------
  |  |   41|      0|# define FALSE false
  ------------------
  691|  1.68k|}

resolver_manager_create:
   77|  1.68k|{
   78|  1.68k|	private_resolver_manager_t *this;
   79|       |
   80|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
   81|  1.68k|			.public = {
   82|  1.68k|				.add_resolver = _add_resolver,
   83|  1.68k|				.remove_resolver = _remove_resolver,
   84|  1.68k|				.create = _create,
   85|  1.68k|				.destroy = _destroy,
   86|  1.68k|			},
   87|  1.68k|	);
   88|       |
   89|  1.68k|	return &this->public;
   90|  1.68k|}
resolver_manager.c:destroy:
   69|  1.68k|{
   70|  1.68k|	free(this);
   71|  1.68k|}

settings_value_as_bool:
  576|  16.8k|{
  577|  16.8k|	if (value)
  ------------------
  |  Branch (577:6): [True: 0, False: 16.8k]
  ------------------
  578|      0|	{
  579|      0|		if (strcaseeq(value, "1") ||
  ------------------
  |  Branch (579:7): [True: 0, False: 0]
  ------------------
  580|      0|			strcaseeq(value, "yes") ||
  ------------------
  |  Branch (580:4): [True: 0, False: 0]
  ------------------
  581|      0|			strcaseeq(value, "true") ||
  ------------------
  |  Branch (581:4): [True: 0, False: 0]
  ------------------
  582|      0|			strcaseeq(value, "enabled"))
  ------------------
  |  Branch (582:4): [True: 0, False: 0]
  ------------------
  583|      0|		{
  584|      0|			return TRUE;
  ------------------
  |  |   44|      0|# define TRUE  true
  ------------------
  585|      0|		}
  586|      0|		else if (strcaseeq(value, "0") ||
  ------------------
  |  Branch (586:12): [True: 0, False: 0]
  ------------------
  587|      0|				 strcaseeq(value, "no") ||
  ------------------
  |  Branch (587:6): [True: 0, False: 0]
  ------------------
  588|      0|				 strcaseeq(value, "false") ||
  ------------------
  |  Branch (588:6): [True: 0, False: 0]
  ------------------
  589|      0|				 strcaseeq(value, "disabled"))
  ------------------
  |  Branch (589:6): [True: 0, False: 0]
  ------------------
  590|      0|		{
  591|      0|			return FALSE;
  ------------------
  |  |   41|      0|# define FALSE false
  ------------------
  592|      0|		}
  593|      0|	}
  594|  16.8k|	return def;
  595|  16.8k|}
settings_value_as_int:
  614|  6.74k|{
  615|  6.74k|	int intval;
  616|  6.74k|	char *end;
  617|  6.74k|	int base = 10;
  618|       |
  619|  6.74k|	if (value)
  ------------------
  |  Branch (619:6): [True: 0, False: 6.74k]
  ------------------
  620|      0|	{
  621|      0|		errno = 0;
  622|      0|		if (value[0] == '0' && value[1] == 'x')
  ------------------
  |  Branch (622:7): [True: 0, False: 0]
  |  Branch (622:26): [True: 0, False: 0]
  ------------------
  623|      0|		{	/* manually detect 0x prefix as we want to avoid octal encoding */
  624|      0|			base = 16;
  625|      0|		}
  626|      0|		intval = strtoul(value, &end, base);
  627|      0|		if (errno == 0 && *end == 0 && end != value)
  ------------------
  |  Branch (627:7): [True: 0, False: 0]
  |  Branch (627:21): [True: 0, False: 0]
  |  Branch (627:34): [True: 0, False: 0]
  ------------------
  628|      0|		{
  629|      0|			return intval;
  630|      0|		}
  631|      0|	}
  632|  6.74k|	return def;
  633|  6.74k|}
settings_create:
 1157|  1.68k|{
 1158|  1.68k|	private_settings_t *this = settings_create_base();
 1159|       |
 1160|  1.68k|	load_files(this, file, FALSE);
  ------------------
  |  |   41|  1.68k|# define FALSE false
  ------------------
 1161|       |
 1162|  1.68k|	return &this->public;
 1163|  1.68k|}
settings.c:print_key:
   91|  72.4k|{
   92|  72.4k|	va_list copy;
   93|  72.4k|	char *pos = start;
   94|  72.4k|	bool res;
   95|       |
   96|  72.4k|	va_copy(copy, args);
   97|  72.4k|	while (TRUE)
  ------------------
  |  Branch (97:9): [True: 96.1k, Folded]
  ------------------
   98|  96.1k|	{
   99|  96.1k|		pos = memchr(pos, '%', key - pos);
  100|  96.1k|		if (!pos)
  ------------------
  |  Branch (100:7): [True: 72.4k, False: 23.6k]
  ------------------
  101|  72.4k|		{
  102|  72.4k|			break;
  103|  72.4k|		}
  104|  23.6k|		pos++;
  105|  23.6k|		switch (*pos)
  106|  23.6k|		{
  107|      0|			case 'd':
  ------------------
  |  Branch (107:4): [True: 0, False: 23.6k]
  ------------------
  108|      0|				va_arg(copy, int);
  109|      0|				break;
  110|  23.6k|			case 's':
  ------------------
  |  Branch (110:4): [True: 23.6k, False: 0]
  ------------------
  111|  23.6k|				va_arg(copy, char*);
  112|  23.6k|				break;
  113|      0|			case 'N':
  ------------------
  |  Branch (113:4): [True: 0, False: 23.6k]
  ------------------
  114|      0|				va_arg(copy, enum_name_t*);
  115|      0|				va_arg(copy, int);
  116|      0|				break;
  117|      0|			case '%':
  ------------------
  |  Branch (117:4): [True: 0, False: 23.6k]
  ------------------
  118|      0|				break;
  119|      0|			default:
  ------------------
  |  Branch (119:4): [True: 0, False: 23.6k]
  ------------------
  120|      0|				DBG1(DBG_CFG, "settings with %%%c not supported!", *pos);
  ------------------
  |  |  133|      0|# define DBG1(...) {}
  ------------------
  121|      0|				break;
  122|  23.6k|		}
  123|  23.6k|		pos++;
  124|  23.6k|	}
  125|  72.4k|	res = vsnprintf(buf, len, key, copy) < len;
  126|       |	va_end(copy);
  127|  72.4k|	return res;
  128|  72.4k|}
settings.c:settings_create_base:
 1120|  1.68k|{
 1121|  1.68k|	private_settings_t *this;
 1122|       |
 1123|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
 1124|  1.68k|		.public = {
 1125|  1.68k|			.get_str = _get_str,
 1126|  1.68k|			.get_int = _get_int,
 1127|  1.68k|			.get_double = _get_double,
 1128|  1.68k|			.get_time = _get_time,
 1129|  1.68k|			.get_bool = _get_bool,
 1130|  1.68k|			.set_str = _set_str,
 1131|  1.68k|			.set_int = _set_int,
 1132|  1.68k|			.set_double = _set_double,
 1133|  1.68k|			.set_time = _set_time,
 1134|  1.68k|			.set_bool = _set_bool,
 1135|  1.68k|			.set_default_str = _set_default_str,
 1136|  1.68k|			.create_section_enumerator = _create_section_enumerator,
 1137|  1.68k|			.create_key_value_enumerator = _create_key_value_enumerator,
 1138|  1.68k|			.add_fallback = _add_fallback,
 1139|  1.68k|			.load_files = _load_files,
 1140|  1.68k|			.load_files_section = _load_files_section,
 1141|  1.68k|			.load_string = _load_string,
 1142|  1.68k|			.load_string_section = _load_string_section,
 1143|  1.68k|			.destroy = _destroy,
 1144|  1.68k|			.destroy_clear = _destroy_clear,
 1145|  1.68k|		},
 1146|  1.68k|		.top = settings_section_create(NULL),
 1147|  1.68k|		.contents = array_create(0, 0),
 1148|  1.68k|		.lock = rwlock_create(RWLOCK_TYPE_DEFAULT),
 1149|  1.68k|	);
 1150|  1.68k|	return this;
 1151|  1.68k|}
settings.c:find_value:
  512|  23.6k|{
  513|  23.6k|	char buf[KEY_PART_BUF_LEN], keybuf[KEY_FULL_BUF_LEN], *value = NULL;
  514|  23.6k|	array_t *sections = NULL;
  515|  23.6k|	kv_t *kv;
  516|       |
  517|  23.6k|	if (snprintf(keybuf, sizeof(keybuf), "%s", key) >= sizeof(keybuf))
  ------------------
  |  Branch (517:6): [True: 0, False: 23.6k]
  ------------------
  518|      0|	{
  519|      0|		return NULL;
  520|      0|	}
  521|  23.6k|	this->lock->read_lock(this->lock);
  522|  23.6k|	kv = find_value_buffered(this, section, keybuf, keybuf, args,
  523|  23.6k|							 buf, sizeof(buf), FALSE, &sections);
  ------------------
  |  |   41|  23.6k|# define FALSE false
  ------------------
  524|  23.6k|	if (kv)
  ------------------
  |  Branch (524:6): [True: 0, False: 23.6k]
  ------------------
  525|      0|	{
  526|      0|		value = kv->value;
  527|      0|	}
  528|  23.6k|	this->lock->unlock(this->lock);
  529|  23.6k|	array_destroy(sections);
  530|  23.6k|	return value;
  531|  23.6k|}
settings.c:find_value_buffered:
  340|  47.2k|{
  341|  47.2k|	section_t *found = NULL;
  342|  47.2k|	kv_t *kv = NULL;
  343|  47.2k|	section_ref_t *ref;
  344|  47.2k|	array_t *references;
  345|  47.2k|	char *pos;
  346|  47.2k|	int i, j;
  347|       |
  348|  47.2k|	if (!section)
  ------------------
  |  Branch (348:6): [True: 0, False: 47.2k]
  ------------------
  349|      0|	{
  350|      0|		return NULL;
  351|      0|	}
  352|  47.2k|	pos = strchr(key, '.');
  353|  47.2k|	if (pos)
  ------------------
  |  Branch (353:6): [True: 40.4k, False: 6.74k]
  ------------------
  354|  40.4k|	{
  355|  40.4k|		*pos = '\0';
  356|  40.4k|		if (!print_key(buf, len, start, key, args))
  ------------------
  |  Branch (356:7): [True: 0, False: 40.4k]
  ------------------
  357|      0|		{
  358|      0|			return NULL;
  359|      0|		}
  360|       |		/* restore so we can follow references */
  361|  40.4k|		*pos = '.';
  362|  40.4k|		if (!strlen(buf))
  ------------------
  |  Branch (362:7): [True: 0, False: 40.4k]
  ------------------
  363|      0|		{
  364|      0|			found = section;
  365|      0|		}
  366|  40.4k|		else if (array_bsearch(section->sections, buf, settings_section_find,
  ------------------
  |  Branch (366:12): [True: 16.8k, False: 23.6k]
  ------------------
  367|  40.4k|							   &found) == -1)
  368|  16.8k|		{
  369|  16.8k|			if (!sections)
  ------------------
  |  Branch (369:8): [True: 0, False: 16.8k]
  ------------------
  370|      0|			{
  371|      0|				found = settings_section_create(strdup(buf));
  372|      0|				settings_section_add(section, found, NULL);
  373|      0|			}
  374|  16.8k|		}
  375|  40.4k|		if (found)
  ------------------
  |  Branch (375:7): [True: 23.6k, False: 16.8k]
  ------------------
  376|  23.6k|		{
  377|  23.6k|			kv = find_value_buffered(this, found, start, pos+1, args, buf, len,
  378|  23.6k|									 FALSE, sections);
  ------------------
  |  |   41|  23.6k|# define FALSE false
  ------------------
  379|  23.6k|		}
  380|  40.4k|	}
  381|  6.74k|	else
  382|  6.74k|	{
  383|  6.74k|		if (sections)
  ------------------
  |  Branch (383:7): [True: 6.74k, False: 0]
  ------------------
  384|  6.74k|		{
  385|  6.74k|			array_insert_create(sections, ARRAY_TAIL, section);
  386|  6.74k|		}
  387|  6.74k|		if (!print_key(buf, len, start, key, args))
  ------------------
  |  Branch (387:7): [True: 0, False: 6.74k]
  ------------------
  388|      0|		{
  389|      0|			return NULL;
  390|      0|		}
  391|  6.74k|		if (array_bsearch(section->kv, buf, settings_kv_find, &kv) == -1)
  ------------------
  |  Branch (391:7): [True: 6.74k, False: 0]
  ------------------
  392|  6.74k|		{
  393|  6.74k|			if (!sections)
  ------------------
  |  Branch (393:8): [True: 0, False: 6.74k]
  ------------------
  394|      0|			{
  395|      0|				kv = settings_kv_create(strdup(buf), NULL);
  396|      0|				settings_kv_add(section, kv, NULL);
  397|      0|			}
  398|  6.74k|		}
  399|  6.74k|	}
  400|  47.2k|	if (!kv && !ignore_refs && sections && section->references)
  ------------------
  |  Branch (400:6): [True: 47.2k, False: 0]
  |  Branch (400:13): [True: 47.2k, False: 0]
  |  Branch (400:29): [True: 47.2k, False: 0]
  |  Branch (400:41): [True: 23.6k, False: 23.6k]
  ------------------
  401|  23.6k|	{
  402|       |		/* find key relative to the referenced sections */
  403|  47.2k|		for (i = 0; !kv && i < array_count(section->references); i++)
  ------------------
  |  Branch (403:15): [True: 47.2k, False: 0]
  |  Branch (403:22): [True: 23.6k, False: 23.6k]
  ------------------
  404|  23.6k|		{
  405|  23.6k|			array_get(section->references, i, &ref);
  406|  23.6k|			references = NULL;
  407|  23.6k|			resolve_reference(this, ref, &references);
  408|  23.6k|			for (j = 0; !kv && j < array_count(references); j++)
  ------------------
  |  Branch (408:16): [True: 23.6k, False: 0]
  |  Branch (408:23): [True: 0, False: 23.6k]
  ------------------
  409|      0|			{
  410|      0|				array_get(references, j, &found);
  411|       |				/* ignore if already added to avoid loops */
  412|      0|				if (!has_section(*sections, found))
  ------------------
  |  Branch (412:9): [True: 0, False: 0]
  ------------------
  413|      0|				{
  414|       |					/* ignore references in this referenced section, they were
  415|       |					 * resolved via resolve_reference() */
  416|      0|					kv = find_value_buffered(this, found, start, key, args,
  417|       |											 buf, len, TRUE, sections);
  ------------------
  |  |   44|      0|# define TRUE  true
  ------------------
  418|      0|				}
  419|      0|			}
  420|  23.6k|			array_destroy(references);
  421|  23.6k|		}
  422|  23.6k|	}
  423|  47.2k|	return kv;
  424|  47.2k|}
settings.c:resolve_reference:
  206|  23.6k|{
  207|  23.6k|	va_list args;
  208|       |
  209|  23.6k|	va_start(args, sections);
  210|  23.6k|	find_sections(this, this->top, ref->name, args, sections);
  211|       |	va_end(args);
  212|  23.6k|}
settings.c:find_sections:
  317|  23.6k|{
  318|  23.6k|	char buf[KEY_PART_BUF_LEN], keybuf[KEY_FULL_BUF_LEN];
  319|       |
  320|  23.6k|	if (snprintf(keybuf, sizeof(keybuf), "%s", key) >= sizeof(keybuf))
  ------------------
  |  Branch (320:6): [True: 0, False: 23.6k]
  ------------------
  321|      0|	{
  322|      0|		return NULL;
  323|      0|	}
  324|  23.6k|	find_sections_buffered(this, section, keybuf, keybuf, args, buf,
  325|       |						   sizeof(buf), FALSE, sections);
  ------------------
  |  |   41|  23.6k|# define FALSE false
  ------------------
  326|  23.6k|	return *sections;
  327|  23.6k|}
settings.c:find_sections_buffered:
  222|  23.6k|{
  223|  23.6k|	section_t *found = NULL, *reference;
  224|  23.6k|	array_t *references;
  225|  23.6k|	section_ref_t *ref;
  226|  23.6k|	char *pos;
  227|  23.6k|	int i, j;
  228|       |
  229|  23.6k|	if (!section)
  ------------------
  |  Branch (229:6): [True: 0, False: 23.6k]
  ------------------
  230|      0|	{
  231|      0|		return;
  232|      0|	}
  233|  23.6k|	pos = strchr(key, '.');
  234|  23.6k|	if (pos)
  ------------------
  |  Branch (234:6): [True: 0, False: 23.6k]
  ------------------
  235|      0|	{
  236|      0|		*pos = '\0';
  237|      0|	}
  238|  23.6k|	if (!print_key(buf, len, start, key, args))
  ------------------
  |  Branch (238:6): [True: 0, False: 23.6k]
  ------------------
  239|      0|	{
  240|      0|		return;
  241|      0|	}
  242|  23.6k|	if (pos)
  ------------------
  |  Branch (242:6): [True: 0, False: 23.6k]
  ------------------
  243|      0|	{	/* restore so we can follow references */
  244|      0|		*pos = '.';
  245|      0|	}
  246|  23.6k|	if (!strlen(buf))
  ------------------
  |  Branch (246:6): [True: 0, False: 23.6k]
  ------------------
  247|      0|	{
  248|      0|		found = section;
  249|      0|	}
  250|  23.6k|	else
  251|  23.6k|	{
  252|  23.6k|		array_bsearch(section->sections, buf, settings_section_find, &found);
  253|  23.6k|	}
  254|  23.6k|	if (found)
  ------------------
  |  Branch (254:6): [True: 0, False: 23.6k]
  ------------------
  255|      0|	{
  256|      0|		if (pos)
  ------------------
  |  Branch (256:7): [True: 0, False: 0]
  ------------------
  257|      0|		{
  258|      0|			find_sections_buffered(this, found, start, pos+1, args, buf, len,
  259|      0|								   FALSE, sections);
  ------------------
  |  |   41|      0|# define FALSE false
  ------------------
  260|      0|		}
  261|      0|		else if (!has_section(*sections, found))
  ------------------
  |  Branch (261:12): [True: 0, False: 0]
  ------------------
  262|      0|		{
  263|       |			/* ignore if already added to avoid loops */
  264|      0|			array_insert_create(sections, ARRAY_TAIL, found);
  265|       |			/* add all sections that are referenced here (also resolves
  266|       |			 * references in parent sections of the referenced section) */
  267|      0|			for (i = 0; i < array_count(found->references); i++)
  ------------------
  |  Branch (267:16): [True: 0, False: 0]
  ------------------
  268|      0|			{
  269|      0|				array_get(found->references, i, &ref);
  270|      0|				resolve_reference(this, ref, sections);
  271|      0|			}
  272|      0|		}
  273|      0|	}
  274|  23.6k|	if (!ignore_refs && section != found && section->references)
  ------------------
  |  Branch (274:6): [True: 23.6k, False: 0]
  |  Branch (274:22): [True: 23.6k, False: 0]
  |  Branch (274:42): [True: 0, False: 23.6k]
  ------------------
  275|      0|	{
  276|       |		/* find matching sub-sections relative to the referenced sections */
  277|      0|		for (i = 0; i < array_count(section->references); i++)
  ------------------
  |  Branch (277:15): [True: 0, False: 0]
  ------------------
  278|      0|		{
  279|      0|			array_get(section->references, i, &ref);
  280|      0|			references = NULL;
  281|      0|			resolve_reference(this, ref, &references);
  282|      0|			for (j = 0; j < array_count(references); j++)
  ------------------
  |  Branch (282:16): [True: 0, False: 0]
  ------------------
  283|      0|			{
  284|      0|				array_get(references, j, &reference);
  285|       |				/* ignore references in this referenced section, they were
  286|       |				 * resolved via resolve_reference() */
  287|      0|				find_sections_buffered(this, reference, start, key, args,
  288|       |									   buf, len, TRUE, sections);
  ------------------
  |  |   44|      0|# define TRUE  true
  ------------------
  289|      0|			}
  290|      0|			array_destroy(references);
  291|      0|		}
  292|      0|	}
  293|  23.6k|}
settings.c:get_bool:
  599|  16.8k|{
  600|  16.8k|	char *value;
  601|  16.8k|	va_list args;
  602|       |
  603|       |	/* we can't use bool for def due to this call */
  604|  16.8k|	va_start(args, def);
  605|  16.8k|	value = find_value(this, this->top, key, args);
  606|       |	va_end(args);
  607|  16.8k|	return settings_value_as_bool(value, def);
  608|  16.8k|}
settings.c:get_int:
  637|  6.74k|{
  638|  6.74k|	char *value;
  639|  6.74k|	va_list args;
  640|       |
  641|  6.74k|	va_start(args, def);
  642|  6.74k|	value = find_value(this, this->top, key, args);
  643|       |	va_end(args);
  644|  6.74k|	return settings_value_as_int(value, def);
  645|  6.74k|}
settings.c:add_fallback:
  950|  1.68k|{
  951|  1.68k|	section_t *section;
  952|  1.68k|	va_list args;
  953|  1.68k|	char buf[KEY_FULL_BUF_LEN];
  954|       |
  955|  1.68k|	this->lock->write_lock(this->lock);
  956|  1.68k|	va_start(args, fallback);
  957|  1.68k|	section = ensure_section(this, this->top, key, args);
  958|  1.68k|	va_end(args);
  959|       |
  960|  1.68k|	va_start(args, fallback);
  961|  1.68k|	if (section && vsnprintf(buf, sizeof(buf), fallback, args) < sizeof(buf))
  ------------------
  |  Branch (961:6): [True: 1.68k, False: 0]
  |  Branch (961:17): [True: 1.68k, False: 0]
  ------------------
  962|  1.68k|	{
  963|  1.68k|		settings_reference_add(section, strdup(buf), TRUE);
  ------------------
  |  |   44|  1.68k|# define TRUE  true
  ------------------
  964|  1.68k|	}
  965|       |	va_end(args);
  966|  1.68k|	this->lock->unlock(this->lock);
  967|  1.68k|}
settings.c:ensure_section:
  300|  1.68k|{
  301|  1.68k|	char buf[KEY_PART_BUF_LEN], keybuf[KEY_FULL_BUF_LEN];
  302|       |
  303|  1.68k|	if (snprintf(keybuf, sizeof(keybuf), "%s", key) >= sizeof(keybuf))
  ------------------
  |  Branch (303:6): [True: 0, False: 1.68k]
  ------------------
  304|      0|	{
  305|      0|		return NULL;
  306|      0|	}
  307|  1.68k|	return find_section_buffered(section, keybuf, keybuf, args, buf,
  308|       |								 sizeof(buf), TRUE);
  ------------------
  |  |   44|  1.68k|# define TRUE  true
  ------------------
  309|  1.68k|}
settings.c:find_section_buffered:
  156|  1.68k|{
  157|  1.68k|	char *pos;
  158|  1.68k|	section_t *found = NULL;
  159|       |
  160|  1.68k|	if (section == NULL)
  ------------------
  |  Branch (160:6): [True: 0, False: 1.68k]
  ------------------
  161|      0|	{
  162|      0|		return NULL;
  163|      0|	}
  164|  1.68k|	pos = strchr(key, '.');
  165|  1.68k|	if (pos)
  ------------------
  |  Branch (165:6): [True: 0, False: 1.68k]
  ------------------
  166|      0|	{
  167|      0|		*pos = '\0';
  168|      0|		pos++;
  169|      0|	}
  170|  1.68k|	if (!print_key(buf, len, start, key, args))
  ------------------
  |  Branch (170:6): [True: 0, False: 1.68k]
  ------------------
  171|      0|	{
  172|      0|		return NULL;
  173|      0|	}
  174|  1.68k|	if (!strlen(buf))
  ------------------
  |  Branch (174:6): [True: 0, False: 1.68k]
  ------------------
  175|      0|	{
  176|      0|		found = section;
  177|      0|	}
  178|  1.68k|	else if (array_bsearch(section->sections, buf, settings_section_find,
  ------------------
  |  Branch (178:11): [True: 1.68k, False: 0]
  ------------------
  179|  1.68k|						   &found) == -1)
  180|  1.68k|	{
  181|  1.68k|		if (ensure)
  ------------------
  |  Branch (181:7): [True: 1.68k, False: 0]
  ------------------
  182|  1.68k|		{
  183|  1.68k|			found = settings_section_create(strdup(buf));
  184|  1.68k|			settings_section_add(section, found, NULL);
  185|  1.68k|		}
  186|  1.68k|	}
  187|  1.68k|	if (found && pos)
  ------------------
  |  Branch (187:6): [True: 1.68k, False: 0]
  |  Branch (187:15): [True: 0, False: 1.68k]
  ------------------
  188|      0|	{
  189|      0|		return find_section_buffered(found, start, pos, args, buf, len, ensure);
  190|      0|	}
  191|  1.68k|	return found;
  192|  1.68k|}
settings.c:load_internal:
  974|  3.37k|{
  975|  3.37k|	section_t *section;
  976|  3.37k|	bool loaded;
  977|       |
  978|  3.37k|	if (pattern == NULL || !pattern[0])
  ------------------
  |  Branch (978:6): [True: 1.68k, False: 1.68k]
  |  Branch (978:25): [True: 0, False: 1.68k]
  ------------------
  979|  1.68k|	{
  980|  1.68k|		return settings_section_create(NULL);
  981|  1.68k|	}
  982|       |
  983|  1.68k|	section = settings_section_create(NULL);
  984|  1.68k|	loaded = string ? settings_parser_parse_string(section, pattern) :
  ------------------
  |  Branch (984:11): [True: 0, False: 1.68k]
  ------------------
  985|  1.68k|					  settings_parser_parse_file(section, pattern);
  986|  1.68k|	if (!loaded)
  ------------------
  |  Branch (986:6): [True: 1.68k, False: 0]
  ------------------
  987|  1.68k|	{
  988|  1.68k|		settings_section_destroy(section, NULL);
  989|       |		section = NULL;
  990|  1.68k|	}
  991|  1.68k|	return section;
  992|  3.37k|}
settings.c:extend_section:
 1004|  1.68k|{
 1005|  1.68k|	if (parent)
  ------------------
  |  Branch (1005:6): [True: 1.68k, False: 0]
  ------------------
 1006|  1.68k|	{
 1007|  1.68k|		settings_section_extend(parent, section, this->contents, !merge);
 1008|  1.68k|	}
 1009|  1.68k|	this->lock->unlock(this->lock);
 1010|  1.68k|	settings_section_destroy(section, NULL);
 1011|       |	return parent != NULL;
 1012|  1.68k|}
settings.c:destroy:
 1109|  1.68k|{
 1110|       |	destroy_settings(this, FALSE);
  ------------------
  |  |   41|  1.68k|# define FALSE false
  ------------------
 1111|  1.68k|}
settings.c:destroy_settings:
 1100|  1.68k|{
 1101|  1.68k|	settings_section_destroy(this->top, clear ? this->contents : NULL);
  ------------------
  |  Branch (1101:38): [True: 0, False: 1.68k]
  ------------------
 1102|  1.68k|	array_destroy_function(this->contents, clear_content, &clear);
 1103|  1.68k|	this->lock->destroy(this->lock);
 1104|  1.68k|	free(this);
 1105|  1.68k|}
settings.c:load_files:
 1016|  3.37k|{
 1017|  3.37k|	section_t *section;
 1018|       |
 1019|  3.37k|	section = load_internal(pattern, FALSE);
  ------------------
  |  |   41|  3.37k|# define FALSE false
  ------------------
 1020|  3.37k|	if (!section)
  ------------------
  |  Branch (1020:6): [True: 1.68k, False: 1.68k]
  ------------------
 1021|  1.68k|	{
 1022|  1.68k|		return FALSE;
  ------------------
  |  |   41|  1.68k|# define FALSE false
  ------------------
 1023|  1.68k|	}
 1024|       |
 1025|  1.68k|	this->lock->write_lock(this->lock);
 1026|  1.68k|	return extend_section(this, this->top, section, merge);
 1027|  3.37k|}

settings_parser_set_extra:
 2756|  3.37k|{
 2757|  3.37k|    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 2758|  3.37k|    yyextra = user_defined ;
  ------------------
  |  |  366|  3.37k|#define yyextra yyg->yyextra_r
  ------------------
 2759|  3.37k|}
settings_parser_lex_init_extra:
 2865|  1.68k|{
 2866|  1.68k|    struct yyguts_t dummy_yyguts;
 2867|       |
 2868|  1.68k|    yyset_extra (yy_user_defined, &dummy_yyguts);
  ------------------
  |  |  151|  1.68k|#define yyset_extra settings_parser_set_extra
  ------------------
 2869|       |
 2870|  1.68k|    if (ptr_yy_globals == NULL){
  ------------------
  |  Branch (2870:9): [True: 0, False: 1.68k]
  ------------------
 2871|      0|        errno = EINVAL;
 2872|      0|        return 1;
 2873|      0|    }
 2874|       |
 2875|  1.68k|    *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
  ------------------
  |  |  225|  1.68k|#define yyalloc settings_parser_alloc
  ------------------
 2876|       |
 2877|  1.68k|    if (*ptr_yy_globals == NULL){
  ------------------
  |  Branch (2877:9): [True: 0, False: 1.68k]
  ------------------
 2878|      0|        errno = ENOMEM;
 2879|      0|        return 1;
 2880|      0|    }
 2881|       |
 2882|       |    /* By setting to 0xAA, we expose bugs in
 2883|       |    yy_init_globals. Leave at 0x00 for releases. */
 2884|  1.68k|    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
  ------------------
  |  |   92|  1.68k|#define memset(s,c,n) memset_noop(s,c,n)
  ------------------
 2885|       |
 2886|  1.68k|    yyset_extra (yy_user_defined, *ptr_yy_globals);
  ------------------
  |  |  151|  1.68k|#define yyset_extra settings_parser_set_extra
  ------------------
 2887|       |
 2888|  1.68k|    return yy_init_globals ( *ptr_yy_globals );
 2889|  1.68k|}
settings_parser_lex_destroy:
 2931|  1.68k|{
 2932|  1.68k|    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 2933|       |
 2934|       |    /* Pop the buffer stack, destroying each element. */
 2935|  1.68k|	while(YY_CURRENT_BUFFER){
  ------------------
  |  |  555|  1.68k|#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
  |  |  ------------------
  |  |  |  Branch (555:27): [True: 0, False: 1.68k]
  |  |  |  Branch (555:29): [True: 0, False: 1.68k]
  |  |  ------------------
  |  |  556|  1.68k|                          ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
  |  |  557|  1.68k|                          : NULL)
  ------------------
 2936|      0|		yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );
  ------------------
  |  |   37|      0|#define yy_delete_buffer settings_parser__delete_buffer
  ------------------
              		yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );
  ------------------
  |  |  555|      0|#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
  |  |  ------------------
  |  |  |  Branch (555:29): [True: 0, False: 0]
  |  |  ------------------
  |  |  556|      0|                          ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
  |  |  557|      0|                          : NULL)
  ------------------
 2937|      0|		YY_CURRENT_BUFFER_LVALUE = NULL;
  ------------------
  |  |  561|      0|#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
  ------------------
 2938|      0|		yypop_buffer_state(yyscanner);
  ------------------
  |  |   91|      0|#define yypop_buffer_state settings_parser_pop_buffer_state
  ------------------
 2939|      0|	}
 2940|       |
 2941|       |	/* Destroy the stack itself. */
 2942|  1.68k|	yyfree(yyg->yy_buffer_stack , yyscanner);
  ------------------
  |  |  237|  1.68k|#define yyfree settings_parser_free
  ------------------
 2943|  1.68k|	yyg->yy_buffer_stack = NULL;
 2944|       |
 2945|       |    /* Destroy the start condition stack. */
 2946|  1.68k|        yyfree( yyg->yy_start_stack , yyscanner );
  ------------------
  |  |  237|  1.68k|#define yyfree settings_parser_free
  ------------------
 2947|  1.68k|        yyg->yy_start_stack = NULL;
 2948|       |
 2949|       |    /* Reset the globals. This is important in a non-reentrant scanner so the next time
 2950|       |     * yylex() is called, initialization will occur. */
 2951|  1.68k|    yy_init_globals( yyscanner);
 2952|       |
 2953|       |/* %if-reentrant */
 2954|       |    /* Destroy the main struct (reentrant only). */
 2955|  1.68k|    yyfree ( yyscanner , yyscanner );
  ------------------
  |  |  237|  1.68k|#define yyfree settings_parser_free
  ------------------
 2956|  1.68k|    yyscanner = NULL;
 2957|       |/* %endif */
 2958|  1.68k|    return 0;
 2959|  1.68k|}
settings_parser_alloc:
 2990|  1.68k|{
 2991|  1.68k|	struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 2992|  1.68k|	(void)yyg;
 2993|  1.68k|	return malloc(size);
 2994|  1.68k|}
settings_parser_free:
 3012|  5.05k|{
 3013|  5.05k|	struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 3014|  5.05k|	(void)yyg;
 3015|  5.05k|	free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
 3016|  5.05k|}
settings_parser_open_next_file:
 3032|  1.68k|{
 3033|  1.68k|	FILE *file;
 3034|       |
 3035|  1.68k|	file = ctx->file_next(ctx);
 3036|  1.68k|	if (!file)
  ------------------
  |  Branch (3036:6): [True: 1.68k, False: 0]
  ------------------
 3037|  1.68k|	{
 3038|  1.68k|		return FALSE;
  ------------------
  |  |   41|  1.68k|# define FALSE false
  ------------------
 3039|  1.68k|	}
 3040|       |
 3041|      0|	settings_parser_set_in(file, ctx->scanner);
 3042|      0|	settings_parser_push_buffer_state(
 3043|      0|			settings_parser__create_buffer(file, YY_BUF_SIZE,
  ------------------
  |  |  404|      0|#define YY_BUF_SIZE 16384
  ------------------
 3044|      0|										   ctx->scanner), ctx->scanner);
 3045|       |	return TRUE;
  ------------------
  |  |   44|      0|# define TRUE  true
  ------------------
 3046|  1.68k|}
settings_lexer.c:yy_init_globals:
 2895|  3.37k|{
 2896|  3.37k|    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 2897|       |    /* Initialization is the same as for the non-reentrant scanner.
 2898|       |     * This function is called from yylex_destroy(), so don't allocate here.
 2899|       |     */
 2900|       |
 2901|  3.37k|    yyg->yy_buffer_stack = NULL;
 2902|  3.37k|    yyg->yy_buffer_stack_top = 0;
 2903|  3.37k|    yyg->yy_buffer_stack_max = 0;
 2904|  3.37k|    yyg->yy_c_buf_p = NULL;
 2905|  3.37k|    yyg->yy_init = 0;
 2906|  3.37k|    yyg->yy_start = 0;
 2907|       |
 2908|  3.37k|    yyg->yy_start_stack_ptr = 0;
 2909|  3.37k|    yyg->yy_start_stack_depth = 0;
 2910|  3.37k|    yyg->yy_start_stack =  NULL;
 2911|       |
 2912|       |/* Defined in main.c */
 2913|       |#ifdef YY_STDINIT
 2914|       |    yyin = stdin;
 2915|       |    yyout = stdout;
 2916|       |#else
 2917|  3.37k|    yyin = NULL;
  ------------------
  |  |  364|  3.37k|#define yyin yyg->yyin_r
  ------------------
 2918|  3.37k|    yyout = NULL;
  ------------------
  |  |  365|  3.37k|#define yyout yyg->yyout_r
  ------------------
 2919|  3.37k|#endif
 2920|       |
 2921|       |    /* For future reference: Set errno on error, since we are called by
 2922|       |     * yylex_init()
 2923|       |     */
 2924|  3.37k|    return 0;
 2925|  3.37k|}

settings_parser_parse_file:
 1878|  1.68k|{
 1879|  1.68k|	parser_helper_t *helper;
 1880|  1.68k|	array_t *sections = NULL;
 1881|  1.68k|	bool success = FALSE;
  ------------------
  |  |   41|  1.68k|# define FALSE false
  ------------------
 1882|       |
 1883|  1.68k|	array_insert_create(&sections, ARRAY_TAIL, root);
 1884|  1.68k|	helper = parser_helper_create(sections);
 1885|  1.68k|	helper->get_lineno = settings_parser_get_lineno;
 1886|  1.68k|	if (settings_parser_lex_init_extra(helper, &helper->scanner) != 0)
  ------------------
  |  Branch (1886:6): [True: 0, False: 1.68k]
  ------------------
 1887|      0|	{
 1888|      0|		helper->destroy(helper);
 1889|      0|		array_destroy(sections);
 1890|      0|		return FALSE;
  ------------------
  |  |   41|      0|# define FALSE false
  ------------------
 1891|      0|	}
 1892|  1.68k|	helper->file_include(helper, name);
 1893|  1.68k|	if (!settings_parser_open_next_file(helper))
  ------------------
  |  Branch (1893:6): [True: 1.68k, False: 0]
  ------------------
 1894|  1.68k|	{
 1895|  1.68k|		if (lib->conf && streq(name, lib->conf))
  ------------------
  |  Branch (1895:7): [True: 1.68k, False: 0]
  |  Branch (1895:20): [True: 1.68k, False: 0]
  ------------------
 1896|  1.68k|		{
 1897|  1.68k|			DBG2(DBG_CFG, "failed to open config file '%s'", name);
  ------------------
  |  |  136|  1.68k|# define DBG2(...) {}
  ------------------
 1898|  1.68k|		}
 1899|      0|		else
 1900|      0|		{
 1901|      0|			DBG1(DBG_CFG, "failed to open config file '%s'", name);
  ------------------
  |  |  133|      0|# define DBG1(...) {}
  ------------------
 1902|      0|		}
 1903|  1.68k|	}
 1904|      0|	else
 1905|      0|	{
 1906|      0|		if (getenv("DEBUG_SETTINGS_PARSER"))
  ------------------
  |  Branch (1906:7): [True: 0, False: 0]
  ------------------
 1907|      0|		{
 1908|      0|			yydebug = 1;
  ------------------
  |  |   71|      0|#define yydebug         settings_parser_debug
  ------------------
 1909|      0|			settings_parser_set_debug(1, helper->scanner);
 1910|      0|		}
 1911|      0|		success = yyparse(helper) == 0;
  ------------------
  |  |   68|      0|#define yyparse         settings_parser_parse
  ------------------
 1912|      0|		if (!success)
  ------------------
  |  Branch (1912:7): [True: 0, False: 0]
  ------------------
 1913|      0|		{
 1914|      0|			DBG1(DBG_CFG, "invalid config file '%s'", name);
  ------------------
  |  |  133|      0|# define DBG1(...) {}
  ------------------
 1915|      0|		}
 1916|      0|	}
 1917|  1.68k|	array_destroy(sections);
 1918|  1.68k|	settings_parser_lex_destroy(helper->scanner);
 1919|  1.68k|	helper->destroy(helper);
 1920|  1.68k|	return success;
 1921|  1.68k|}

settings_section_create:
   54|  6.74k|{
   55|  6.74k|	section_t *this;
   56|       |
   57|  6.74k|	INIT(this,
  ------------------
  |  |   44|  6.74k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  6.74k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
   58|  6.74k|		.name = name,
   59|  6.74k|	);
   60|  6.74k|	return this;
   61|  6.74k|}
settings_section_destroy:
   83|  6.74k|{
   84|  6.74k|	array_destroy_function(this->sections, (void*)section_destroy, contents);
   85|  6.74k|	array_destroy(this->sections_order);
   86|  6.74k|	array_destroy_function(this->kv, (void*)kv_destroy, contents);
   87|  6.74k|	array_destroy(this->kv_order);
   88|       |	array_destroy_function(this->references, (void*)ref_destroy, NULL);
   89|  6.74k|	free(this->name);
   90|  6.74k|	free(this);
   91|  6.74k|}
settings_reference_add:
  143|  1.68k|{
  144|  1.68k|	section_ref_t *ref;
  145|  1.68k|	int i;
  146|       |
  147|  1.68k|	for (i = 0; i < array_count(section->references); i++)
  ------------------
  |  Branch (147:14): [True: 0, False: 1.68k]
  ------------------
  148|      0|	{
  149|      0|		array_get(section->references, i, &ref);
  150|      0|		if (ref->permanent && !permanent)
  ------------------
  |  Branch (150:7): [True: 0, False: 0]
  |  Branch (150:25): [True: 0, False: 0]
  ------------------
  151|      0|		{	/* add it before any permanent references */
  152|      0|			break;
  153|      0|		}
  154|      0|		if (ref->permanent == permanent && streq(name, ref->name))
  ------------------
  |  Branch (154:7): [True: 0, False: 0]
  |  Branch (154:38): [True: 0, False: 0]
  ------------------
  155|      0|		{
  156|      0|			free(name);
  157|      0|			return;
  158|      0|		}
  159|      0|	}
  160|       |
  161|  1.68k|	INIT(ref,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  162|  1.68k|		.name = name,
  163|  1.68k|		.permanent = permanent,
  164|  1.68k|	);
  165|  1.68k|	array_insert_create(&section->references, i, ref);
  166|  1.68k|}
settings_section_add:
  196|  1.68k|{
  197|       |	add_section(parent, section, contents, FALSE);
  ------------------
  |  |   41|  1.68k|# define FALSE false
  ------------------
  198|  1.68k|}
settings_section_extend:
  250|  1.68k|{
  251|  1.68k|	enumerator_t *enumerator;
  252|  1.68k|	section_t *section;
  253|  1.68k|	section_ref_t *ref;
  254|  1.68k|	kv_t *kv;
  255|  1.68k|	array_t *sections = NULL, *kvs = NULL;
  256|  1.68k|	int idx;
  257|       |
  258|  1.68k|	if (purge)
  ------------------
  |  Branch (258:6): [True: 1.68k, False: 0]
  ------------------
  259|  1.68k|	{	/* remove sections, settings in base not found in extension, the others
  260|       |		 * are removed too (from the _order list) so they can be inserted in the
  261|       |		 * order found in extension, non-permanent references are removed */
  262|  1.68k|		enumerator = array_create_enumerator(base->sections_order);
  263|  1.68k|		while (enumerator->enumerate(enumerator, (void**)&section))
  ------------------
  |  Branch (263:10): [True: 0, False: 1.68k]
  ------------------
  264|      0|		{
  265|      0|			if (array_bsearch(extension->sections, section->name,
  ------------------
  |  Branch (265:8): [True: 0, False: 0]
  ------------------
  266|      0|							  settings_section_find, NULL) == -1)
  267|      0|			{
  268|      0|				idx = array_bsearch(base->sections, section->name,
  269|      0|									settings_section_find, NULL);
  270|      0|				if (section_purge(section, contents))
  ------------------
  |  Branch (270:9): [True: 0, False: 0]
  ------------------
  271|      0|				{	/* only remove them if we can purge them */
  272|      0|					array_remove(base->sections, idx, NULL);
  273|      0|					array_remove_at(base->sections_order, enumerator);
  274|      0|					settings_section_destroy(section, contents);
  275|      0|				}
  276|      0|			}
  277|      0|			else
  278|      0|			{
  279|      0|				array_remove_at(base->sections_order, enumerator);
  280|      0|				array_insert_create(&sections, ARRAY_TAIL, section);
  281|      0|				array_sort(sections, settings_section_sort, NULL);
  282|      0|			}
  283|      0|		}
  284|  1.68k|		enumerator->destroy(enumerator);
  285|       |
  286|  1.68k|		while (array_remove(base->kv_order, 0, &kv))
  ------------------
  |  Branch (286:10): [True: 0, False: 1.68k]
  ------------------
  287|      0|		{
  288|      0|			if (array_bsearch(extension->kv, kv->key, settings_kv_find,
  ------------------
  |  Branch (288:8): [True: 0, False: 0]
  ------------------
  289|      0|							  NULL) == -1)
  290|      0|			{
  291|      0|				idx = array_bsearch(base->kv, kv->key, settings_kv_find, NULL);
  292|      0|				array_remove(base->kv, idx, NULL);
  293|      0|				settings_kv_destroy(kv, contents);
  294|      0|			}
  295|      0|			else
  296|      0|			{
  297|      0|				array_insert_create(&kvs, ARRAY_TAIL, kv);
  298|      0|				array_sort(kvs, settings_kv_sort, NULL);
  299|      0|			}
  300|      0|		}
  301|       |
  302|  1.68k|		enumerator = array_create_enumerator(base->references);
  303|  1.68k|		while (enumerator->enumerate(enumerator, (void**)&ref))
  ------------------
  |  Branch (303:10): [True: 0, False: 1.68k]
  ------------------
  304|      0|		{
  305|      0|			if (ref->permanent)
  ------------------
  |  Branch (305:8): [True: 0, False: 0]
  ------------------
  306|      0|			{	/* permanent references are ignored */
  307|      0|				continue;
  308|      0|			}
  309|      0|			array_remove_at(base->references, enumerator);
  310|      0|			ref_destroy(ref, 0, NULL);
  311|      0|		}
  312|  1.68k|		enumerator->destroy(enumerator);
  313|  1.68k|	}
  314|       |
  315|  1.68k|	while (array_remove(extension->sections_order, 0, &section))
  ------------------
  |  Branch (315:9): [True: 0, False: 1.68k]
  ------------------
  316|      0|	{
  317|      0|		idx = array_bsearch(sections, section->name,
  318|      0|							settings_section_find, NULL);
  319|      0|		if (idx != -1)
  ------------------
  |  Branch (319:7): [True: 0, False: 0]
  ------------------
  320|      0|		{
  321|      0|			section_t *existing;
  322|       |
  323|      0|			array_remove(sections, idx, &existing);
  324|      0|			array_insert(base->sections_order, ARRAY_TAIL, existing);
  325|      0|		}
  326|      0|		idx = array_bsearch(extension->sections, section->name,
  327|      0|							settings_section_find, NULL);
  328|      0|		array_remove(extension->sections, idx, NULL);
  329|      0|		add_section(base, section, contents, purge);
  330|      0|	}
  331|       |
  332|  1.68k|	while (array_remove(extension->kv_order, 0, &kv))
  ------------------
  |  Branch (332:9): [True: 0, False: 1.68k]
  ------------------
  333|      0|	{
  334|      0|		idx = array_bsearch(kvs, kv->key, settings_kv_find, NULL);
  335|      0|		if (idx != -1)
  ------------------
  |  Branch (335:7): [True: 0, False: 0]
  ------------------
  336|      0|		{
  337|      0|			kv_t *existing;
  338|       |
  339|      0|			array_remove(kvs, idx, &existing);
  340|      0|			array_insert(base->kv_order, ARRAY_TAIL, existing);
  341|      0|		}
  342|      0|		idx = array_bsearch(extension->kv, kv->key, settings_kv_find, NULL);
  343|      0|		array_remove(extension->kv, idx, NULL);
  344|      0|		settings_kv_add(base, kv, contents);
  345|      0|	}
  346|       |
  347|  1.68k|	while (array_remove(extension->references, 0, &ref))
  ------------------
  |  Branch (347:9): [True: 0, False: 1.68k]
  ------------------
  348|      0|	{
  349|      0|		if (ref->permanent)
  ------------------
  |  Branch (349:7): [True: 0, False: 0]
  ------------------
  350|      0|		{	/* ignore permanent references in the extension */
  351|      0|			continue;
  352|      0|		}
  353|      0|		settings_reference_add(base, strdup(ref->name), FALSE);
  ------------------
  |  |   41|      0|# define FALSE false
  ------------------
  354|       |		ref_destroy(ref, 0, NULL);
  355|      0|	}
  356|  1.68k|	array_destroy(sections);
  357|  1.68k|	array_destroy(kvs);
  358|  1.68k|}
settings_section_find:
  364|  47.2k|{
  365|  47.2k|	const char *key = a;
  366|  47.2k|	const section_t *item = b;
  367|  47.2k|	return strcmp(key, item->name);
  368|  47.2k|}
settings_types.c:section_destroy:
   64|  1.68k|{
   65|  1.68k|	settings_section_destroy(section, contents);
   66|  1.68k|}
settings_types.c:ref_destroy:
   74|  1.68k|{
   75|  1.68k|	free(ref->name);
   76|  1.68k|	free(ref);
   77|  1.68k|}
settings_types.c:add_section:
  174|  1.68k|{
  175|  1.68k|	section_t *found;
  176|       |
  177|  1.68k|	if (array_bsearch(parent->sections, section->name, settings_section_find,
  ------------------
  |  Branch (177:6): [True: 1.68k, False: 0]
  ------------------
  178|  1.68k|					  &found) == -1)
  179|  1.68k|	{
  180|  1.68k|		array_insert_create(&parent->sections, ARRAY_TAIL, section);
  181|  1.68k|		array_sort(parent->sections, settings_section_sort, NULL);
  182|  1.68k|		array_insert_create(&parent->sections_order, ARRAY_TAIL, section);
  183|  1.68k|	}
  184|      0|	else
  185|      0|	{
  186|      0|		settings_section_extend(found, section, contents, purge);
  187|      0|		settings_section_destroy(section, contents);
  188|      0|	}
  189|  1.68k|}

mutex_create:
  174|  15.1k|{
  175|  15.1k|	switch (type)
  176|  15.1k|	{
  177|  1.68k|		case MUTEX_TYPE_RECURSIVE:
  ------------------
  |  Branch (177:3): [True: 1.68k, False: 13.4k]
  ------------------
  178|  1.68k|		{
  179|  1.68k|			private_r_mutex_t *this;
  180|       |
  181|  1.68k|			INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  182|  1.68k|				.generic = {
  183|  1.68k|					.public = {
  184|  1.68k|						.lock = _lock_r,
  185|  1.68k|						.unlock = _unlock_r,
  186|  1.68k|						.destroy = _mutex_destroy_r,
  187|  1.68k|					},
  188|  1.68k|					.recursive = TRUE,
  189|  1.68k|				},
  190|  1.68k|			);
  191|       |
  192|  1.68k|			pthread_mutex_init(&this->generic.mutex, NULL);
  193|  1.68k|			profiler_init(&this->generic.profile);
  ------------------
  |  |   96|  1.68k|#define profiler_init(...) {}
  ------------------
  194|       |
  195|  1.68k|			return &this->generic.public;
  196|      0|		}
  197|  13.4k|		case MUTEX_TYPE_DEFAULT:
  ------------------
  |  Branch (197:3): [True: 13.4k, False: 1.68k]
  ------------------
  198|  13.4k|		default:
  ------------------
  |  Branch (198:3): [True: 0, False: 15.1k]
  ------------------
  199|  13.4k|		{
  200|  13.4k|			private_mutex_t *this;
  201|       |
  202|  13.4k|			INIT(this,
  ------------------
  |  |   44|  13.4k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  13.4k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  203|  13.4k|				.public = {
  204|  13.4k|					.lock = _lock,
  205|  13.4k|					.unlock = _unlock,
  206|  13.4k|					.destroy = _mutex_destroy,
  207|  13.4k|				},
  208|  13.4k|			);
  209|       |
  210|  13.4k|			pthread_mutex_init(&this->mutex, NULL);
  211|  13.4k|			profiler_init(&this->profile);
  ------------------
  |  |   96|  13.4k|#define profiler_init(...) {}
  ------------------
  212|       |
  213|  13.4k|			return &this->public;
  214|  13.4k|		}
  215|  15.1k|	}
  216|  15.1k|}
condvar_create:
  317|  8.43k|{
  318|  8.43k|	switch (type)
  319|  8.43k|	{
  320|  8.43k|		case CONDVAR_TYPE_DEFAULT:
  ------------------
  |  Branch (320:3): [True: 8.43k, False: 0]
  ------------------
  321|  8.43k|		default:
  ------------------
  |  Branch (321:3): [True: 0, False: 8.43k]
  ------------------
  322|  8.43k|		{
  323|  8.43k|			private_condvar_t *this;
  324|       |
  325|  8.43k|			INIT(this,
  ------------------
  |  |   44|  8.43k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  8.43k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  326|  8.43k|				.public = {
  327|  8.43k|					.wait = (void*)_wait_,
  328|  8.43k|					.timed_wait = (void*)_timed_wait,
  329|  8.43k|					.timed_wait_abs = (void*)_timed_wait_abs,
  330|  8.43k|					.signal = _signal_,
  331|  8.43k|					.broadcast = _broadcast,
  332|  8.43k|					.destroy = _condvar_destroy,
  333|  8.43k|				}
  334|  8.43k|			);
  335|       |
  336|  8.43k|#ifdef HAVE_PTHREAD_CONDATTR_INIT
  337|  8.43k|			{
  338|  8.43k|				pthread_condattr_t condattr;
  339|  8.43k|				pthread_condattr_init(&condattr);
  340|  8.43k|#ifdef HAVE_CONDATTR_CLOCK_MONOTONIC
  341|  8.43k|				pthread_condattr_setclock(&condattr, TIME_CLOCK_ID);
  ------------------
  |  |   43|  8.43k|#define TIME_CLOCK_ID CLOCK_MONOTONIC
  ------------------
  342|  8.43k|#endif
  343|  8.43k|				pthread_cond_init(&this->condvar, &condattr);
  344|  8.43k|				pthread_condattr_destroy(&condattr);
  345|  8.43k|			}
  346|  8.43k|#endif
  347|       |
  348|  8.43k|			return &this->public;
  349|  8.43k|		}
  350|  8.43k|	}
  351|  8.43k|}
mutex.c:lock:
  103|  11.8k|{
  104|  11.8k|	int err;
  105|       |
  106|  11.8k|	profiler_start(&this->profile);
  ------------------
  |  |   97|  11.8k|#define profiler_start(...) {}
  ------------------
  107|  11.8k|	err = pthread_mutex_lock(&this->mutex);
  108|  11.8k|	if (err)
  ------------------
  |  Branch (108:6): [True: 0, False: 11.8k]
  ------------------
  109|      0|	{
  110|      0|		DBG1(DBG_LIB, "!!! MUTEX LOCK ERROR: %s !!!", strerror(err));
  ------------------
  |  |  133|      0|# define DBG1(...) {}
  ------------------
  111|      0|	}
  112|  11.8k|	profiler_end(&this->profile);
  ------------------
  |  |   98|  11.8k|#define profiler_end(...) {}
  ------------------
  113|  11.8k|}
mutex.c:unlock:
  117|  11.8k|{
  118|  11.8k|	int err;
  119|       |
  120|  11.8k|	err = pthread_mutex_unlock(&this->mutex);
  121|  11.8k|	if (err)
  ------------------
  |  Branch (121:6): [True: 0, False: 11.8k]
  ------------------
  122|      0|	{
  123|      0|		DBG1(DBG_LIB, "!!! MUTEX UNLOCK ERROR: %s !!!", strerror(err));
  ------------------
  |  |  133|      0|# define DBG1(...) {}
  ------------------
  124|      0|	}
  125|  11.8k|}
mutex.c:mutex_destroy_r:
  164|  1.68k|{
  165|  1.68k|	profiler_cleanup(&this->generic.profile);
  ------------------
  |  |   95|  1.68k|#define profiler_cleanup(...) {}
  ------------------
  166|  1.68k|	pthread_mutex_destroy(&this->generic.mutex);
  167|  1.68k|	free(this);
  168|  1.68k|}
mutex.c:mutex_destroy:
  156|  13.4k|{
  157|  13.4k|	profiler_cleanup(&this->profile);
  ------------------
  |  |   95|  13.4k|#define profiler_cleanup(...) {}
  ------------------
  158|  13.4k|	pthread_mutex_destroy(&this->mutex);
  159|  13.4k|	free(this);
  160|  13.4k|}
mutex.c:signal_:
  296|  3.37k|{
  297|  3.37k|	pthread_cond_signal(&this->condvar);
  298|  3.37k|}
mutex.c:broadcast:
  302|  1.68k|{
  303|  1.68k|	pthread_cond_broadcast(&this->condvar);
  304|  1.68k|}
mutex.c:condvar_destroy:
  308|  8.43k|{
  309|  8.43k|	pthread_cond_destroy(&this->condvar);
  310|  8.43k|	free(this);
  311|  8.43k|}

rwlock_create:
  180|  69.1k|{
  181|  69.1k|	switch (type)
  182|  69.1k|	{
  183|  69.1k|		case RWLOCK_TYPE_DEFAULT:
  ------------------
  |  Branch (183:3): [True: 69.1k, False: 0]
  ------------------
  184|  69.1k|		default:
  ------------------
  |  Branch (184:3): [True: 0, False: 69.1k]
  ------------------
  185|  69.1k|		{
  186|  69.1k|			private_rwlock_t *this;
  187|       |
  188|  69.1k|			INIT(this,
  ------------------
  |  |   44|  69.1k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  69.1k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  189|  69.1k|				.public = {
  190|  69.1k|					.read_lock = _read_lock,
  191|  69.1k|					.write_lock = _write_lock,
  192|  69.1k|					.try_write_lock = _try_write_lock,
  193|  69.1k|					.unlock = _unlock,
  194|  69.1k|					.destroy = _destroy,
  195|  69.1k|				}
  196|  69.1k|			);
  197|       |
  198|  69.1k|			pthread_rwlock_init(&this->rwlock, NULL);
  199|  69.1k|			profiler_init(&this->profile);
  ------------------
  |  |   96|  69.1k|#define profiler_init(...) {}
  ------------------
  200|       |
  201|  69.1k|			return &this->public;
  202|  69.1k|		}
  203|  69.1k|	}
  204|  69.1k|}
rwlock.c:read_lock:
  124|  23.6k|{
  125|  23.6k|	int err;
  126|       |
  127|  23.6k|	profiler_start(&this->profile);
  ------------------
  |  |   97|  23.6k|#define profiler_start(...) {}
  ------------------
  128|  23.6k|	err = pthread_rwlock_rdlock(&this->rwlock);
  129|  23.6k|	if (err != 0)
  ------------------
  |  Branch (129:6): [True: 0, False: 23.6k]
  ------------------
  130|      0|	{
  131|      0|		DBG1(DBG_LIB, "!!! RWLOCK READ LOCK ERROR: %s !!!", strerror(err));
  ------------------
  |  |  133|      0|# define DBG1(...) {}
  ------------------
  132|      0|	}
  133|  23.6k|	profiler_end(&this->profile);
  ------------------
  |  |   98|  23.6k|#define profiler_end(...) {}
  ------------------
  134|  23.6k|}
rwlock.c:write_lock:
  138|  25.2k|{
  139|  25.2k|	int err;
  140|       |
  141|  25.2k|	profiler_start(&this->profile);
  ------------------
  |  |   97|  25.2k|#define profiler_start(...) {}
  ------------------
  142|  25.2k|	err = pthread_rwlock_wrlock(&this->rwlock);
  143|  25.2k|	if (err != 0)
  ------------------
  |  Branch (143:6): [True: 0, False: 25.2k]
  ------------------
  144|      0|	{
  145|      0|		DBG1(DBG_LIB, "!!! RWLOCK WRITE LOCK ERROR: %s !!!", strerror(err));
  ------------------
  |  |  133|      0|# define DBG1(...) {}
  ------------------
  146|      0|	}
  147|  25.2k|	profiler_end(&this->profile);
  ------------------
  |  |   98|  25.2k|#define profiler_end(...) {}
  ------------------
  148|  25.2k|}
rwlock.c:unlock:
  158|  48.8k|{
  159|  48.8k|	int err;
  160|       |
  161|  48.8k|	err = pthread_rwlock_unlock(&this->rwlock);
  162|  48.8k|	if (err != 0)
  ------------------
  |  Branch (162:6): [True: 0, False: 48.8k]
  ------------------
  163|      0|	{
  164|      0|		DBG1(DBG_LIB, "!!! RWLOCK UNLOCK ERROR: %s !!!", strerror(err));
  ------------------
  |  |  133|      0|# define DBG1(...) {}
  ------------------
  165|      0|	}
  166|  48.8k|}
rwlock.c:destroy:
  170|  69.1k|{
  171|  69.1k|	pthread_rwlock_destroy(&this->rwlock);
  172|  69.1k|	profiler_cleanup(&this->profile);
  ------------------
  |  |   95|  69.1k|#define profiler_cleanup(...) {}
  ------------------
  173|  69.1k|	free(this);
  174|  69.1k|}

thread_current:
  369|  1.68k|{
  370|  1.68k|	private_thread_t *this;
  371|       |
  372|  1.68k|	this = (private_thread_t*)current_thread->get(current_thread);
  373|  1.68k|	if (!this)
  ------------------
  |  Branch (373:6): [True: 0, False: 1.68k]
  ------------------
  374|      0|	{
  375|      0|		this = thread_create_internal();
  376|      0|		this->id = get_thread_id();
  377|      0|		current_thread->set(current_thread, (void*)this);
  378|      0|	}
  379|  1.68k|	return &this->public;
  380|  1.68k|}
threads_init:
  494|  1.68k|{
  495|  1.68k|	private_thread_t *main_thread = thread_create_internal();
  496|       |
  497|  1.68k|	dummy1 = thread_value_create(NULL);
  498|       |
  499|  1.68k|	next_id = 0;
  500|  1.68k|	main_thread->thread_id = pthread_self();
  501|  1.68k|	current_thread = thread_value_create(NULL);
  502|  1.68k|	current_thread->set(current_thread, (void*)main_thread);
  503|  1.68k|	id_mutex = mutex_create(MUTEX_TYPE_DEFAULT);
  504|  1.68k|	main_thread->id = get_thread_id();
  505|       |
  506|       |#ifndef HAVE_PTHREAD_CANCEL
  507|       |	{	/* install a signal handler for our custom SIG_CANCEL */
  508|       |		struct sigaction action = {
  509|       |			.sa_handler = cancel_signal_handler
  510|       |		};
  511|       |		sigaction(SIG_CANCEL, &action, NULL);
  512|       |	}
  513|       |#endif /* HAVE_PTHREAD_CANCEL */
  514|  1.68k|}
threads_deinit:
  520|  1.68k|{
  521|  1.68k|	private_thread_t *main_thread = (private_thread_t*)thread_current();
  522|       |
  523|  1.68k|	dummy1->destroy(dummy1);
  524|       |
  525|  1.68k|	main_thread->mutex->lock(main_thread->mutex);
  526|  1.68k|	main_thread->terminated = TRUE;
  ------------------
  |  |   44|  1.68k|# define TRUE  true
  ------------------
  527|       |	main_thread->detached_or_joined = TRUE;
  ------------------
  |  |   44|  1.68k|# define TRUE  true
  ------------------
  528|  1.68k|	thread_destroy(main_thread);
  529|  1.68k|	current_thread->destroy(current_thread);
  530|  1.68k|	id_mutex->destroy(id_mutex);
  531|  1.68k|}
thread.c:thread_create_internal:
  264|  1.68k|{
  265|  1.68k|	private_thread_t *this;
  266|       |
  267|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  268|  1.68k|		.public = {
  269|  1.68k|			.cancel = _cancel,
  270|  1.68k|			.kill = _kill_,
  271|  1.68k|			.detach = _detach,
  272|  1.68k|			.join = _join,
  273|  1.68k|		},
  274|  1.68k|		.cleanup_handlers = linked_list_create(),
  275|  1.68k|		.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
  276|  1.68k|	);
  277|       |
  278|  1.68k|	return this;
  279|  1.68k|}
thread.c:thread_destroy:
  149|  1.68k|{
  150|  1.68k|	if (!this->terminated || !this->detached_or_joined)
  ------------------
  |  Branch (150:6): [True: 0, False: 1.68k]
  |  Branch (150:27): [True: 0, False: 1.68k]
  ------------------
  151|      0|	{
  152|      0|		this->mutex->unlock(this->mutex);
  153|      0|		return;
  154|      0|	}
  155|  1.68k|	this->cleanup_handlers->destroy(this->cleanup_handlers);
  156|  1.68k|	this->mutex->unlock(this->mutex);
  157|  1.68k|	this->mutex->destroy(this->mutex);
  158|  1.68k|	free(this);
  159|  1.68k|}
thread.c:get_thread_id:
  165|  1.68k|{
  166|  1.68k|	u_int id;
  167|       |
  168|       |#if defined(USE_THREAD_IDS) && defined(HAVE_GETTID)
  169|       |	id = gettid();
  170|       |#else
  171|  1.68k|	id_mutex->lock(id_mutex);
  172|  1.68k|	id = next_id++;
  173|  1.68k|	id_mutex->unlock(id_mutex);
  174|  1.68k|#endif
  175|  1.68k|	return id;
  176|  1.68k|}

thread_value_create:
   79|  10.1k|{
   80|  10.1k|	private_thread_value_t *this;
   81|       |
   82|  10.1k|	INIT(this,
  ------------------
  |  |   44|  10.1k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  10.1k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
   83|  10.1k|		.public = {
   84|  10.1k|			.set = _set,
   85|  10.1k|			.get = _get,
   86|  10.1k|			.destroy = _destroy,
   87|  10.1k|		},
   88|  10.1k|		.destructor = destructor,
   89|  10.1k|	);
   90|       |
   91|  10.1k|	pthread_key_create(&this->key, destructor);
   92|  10.1k|	return &this->public;
   93|  10.1k|}
thread_value.c:set:
   46|  1.68k|{
   47|  1.68k|	pthread_setspecific(this->key, val);
   48|  1.68k|}
thread_value.c:get:
   52|  1.68k|{
   53|  1.68k|	return pthread_getspecific(this->key);
   54|  1.68k|}
thread_value.c:destroy:
   58|  10.1k|{
   59|  10.1k|	void *val;
   60|       |
   61|       |	/* the destructor is not called automatically for the thread calling
   62|       |	 * pthread_key_delete() */
   63|  10.1k|	if (this->destructor)
  ------------------
  |  Branch (63:6): [True: 5.05k, False: 5.05k]
  ------------------
   64|  5.05k|	{
   65|  5.05k|		val = pthread_getspecific(this->key);
   66|  5.05k|		if (val)
  ------------------
  |  Branch (66:7): [True: 0, False: 5.05k]
  ------------------
   67|      0|		{
   68|      0|			this->destructor(val);
   69|      0|		}
   70|  5.05k|	}
   71|  10.1k|	pthread_key_delete(this->key);
   72|  10.1k|	free(this);
   73|  10.1k|}

backtrace_init:
  472|  1.68k|void backtrace_init() {}
backtrace_deinit:
  473|  1.68k|void backtrace_deinit() {}

capabilities_create:
  499|  1.68k|{
  500|  1.68k|	private_capabilities_t *this;
  501|       |
  502|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  503|  1.68k|		.public = {
  504|  1.68k|			.keep = _keep,
  505|  1.68k|			.check = _check,
  506|  1.68k|			.get_uid = _get_uid,
  507|  1.68k|			.get_gid = _get_gid,
  508|  1.68k|			.set_uid = _set_uid,
  509|  1.68k|			.set_gid = _set_gid,
  510|  1.68k|			.resolve_uid = _resolve_uid,
  511|  1.68k|			.resolve_gid = _resolve_gid,
  512|  1.68k|			.drop = _drop,
  513|  1.68k|			.destroy = _destroy,
  514|  1.68k|		},
  515|  1.68k|	);
  516|       |
  517|       |#ifdef CAPABILITIES_LIBCAP
  518|       |	this->caps = cap_init();
  519|       |#endif /* CAPABILITIES_LIBCAP */
  520|       |
  521|       |#ifdef EMULATE_R_FUNCS
  522|       |	this->mutex = mutex_create(MUTEX_TYPE_DEFAULT);
  523|       |#endif /* EMULATE_R_FUNCS */
  524|       |
  525|  1.68k|	return &this->public;
  526|  1.68k|}
capabilities.c:destroy:
  485|  1.68k|{
  486|       |#ifdef EMULATE_R_FUNCS
  487|       |	this->mutex->destroy(this->mutex);
  488|       |#endif /* EMULATE_R_FUNCS */
  489|       |#ifdef CAPABILITIES_LIBCAP
  490|       |	cap_free(this->caps);
  491|       |#endif /* CAPABILITIES_LIBCAP */
  492|  1.68k|	free(this);
  493|  1.68k|}

chunk_create_clone:
   43|   135k|{
   44|   135k|	chunk_t clone = chunk_empty;
   45|       |
   46|   135k|	if (chunk.ptr && chunk.len > 0)
  ------------------
  |  Branch (46:6): [True: 75.9k, False: 59.7k]
  |  Branch (46:19): [True: 71.1k, False: 4.80k]
  ------------------
   47|  71.1k|	{
   48|  71.1k|		clone.ptr = ptr;
   49|  71.1k|		clone.len = chunk.len;
   50|  71.1k|		memcpy(clone.ptr, chunk.ptr, chunk.len);
  ------------------
  |  |   55|  71.1k|#define memcpy(d,s,n) memcpy_noop(d,s,n)
  ------------------
   51|  71.1k|	}
   52|       |
   53|   135k|	return clone;
   54|   135k|}
chunk_mac:
 1017|  3.40k|{
 1018|  3.40k|	return chunk_mac_inc(chunk, key, 0);
 1019|  3.40k|}
chunk_hash_seed:
 1036|  1.68k|{
 1037|  1.68k|	static bool seeded = FALSE;
  ------------------
  |  |   41|  1.68k|# define FALSE false
  ------------------
 1038|  1.68k|	ssize_t len;
 1039|  1.68k|	size_t done = 0;
 1040|  1.68k|	int fd;
 1041|       |
 1042|  1.68k|	if (seeded)
  ------------------
  |  Branch (1042:6): [True: 1.68k, False: 2]
  ------------------
 1043|  1.68k|	{
 1044|       |		/* just once to have the same seed during the whole process lifetimes */
 1045|  1.68k|		return;
 1046|  1.68k|	}
 1047|       |
 1048|      2|	fd = open("/dev/urandom", O_RDONLY);
 1049|      2|	if (fd >= 0)
  ------------------
  |  Branch (1049:6): [True: 2, False: 0]
  ------------------
 1050|      2|	{
 1051|      4|		while (done < sizeof(hash_key))
  ------------------
  |  Branch (1051:10): [True: 2, False: 2]
  ------------------
 1052|      2|		{
 1053|      2|			len = read(fd, hash_key + done, sizeof(hash_key) - done);
 1054|      2|			if (len < 0)
  ------------------
  |  Branch (1054:8): [True: 0, False: 2]
  ------------------
 1055|      0|			{
 1056|      0|				break;
 1057|      0|			}
 1058|      2|			done += len;
 1059|      2|		}
 1060|      2|		close(fd);
 1061|      2|	}
 1062|       |	/* on error we use random() to generate the key (better than nothing) */
 1063|      2|	if (done < sizeof(hash_key))
  ------------------
  |  Branch (1063:6): [True: 0, False: 2]
  ------------------
 1064|      0|	{
 1065|      0|		srandom(time(NULL) + getpid());
 1066|      0|		for (; done < sizeof(hash_key); done++)
  ------------------
  |  Branch (1066:10): [True: 0, False: 0]
  ------------------
 1067|      0|		{
 1068|      0|			hash_key[done] = (u_char)random();
 1069|      0|		}
 1070|      0|	}
 1071|       |	seeded = TRUE;
  ------------------
  |  |   44|      2|# define TRUE  true
  ------------------
 1072|      2|}
chunk_hash:
 1087|  3.40k|{
 1088|  3.40k|	return chunk_mac(chunk, hash_key);
 1089|  3.40k|}
chunk.c:chunk_mac_inc:
  976|  3.40k|{
  977|  3.40k|	uint64_t v0, v1, v2, v3, k0, k1;
  978|  3.40k|	size_t len = chunk.len;
  979|  3.40k|	u_char *pos = chunk.ptr, *end;
  980|       |
  981|  3.40k|	end = chunk.ptr + len - (len % 8);
  982|       |
  983|  3.40k|	k0 = sipget(key);
  984|  3.40k|	k1 = sipget(key + 8);
  985|       |
  986|  3.40k|	v0 = k0 ^ 0x736f6d6570736575ULL;
  987|  3.40k|	v1 = k1 ^ 0x646f72616e646f6dULL;
  988|  3.40k|	v2 = k0 ^ 0x6c7967656e657261ULL;
  989|  3.40k|	v3 = k1 ^ 0x7465646279746573ULL;
  990|       |
  991|  3.40k|	if (m)
  ------------------
  |  Branch (991:6): [True: 0, False: 3.40k]
  ------------------
  992|      0|	{
  993|      0|		sipcompress(&v0, &v1, &v2, &v3, m);
  994|      0|	}
  995|       |
  996|       |	/* compression with c = 2 */
  997|  3.41k|	for (; pos != end; pos += 8)
  ------------------
  |  Branch (997:9): [True: 4, False: 3.40k]
  ------------------
  998|      4|	{
  999|      4|		m = sipget(pos);
 1000|      4|		sipcompress(&v0, &v1, &v2, &v3, m);
 1001|      4|	}
 1002|  3.40k|	sipcompress(&v0, &v1, &v2, &v3, siplast(len, pos));
 1003|       |
 1004|       |	/* finalization with d = 4 */
 1005|  3.40k|	v2 ^= 0xff;
 1006|  3.40k|	sipround(&v0, &v1, &v2, &v3);
 1007|  3.40k|	sipround(&v0, &v1, &v2, &v3);
 1008|  3.40k|	sipround(&v0, &v1, &v2, &v3);
 1009|  3.40k|	sipround(&v0, &v1, &v2, &v3);
 1010|  3.40k|	return v0 ^ v1 ^ v2  ^ v3;
 1011|  3.40k|}
chunk.c:sipget:
  896|  6.82k|{
  897|  6.82k|	uint64_t v = 0;
  898|  6.82k|	int i;
  899|       |
  900|  61.3k|	for (i = 0; i < 64; i += 8, ++in)
  ------------------
  |  Branch (900:14): [True: 54.5k, False: 6.82k]
  ------------------
  901|  54.5k|	{
  902|  54.5k|		v |= ((uint64_t)*in) << i;
  903|  54.5k|	}
  904|  6.82k|	return v;
  905|  6.82k|}
chunk.c:sipcompress:
  936|  3.41k|{
  937|  3.41k|	*v3 ^= m;
  938|  3.41k|	sipround(v0, v1, v2, v3);
  939|  3.41k|	sipround(v0, v1, v2, v3);
  940|  3.41k|	*v0 ^= m;
  941|  3.41k|}
chunk.c:siplast:
  944|  3.40k|{
  945|  3.40k|	uint64_t b;
  946|  3.40k|	int rem = len & 7;
  947|       |
  948|  3.40k|	b = ((uint64_t)len) << 56;
  949|  3.40k|	switch (rem)
  ------------------
  |  Branch (949:10): [True: 3.40k, False: 0]
  ------------------
  950|  3.40k|	{
  951|      2|		case 7:
  ------------------
  |  Branch (951:3): [True: 2, False: 3.40k]
  ------------------
  952|      2|			b |= ((uint64_t)pos[6]) << 48;
  953|  1.69k|		case 6:
  ------------------
  |  Branch (953:3): [True: 1.69k, False: 1.71k]
  ------------------
  954|  1.69k|			b |= ((uint64_t)pos[5]) << 40;
  955|  1.70k|		case 5:
  ------------------
  |  Branch (955:3): [True: 8, False: 3.40k]
  ------------------
  956|  1.70k|			b |= ((uint64_t)pos[4]) << 32;
  957|  1.71k|		case 4:
  ------------------
  |  Branch (957:3): [True: 8, False: 3.40k]
  ------------------
  958|  1.71k|			b |= ((uint64_t)pos[3]) << 24;
  959|  3.40k|		case 3:
  ------------------
  |  Branch (959:3): [True: 1.69k, False: 1.71k]
  ------------------
  960|  3.40k|			b |= ((uint64_t)pos[2]) << 16;
  961|  3.40k|		case 2:
  ------------------
  |  Branch (961:3): [True: 2, False: 3.40k]
  ------------------
  962|  3.40k|			b |= ((uint64_t)pos[1]) <<  8;
  963|  3.40k|		case 1:
  ------------------
  |  Branch (963:3): [True: 0, False: 3.40k]
  ------------------
  964|  3.40k|			b |= ((uint64_t)pos[0]);
  965|  3.40k|			break;
  966|      0|		case 0:
  ------------------
  |  Branch (966:3): [True: 0, False: 3.40k]
  ------------------
  967|      0|			break;
  968|  3.40k|	}
  969|  3.40k|	return b;
  970|  3.40k|}
chunk.c:sipround:
  914|  20.4k|{
  915|  20.4k|	*v0 += *v1;
  916|  20.4k|	*v1 = siprotate(*v1, 13);
  917|  20.4k|	*v1 ^= *v0;
  918|  20.4k|	*v0 = siprotate(*v0, 32);
  919|       |
  920|  20.4k|	*v2 += *v3;
  921|  20.4k|	*v3 = siprotate(*v3, 16);
  922|  20.4k|	*v3 ^= *v2;
  923|       |
  924|  20.4k|	*v2 += *v1;
  925|  20.4k|	*v1 = siprotate(*v1, 17);
  926|  20.4k|	*v1 ^= *v2;
  927|  20.4k|	*v2 = siprotate(*v2, 32);
  928|       |
  929|  20.4k|	*v0 += *v3;
  930|  20.4k|	*v3 = siprotate(*v3, 21);
  931|  20.4k|	*v3 ^= *v0;
  932|  20.4k|}
chunk.c:siprotate:
  908|   122k|{
  909|   122k|        return (v << shift) | (v >> (64 - shift));
  910|   122k|}

fuzz_pb_tnc.c:chunk_create:
   60|  1.68k|{
   61|  1.68k|	chunk_t chunk = {ptr, len};
   62|  1.68k|	return chunk;
   63|  1.68k|}
pb_tnc_batch.c:chunk_skip:
  299|   227k|{
  300|   227k|	if (chunk.len > bytes)
  ------------------
  |  Branch (300:6): [True: 197k, False: 29.8k]
  ------------------
  301|   197k|	{
  302|   197k|		chunk.ptr += bytes;
  303|   197k|		chunk.len -= bytes;
  304|   197k|		return chunk;
  305|   197k|	}
  306|  29.8k|	return chunk_empty;
  307|   227k|}
pb_language_preference_msg.c:chunk_skip:
  299|    643|{
  300|    643|	if (chunk.len > bytes)
  ------------------
  |  Branch (300:6): [True: 566, False: 77]
  ------------------
  301|    566|	{
  302|    566|		chunk.ptr += bytes;
  303|    566|		chunk.len -= bytes;
  304|    566|		return chunk;
  305|    566|	}
  306|     77|	return chunk_empty;
  307|    643|}
bio_reader.c:chunk_create:
   60|  45.9k|{
   61|  45.9k|	chunk_t chunk = {ptr, len};
   62|  45.9k|	return chunk;
   63|  45.9k|}
hashtable.c:chunk_create:
   60|  3.40k|{
   61|  3.40k|	chunk_t chunk = {ptr, len};
   62|  3.40k|	return chunk;
   63|  3.40k|}

dbg_default_set_level_group:
  103|  1.68k|{
  104|  1.68k|	if (group < DBG_ANY)
  ------------------
  |  Branch (104:6): [True: 0, False: 1.68k]
  ------------------
  105|      0|	{
  106|      0|		default_level[group] = level-1;
  107|      0|	}
  108|  1.68k|	else
  109|  1.68k|	{
  110|  33.7k|		for (group = 0; group < DBG_MAX; group++)
  ------------------
  |  Branch (110:19): [True: 32.0k, False: 1.68k]
  ------------------
  111|  32.0k|		{
  112|  32.0k|			default_level[group] = level-1;
  113|  32.0k|		}
  114|  1.68k|	}
  115|  1.68k|}
dbg_default_set_level:
  133|  1.68k|{
  134|  1.68k|	dbg_default_set_level_group(DBG_ANY, level);
  135|  1.68k|}

parser_helper_create:
  242|  1.68k|{
  243|  1.68k|	private_parser_helper_t *this;
  244|  1.68k|	parser_helper_file_t *sentinel;
  245|       |
  246|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  247|  1.68k|		.public = {
  248|  1.68k|			.context = context,
  249|  1.68k|			.file_include = _file_include,
  250|  1.68k|			.file_next = _file_next,
  251|  1.68k|			.string_init = _string_init,
  252|  1.68k|			.string_add = _string_add,
  253|  1.68k|			.string_get = _string_get,
  254|  1.68k|			.destroy = _destroy,
  255|  1.68k|		},
  256|  1.68k|		.files = array_create(0, 0),
  257|  1.68k|		.writer = bio_writer_create(0),
  258|  1.68k|	);
  259|       |
  260|  1.68k|	INIT(sentinel,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  261|  1.68k|		.name = NULL,
  262|  1.68k|	);
  263|  1.68k|	array_insert(this->files, ARRAY_TAIL, sentinel);
  264|       |
  265|  1.68k|	return &this->public;
  266|  1.68k|}
parser_helper.c:file_include:
  136|  1.68k|{
  137|  1.68k|	parser_helper_file_t *file;
  138|  1.68k|	char pat[PATH_MAX];
  139|       |
  140|  1.68k|	array_get(this->files, ARRAY_TAIL, &file);
  141|  1.68k|	if (!pattern || !*pattern)
  ------------------
  |  Branch (141:6): [True: 0, False: 1.68k]
  |  Branch (141:18): [True: 0, False: 1.68k]
  ------------------
  142|      0|	{
  143|      0|		PARSER_DBG1(&this->public, "no include pattern specified, ignored");
  ------------------
  |  |  145|      0|# define PARSER_DBG1(...) {}
  ------------------
  144|      0|		file->matches = enumerator_create_empty();
  145|      0|		return;
  146|      0|	}
  147|       |
  148|  1.68k|	if (!file->name || path_absolute(pattern))
  ------------------
  |  Branch (148:6): [True: 1.68k, False: 0]
  |  Branch (148:21): [True: 0, False: 0]
  ------------------
  149|  1.68k|	{	/* absolute path */
  150|  1.68k|		if (snprintf(pat, sizeof(pat), "%s", pattern) >= sizeof(pat))
  ------------------
  |  Branch (150:7): [True: 0, False: 1.68k]
  ------------------
  151|      0|		{
  152|      0|			PARSER_DBG1(&this->public, "include pattern too long, ignored");
  ------------------
  |  |  145|      0|# define PARSER_DBG1(...) {}
  ------------------
  153|      0|			file->matches = enumerator_create_empty();
  154|      0|			return;
  155|      0|		}
  156|  1.68k|	}
  157|      0|	else
  158|      0|	{	/* base relative paths to the directory of the current file */
  159|      0|		char *dir = path_dirname(file->name);
  160|      0|		if (snprintf(pat, sizeof(pat), "%s%s%s", dir, DIRECTORY_SEPARATOR,
  ------------------
  |  |   34|      0|# define DIRECTORY_SEPARATOR "/"
  ------------------
  |  Branch (160:7): [True: 0, False: 0]
  ------------------
  161|      0|					 pattern) >= sizeof(pat))
  162|      0|		{
  163|      0|			PARSER_DBG1(&this->public, "include pattern too long, ignored");
  ------------------
  |  |  145|      0|# define PARSER_DBG1(...) {}
  ------------------
  164|      0|			free(dir);
  165|      0|			file->matches = enumerator_create_empty();
  166|      0|			return;
  167|      0|		}
  168|      0|		free(dir);
  169|      0|	}
  170|       |
  171|  1.68k|	file->matches = enumerator_create_glob(pat);
  172|  1.68k|	if (!file->matches)
  ------------------
  |  Branch (172:6): [True: 0, False: 1.68k]
  ------------------
  173|      0|	{	/* if glob(3) is not available, try to load pattern directly */
  174|      0|		file->matches = enumerator_create_single(strdup(pat), free);
  175|      0|	}
  176|  1.68k|}
parser_helper.c:file_next:
   97|  1.68k|{
   98|  1.68k|	parser_helper_file_t *file, *next;
   99|  1.68k|	struct stat st;
  100|  1.68k|	char *name;
  101|       |
  102|  1.68k|	array_get(this->files, ARRAY_TAIL, &file);
  103|  1.68k|	if (!file->matches && file->name)
  ------------------
  |  Branch (103:6): [True: 0, False: 1.68k]
  |  Branch (103:24): [True: 0, False: 0]
  ------------------
  104|      0|	{
  105|      0|		array_remove(this->files, ARRAY_TAIL, NULL);
  106|      0|		parser_helper_file_destroy(file);
  107|       |		/* continue with previous includes, if any */
  108|      0|		array_get(this->files, ARRAY_TAIL, &file);
  109|      0|	}
  110|  1.68k|	if (file->matches)
  ------------------
  |  Branch (110:6): [True: 1.68k, False: 0]
  ------------------
  111|  1.68k|	{
  112|  1.68k|		while (file->matches->enumerate(file->matches, &name, NULL))
  ------------------
  |  Branch (112:10): [True: 0, False: 1.68k]
  ------------------
  113|      0|		{
  114|      0|			INIT(next,
  ------------------
  |  |   44|      0|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|      0|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  115|      0|				.name = strdup(name),
  116|      0|				.file = fopen(name, "r"),
  117|      0|			);
  118|       |
  119|      0|			if (next->file && fstat(fileno(next->file), &st) == 0 &&
  ------------------
  |  Branch (119:8): [True: 0, False: 0]
  |  Branch (119:22): [True: 0, False: 0]
  ------------------
  120|      0|				S_ISREG(st.st_mode))
  ------------------
  |  Branch (120:5): [True: 0, False: 0]
  ------------------
  121|      0|			{
  122|      0|				array_insert(this->files, ARRAY_TAIL, next);
  123|      0|				return next->file;
  124|      0|			}
  125|      0|			PARSER_DBG2(&this->public, "unable to open '%s'", name);
  ------------------
  |  |  148|      0|# define PARSER_DBG2(...) {}
  ------------------
  126|      0|			parser_helper_file_destroy(next);
  127|      0|		}
  128|  1.68k|		file->matches->destroy(file->matches);
  129|  1.68k|		file->matches = NULL;
  130|  1.68k|	}
  131|  1.68k|	return NULL;
  132|  1.68k|}
parser_helper.c:parser_helper_file_destroy:
   70|  1.68k|{
   71|  1.68k|	if (this->file)
  ------------------
  |  Branch (71:6): [True: 0, False: 1.68k]
  ------------------
   72|      0|	{
   73|      0|		fclose(this->file);
   74|      0|	}
   75|  1.68k|	free(this->name);
   76|  1.68k|	DESTROY_IF(this->matches);
  ------------------
  |  |   29|  1.68k|#define DESTROY_IF(obj) if (obj) (obj)->destroy(obj)
  |  |  ------------------
  |  |  |  Branch (29:29): [True: 0, False: 1.68k]
  |  |  ------------------
  ------------------
   77|  1.68k|	free(this);
   78|  1.68k|}
parser_helper.c:destroy:
  205|  1.68k|{
  206|       |	array_destroy_function(this->files, (void*)parser_helper_file_destroy, NULL);
  207|  1.68k|	this->writer->destroy(this->writer);
  208|  1.68k|	free(this);
  209|  1.68k|}

printf_hook_create:
  232|  1.68k|{
  233|  1.68k|	private_printf_hook_t *this;
  234|       |
  235|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.68k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  236|  1.68k|		.public = {
  237|  1.68k|			.add_handler = _add_handler,
  238|  1.68k|			.destroy = _destroy,
  239|  1.68k|		},
  240|  1.68k|	);
  241|       |
  242|  1.68k|	memset(printf_hooks, 0, sizeof(printf_hooks));
  ------------------
  |  |   92|  1.68k|#define memset(s,c,n) memset_noop(s,c,n)
  ------------------
  243|       |
  244|  1.68k|	return &this->public;
  245|  1.68k|}
printf_hook_glibc.c:add_handler:
  149|  15.1k|{
  150|  15.1k|	int i = -1;
  151|  15.1k|	bool failed = FALSE;
  ------------------
  |  |   41|  15.1k|# define FALSE false
  ------------------
  152|  15.1k|	printf_hook_handler_t *handler;
  153|  15.1k|	printf_hook_argtype_t argtype;
  154|  15.1k|	va_list args;
  155|       |
  156|  15.1k|	if (SPEC_TO_INDEX(spec) <= -1 ||
  ------------------
  |  |   77|  15.1k|#define SPEC_TO_INDEX(spec) ((int)(spec) - (int)'A')
  ------------------
  |  Branch (156:6): [True: 0, False: 15.1k]
  ------------------
  157|  15.1k|		SPEC_TO_INDEX(spec) >= countof(printf_hooks))
  ------------------
  |  |   77|  15.1k|#define SPEC_TO_INDEX(spec) ((int)(spec) - (int)'A')
  ------------------
              		SPEC_TO_INDEX(spec) >= countof(printf_hooks))
  ------------------
  |  |  215|  15.1k|#define countof(array) (sizeof(array)/sizeof((array)[0]) \
  |  |  216|  15.1k|						+ BUILD_ASSERT_ARRAY(array))
  |  |  ------------------
  |  |  |  |  114|  15.1k|		BUILD_ASSERT(!__builtin_types_compatible_p(typeof(a), typeof(&(a)[0])))
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|  15.1k|#define BUILD_ASSERT(x) (sizeof(char[(x) ? 0 : -1]))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (157:3): [True: 0, False: 15.1k]
  ------------------
  158|      0|	{
  159|      0|		DBG1(DBG_LIB, "'%c' is not a valid printf hook specifier, "
  ------------------
  |  |  133|      0|# define DBG1(...) {}
  ------------------
  160|      0|			 "not registered!", spec);
  161|      0|		return;
  162|      0|	}
  163|       |
  164|  15.1k|	INIT(handler,
  ------------------
  |  |   44|  15.1k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  15.1k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  165|  15.1k|		.hook = hook,
  166|  15.1k|	);
  167|       |
  168|  15.1k|	va_start(args, hook);
  169|  37.0k|	while (!failed)
  ------------------
  |  Branch (169:9): [True: 37.0k, False: 0]
  ------------------
  170|  37.0k|	{
  171|  37.0k|		argtype = va_arg(args, printf_hook_argtype_t);
  172|       |
  173|  37.0k|		if (argtype == PRINTF_HOOK_ARGTYPE_END)
  ------------------
  |  Branch (173:7): [True: 15.1k, False: 21.9k]
  ------------------
  174|  15.1k|		{
  175|  15.1k|			break;
  176|  15.1k|		}
  177|  21.9k|		if (++i >= countof(handler->argtypes))
  ------------------
  |  |  215|  21.9k|#define countof(array) (sizeof(array)/sizeof((array)[0]) \
  |  |  216|  21.9k|						+ BUILD_ASSERT_ARRAY(array))
  |  |  ------------------
  |  |  |  |  114|  21.9k|		BUILD_ASSERT(!__builtin_types_compatible_p(typeof(a), typeof(&(a)[0])))
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|  21.9k|#define BUILD_ASSERT(x) (sizeof(char[(x) ? 0 : -1]))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (177:7): [True: 0, False: 21.9k]
  ------------------
  178|      0|		{
  179|      0|			DBG1(DBG_LIB, "Too many arguments for printf hook with "
  ------------------
  |  |  133|      0|# define DBG1(...) {}
  ------------------
  180|      0|				 "specifier '%c', not registered!", spec);
  181|      0|			failed = TRUE;
  ------------------
  |  |   44|      0|# define TRUE  true
  ------------------
  182|      0|			break;
  183|      0|		}
  184|  21.9k|		switch (argtype)
  185|  21.9k|		{
  186|  5.05k|			case PRINTF_HOOK_ARGTYPE_INT:
  ------------------
  |  Branch (186:4): [True: 5.05k, False: 16.8k]
  ------------------
  187|  5.05k|				handler->argtypes[i] = PA_INT;
  188|  5.05k|				break;
  189|  16.8k|			case PRINTF_HOOK_ARGTYPE_POINTER:
  ------------------
  |  Branch (189:4): [True: 16.8k, False: 5.05k]
  ------------------
  190|  16.8k|				handler->argtypes[i] = PA_POINTER;
  191|  16.8k|				break;
  192|      0|			default:
  ------------------
  |  Branch (192:4): [True: 0, False: 21.9k]
  ------------------
  193|      0|				DBG1(DBG_LIB, "Invalid printf hook arg type for '%c'", spec);
  ------------------
  |  |  133|      0|# define DBG1(...) {}
  ------------------
  194|      0|				failed = TRUE;
  ------------------
  |  |   44|      0|# define TRUE  true
  ------------------
  195|      0|				break;
  196|  21.9k|		}
  197|  21.9k|	}
  198|  15.1k|	va_end(args);
  199|       |
  200|  15.1k|	handler->numargs = i + 1;
  201|  15.1k|	if (!failed && handler->numargs > 0)
  ------------------
  |  Branch (201:6): [True: 15.1k, False: 0]
  |  Branch (201:17): [True: 15.1k, False: 0]
  ------------------
  202|  15.1k|	{
  203|  15.1k|#	ifdef HAVE_PRINTF_SPECIFIER
  204|  15.1k|		register_printf_specifier(spec, custom_print, custom_arginfo);
  205|       |#	else
  206|       |		register_printf_function(spec, custom_print, custom_arginfo);
  207|       |#	endif
  208|  15.1k|		printf_hooks[SPEC_TO_INDEX(spec)] = handler;
  ------------------
  |  |   77|  15.1k|#define SPEC_TO_INDEX(spec) ((int)(spec) - (int)'A')
  ------------------
  209|  15.1k|	}
  210|      0|	else
  211|      0|	{
  212|      0|		free(handler);
  213|      0|	}
  214|  15.1k|}
printf_hook_glibc.c:destroy:
  218|  1.68k|{
  219|  1.68k|	int i;
  220|       |
  221|  99.4k|	for (i = 0; i < countof(printf_hooks); i++)
  ------------------
  |  |  215|  99.4k|#define countof(array) (sizeof(array)/sizeof((array)[0]) \
  |  |  216|  99.4k|						+ BUILD_ASSERT_ARRAY(array))
  |  |  ------------------
  |  |  |  |  114|  99.4k|		BUILD_ASSERT(!__builtin_types_compatible_p(typeof(a), typeof(&(a)[0])))
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|  99.4k|#define BUILD_ASSERT(x) (sizeof(char[(x) ? 0 : -1]))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (221:14): [True: 97.7k, False: 1.68k]
  ------------------
  222|  97.7k|	{
  223|  97.7k|		free(printf_hooks[i]);
  224|  97.7k|	}
  225|  1.68k|	free(this);
  226|  1.68k|}

return_true:
  276|  1.57k|{
  277|       |	return TRUE;
  ------------------
  |  |   44|  1.57k|# define TRUE  true
  ------------------
  278|  1.57k|}
nop:
  292|    341|{
  293|    341|}
utils_init:
  299|  1.68k|{
  300|       |#ifdef WIN32
  301|       |	windows_init();
  302|       |#endif
  303|  1.68k|	atomics_init();
  304|  1.68k|	strerror_init();
  305|  1.68k|}
utils_deinit:
  311|  1.68k|{
  312|       |#ifdef WIN32
  313|       |	windows_deinit();
  314|       |#endif
  315|  1.68k|	atomics_deinit();
  316|  1.68k|	strerror_deinit();
  317|  1.68k|}

atomics_init:
   97|  1.68k|{
   98|       |#if !defined(HAVE_GCC_ATOMIC_OPERATIONS) && !defined(HAVE_GCC_SYNC_OPERATIONS)
   99|       |	ref_lock = spinlock_create();
  100|       |	cas_lock = spinlock_create();
  101|       |#endif
  102|  1.68k|}
atomics_deinit:
  108|  1.68k|{
  109|       |#if !defined(HAVE_GCC_ATOMIC_OPERATIONS) && !defined(HAVE_GCC_SYNC_OPERATIONS)
  110|       |	ref_lock->destroy(ref_lock);
  111|       |	cas_lock->destroy(cas_lock);
  112|       |#endif
  113|  1.68k|}

bio_reader.c:untoh16:
  157|  27.5k|{
  158|  27.5k|	char *unaligned = (char*)network;
  159|  27.5k|	uint16_t tmp;
  160|       |
  161|  27.5k|	memcpy(&tmp, unaligned, sizeof(tmp));
  162|       |	return ntohs(tmp);
  163|  27.5k|}
bio_reader.c:untoh32:
  172|   323k|{
  173|   323k|	char *unaligned = (char*)network;
  174|   323k|	uint32_t tmp;
  175|       |
  176|   323k|	memcpy(&tmp, unaligned, sizeof(tmp));
  177|       |	return ntohl(tmp);
  178|   323k|}

pb_language_preference_msg.c:memeq:
   34|    788|{
   35|    788|	return memcmp(x, y, len) == 0;
   36|    788|}
bio_reader.c:memcpy_noop:
   49|   185k|{
   50|   185k|	return n ? memcpy(dst, src, n) : dst;
  ------------------
  |  Branch (50:9): [True: 185k, False: 0]
  ------------------
   51|   185k|}
array.c:memmove_noop:
   72|  30.3k|{
   73|  30.3k|	return n ? memmove(dst, src, n) : dst;
  ------------------
  |  Branch (73:9): [True: 0, False: 30.3k]
  ------------------
   74|  30.3k|}
array.c:memcpy_noop:
   49|  50.5k|{
   50|  50.5k|	return n ? memcpy(dst, src, n) : dst;
  ------------------
  |  Branch (50:9): [True: 50.5k, False: 0]
  ------------------
   51|  50.5k|}
plugin_loader.c:memset_noop:
   86|  1.68k|{
   87|  1.68k|	return n ? memset(s, c, n) : s;
  ------------------
  |  Branch (87:9): [True: 1.68k, False: 0]
  ------------------
   88|  1.68k|}
settings_lexer.c:memset_noop:
   86|  1.68k|{
   87|  1.68k|	return n ? memset(s, c, n) : s;
  ------------------
  |  Branch (87:9): [True: 1.68k, False: 0]
  ------------------
   88|  1.68k|}
chunk.c:memcpy_noop:
   49|  71.1k|{
   50|  71.1k|	return n ? memcpy(dst, src, n) : dst;
  ------------------
  |  Branch (50:9): [True: 71.1k, False: 0]
  ------------------
   51|  71.1k|}
printf_hook_glibc.c:memset_noop:
   86|  1.68k|{
   87|  1.68k|	return n ? memset(s, c, n) : s;
  ------------------
  |  Branch (87:9): [True: 1.68k, False: 0]
  ------------------
   88|  1.68k|}

strerror_init:
  131|  1.68k|{
  132|  1.68k|	strerror_buf = thread_value_create(free_no_ld);
  133|       |#ifndef HAVE_STRERROR_R
  134|       |	strerror_lock = spinlock_create();
  135|       |#endif
  136|  1.68k|}
strerror_deinit:
  142|  1.68k|{
  143|  1.68k|	strerror_buf->destroy(strerror_buf);
  144|  1.68k|	strerror_buf = NULL;
  145|       |#ifndef HAVE_STRERROR_R
  146|       |	strerror_lock->destroy(strerror_lock);
  147|       |#endif
  148|  1.68k|}

library.c:strdupnull:
   78|  1.68k|{
   79|  1.68k|	return s ? strdup(s) : NULL;
  ------------------
  |  Branch (79:9): [True: 1.68k, False: 0]
  ------------------
   80|  1.68k|}
settings_parser.c:streq:
   30|  1.68k|{
   31|  1.68k|	return (x == y) || (x && y && strcmp(x, y) == 0);
  ------------------
  |  Branch (31:9): [True: 1.68k, False: 0]
  |  Branch (31:22): [True: 0, False: 0]
  |  Branch (31:27): [True: 0, False: 0]
  |  Branch (31:32): [True: 0, False: 0]
  ------------------
   32|  1.68k|}

pb_tnc_batch_create_from_data:
  607|  1.68k|{
  608|  1.68k|	private_pb_tnc_batch_t *this;
  609|       |
  610|  1.68k|	INIT(this,
  ------------------
  |  |   44|  1.68k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  3.37k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  |  |  ------------------
  |  |  |  Branch (45:39): [True: 1.68k, False: 0]
  |  |  ------------------
  ------------------
  611|  1.68k|		.public = {
  612|  1.68k|			.get_type = _get_type,
  613|  1.68k|			.get_encoding = _get_encoding,
  614|  1.68k|			.add_msg = _add_msg,
  615|  1.68k|			.build = _build,
  616|  1.68k|			.process_header = _process_header,
  617|  1.68k|			.process = _process,
  618|  1.68k|			.create_msg_enumerator = _create_msg_enumerator,
  619|  1.68k|			.create_error_enumerator = _create_error_enumerator,
  620|  1.68k|			.destroy = _destroy,
  621|  1.68k|		},
  622|  1.68k|		.messages = linked_list_create(),
  623|  1.68k|		.errors = linked_list_create(),
  624|  1.68k|		.encoding = chunk_clone(data),
  625|  1.68k|	);
  626|       |
  627|  1.68k|	return &this->public;
  628|  1.68k|}
pb_tnc_batch.c:process:
  510|  1.57k|{
  511|  1.57k|	pb_tnc_msg_t *msg;
  512|  1.57k|	status_t status = SUCCESS;
  513|       |
  514|  1.57k|	if (!state_machine->receive_batch(state_machine, this->type))
  ------------------
  |  Branch (514:6): [True: 0, False: 1.57k]
  ------------------
  515|      0|	{
  516|      0|		DBG1(DBG_TNC, "unexpected PB-TNC batch type: %N",
  ------------------
  |  |  133|      0|# define DBG1(...) {}
  ------------------
  517|      0|					   pb_tnc_batch_type_names, this->type);
  518|      0|		msg = pb_error_msg_create(TRUE, PEN_IETF,
  ------------------
  |  |   44|      0|# define TRUE  true
  ------------------
  519|      0|								  PB_ERROR_UNEXPECTED_BATCH_TYPE);
  520|      0|		this->errors->insert_last(this->errors, msg);
  521|      0|		return FAILED;
  522|      0|	}
  523|       |
  524|       |	/* Register an empty CDATA batch with the state machine */
  525|  1.57k|	if (this->type == PB_BATCH_CDATA)
  ------------------
  |  Branch (525:6): [True: 341, False: 1.23k]
  ------------------
  526|    341|	{
  527|    341|		state_machine->set_empty_cdata(state_machine,
  528|    341|									   this->offset == this->encoding.len);
  529|    341|	}
  530|       |
  531|   138k|	while (this->offset < this->encoding.len)
  ------------------
  |  Branch (531:9): [True: 138k, False: 481]
  ------------------
  532|   138k|	{
  533|   138k|		switch (process_tnc_msg(this))
  534|   138k|		{
  535|  1.09k|			case FAILED:
  ------------------
  |  Branch (535:4): [True: 1.09k, False: 136k]
  ------------------
  536|  1.09k|				return FAILED;
  537|      0|			case VERIFY_ERROR:
  ------------------
  |  Branch (537:4): [True: 0, False: 138k]
  ------------------
  538|      0|				status = VERIFY_ERROR;
  539|      0|				break;
  540|   136k|			case SUCCESS:
  ------------------
  |  Branch (540:4): [True: 136k, False: 1.09k]
  ------------------
  541|   136k|			default:
  ------------------
  |  Branch (541:4): [True: 0, False: 138k]
  ------------------
  542|   136k|				break;
  543|   138k|		}
  544|   138k|	}
  545|    481|	return status;
  546|  1.57k|}
pb_tnc_batch.c:process_tnc_msg:
  326|   138k|{
  327|   138k|	bio_reader_t *reader;
  328|   138k|	pb_tnc_msg_t *pb_tnc_msg, *msg;
  329|   138k|	pb_tnc_msg_info_t *msg_infos;
  330|   138k|	uint8_t flags;
  331|   138k|	uint32_t vendor_id, msg_type, msg_len, offset;
  332|   138k|	chunk_t data, msg_value;
  333|   138k|	bool noskip_flag;
  334|   138k|	enum_name_t *msg_type_names DBG_UNUSED;
  335|   138k|	pen_type_t msg_pen_type;
  336|   138k|	status_t status;
  337|       |
  338|   138k|	data = chunk_skip(this->encoding, this->offset);
  339|       |
  340|   138k|	if (data.len < PB_TNC_MSG_HEADER_SIZE)
  ------------------
  |  |   34|   138k|#define PB_TNC_MSG_HEADER_SIZE		12
  ------------------
  |  Branch (340:6): [True: 134, False: 137k]
  ------------------
  341|    134|	{
  342|    134|		DBG1(DBG_TNC, "%u bytes insufficient to parse PB-TNC message header",
  ------------------
  |  |  133|    134|# define DBG1(...) {}
  ------------------
  343|    134|					  data.len);
  344|    134|		msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
  ------------------
  |  |   44|    134|# define TRUE  true
  ------------------
  345|    134|							PB_ERROR_INVALID_PARAMETER, this->offset);
  346|    134|		goto fatal;
  347|    134|	}
  348|       |
  349|   137k|	reader = bio_reader_create(data);
  350|   137k|	reader->read_uint8 (reader, &flags);
  351|   137k|	reader->read_uint24(reader, &vendor_id);
  352|   137k|	reader->read_uint32(reader, &msg_type);
  353|   137k|	reader->read_uint32(reader, &msg_len);
  354|   137k|	reader->destroy(reader);
  355|       |
  356|   137k|	noskip_flag = (flags & PB_TNC_FLAG_NOSKIP) != PB_TNC_FLAG_NONE;
  ------------------
  |  |   74|   137k|#define PB_TNC_FLAG_NOSKIP			(1<<7)
  ------------------
              	noskip_flag = (flags & PB_TNC_FLAG_NOSKIP) != PB_TNC_FLAG_NONE;
  ------------------
  |  |   73|   137k|#define PB_TNC_FLAG_NONE			0x00
  ------------------
  357|       |
  358|   137k|	if (msg_len > data.len)
  ------------------
  |  Branch (358:6): [True: 203, False: 137k]
  ------------------
  359|    203|	{
  360|    203|		DBG1(DBG_TNC, "%u bytes insufficient to parse PB-TNC message", data.len);
  ------------------
  |  |  133|    203|# define DBG1(...) {}
  ------------------
  361|    203|		msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
  ------------------
  |  |   44|    203|# define TRUE  true
  ------------------
  362|    203|							PB_ERROR_INVALID_PARAMETER, this->offset + 8);
  363|    203|		goto fatal;
  364|    203|	}
  365|       |
  366|   137k|	if (vendor_id == PEN_RESERVED)
  ------------------
  |  Branch (366:6): [True: 4, False: 137k]
  ------------------
  367|      4|	{
  368|      4|		DBG1(DBG_TNC, "Vendor ID 0x%06x is reserved", PEN_RESERVED);
  ------------------
  |  |  133|      4|# define DBG1(...) {}
  ------------------
  369|      4|		msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
  ------------------
  |  |   44|      4|# define TRUE  true
  ------------------
  370|      4|							PB_ERROR_INVALID_PARAMETER, this->offset + 1);
  371|      4|		goto fatal;
  372|       |
  373|      4|	}
  374|       |
  375|   137k|	if (msg_type == PB_TNC_RESERVED_MSG_TYPE)
  ------------------
  |  |   76|   137k|#define PB_TNC_RESERVED_MSG_TYPE	0xffffffff
  ------------------
  |  Branch (375:6): [True: 5, False: 137k]
  ------------------
  376|      5|	{
  377|      5|		DBG1(DBG_TNC, "PB-TNC message Type 0x%08x is reserved",
  ------------------
  |  |  133|      5|# define DBG1(...) {}
  ------------------
  378|      5|			 PB_TNC_RESERVED_MSG_TYPE);
  379|      5|		msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
  ------------------
  |  |   44|      5|# define TRUE  true
  ------------------
  380|      5|							PB_ERROR_INVALID_PARAMETER, this->offset + 4);
  381|      5|		goto fatal;
  382|      5|	}
  383|       |
  384|   137k|	if (vendor_id == PEN_IETF && msg_type <= PB_MSG_ROOF)
  ------------------
  |  Branch (384:6): [True: 71.5k, False: 66.1k]
  |  Branch (384:31): [True: 63.0k, False: 8.47k]
  ------------------
  385|  63.0k|	{
  386|  63.0k|		if (msg_type == PB_MSG_EXPERIMENTAL && noskip_flag)
  ------------------
  |  Branch (386:7): [True: 35.1k, False: 27.9k]
  |  Branch (386:42): [True: 4, False: 35.1k]
  ------------------
  387|      4|		{
  388|      4|			DBG1(DBG_TNC, "reject IETF/PB-Experimental message with "
  ------------------
  |  |  133|      4|# define DBG1(...) {}
  ------------------
  389|      4|						  "NOSKIP flag set");
  390|      4|			msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
  ------------------
  |  |   44|      4|# define TRUE  true
  ------------------
  391|      4|							PB_ERROR_UNSUPPORTED_MANDATORY_MSG, this->offset);
  392|      4|			goto fatal;
  393|      4|		}
  394|  63.0k|		msg_type_names = pb_tnc_msg_type_names;
  395|  63.0k|		msg_infos = pb_tnc_msg_infos;
  396|  63.0k|	}
  397|  74.5k|	else if (vendor_id == PEN_TCG && msg_type <= PB_TCG_MSG_ROOF &&
  ------------------
  |  Branch (397:11): [True: 47.7k, False: 26.8k]
  |  Branch (397:35): [True: 39.6k, False: 8.05k]
  ------------------
  398|  39.6k|									 msg_type >  PB_TCG_MSG_RESERVED)
  ------------------
  |  Branch (398:11): [True: 30.9k, False: 8.68k]
  ------------------
  399|  30.9k|	{
  400|  30.9k|		msg_type_names = pb_tnc_tcg_msg_type_names;
  401|  30.9k|		msg_infos = pb_tnc_tcg_msg_infos;
  402|  30.9k|	}
  403|  43.6k|	else if (vendor_id == PEN_ITA && msg_type <= PB_ITA_MSG_ROOF &&
  ------------------
  |  Branch (403:11): [True: 1.43k, False: 42.1k]
  |  Branch (403:35): [True: 843, False: 595]
  ------------------
  404|    843|									 msg_type >  PB_ITA_MSG_NOSKIP_TEST)
  ------------------
  |  Branch (404:11): [True: 581, False: 262]
  ------------------
  405|    581|	{
  406|    581|		msg_type_names = pb_tnc_ita_msg_type_names;
  407|    581|		msg_infos = pb_tnc_ita_msg_infos;
  408|    581|	}
  409|  43.0k|	else
  410|  43.0k|	{
  411|  43.0k|		if (msg_len < PB_TNC_MSG_HEADER_SIZE)
  ------------------
  |  |   34|  43.0k|#define PB_TNC_MSG_HEADER_SIZE		12
  ------------------
  |  Branch (411:7): [True: 271, False: 42.7k]
  ------------------
  412|    271|		{
  413|    271|			DBG1(DBG_TNC, "%u bytes too small for PB-TNC message length",
  ------------------
  |  |  133|    271|# define DBG1(...) {}
  ------------------
  414|    271|						   msg_len);
  415|    271|			msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
  ------------------
  |  |   44|    271|# define TRUE  true
  ------------------
  416|    271|							PB_ERROR_INVALID_PARAMETER, this->offset + 8);
  417|    271|			goto fatal;
  418|    271|		}
  419|       |
  420|  42.7k|		if (noskip_flag)
  ------------------
  |  Branch (420:7): [True: 15, False: 42.7k]
  ------------------
  421|     15|		{
  422|     15|			DBG1(DBG_TNC, "reject PB-TNC message (0x%06x/0x%08x)",
  ------------------
  |  |  133|     15|# define DBG1(...) {}
  ------------------
  423|     15|						   vendor_id, msg_type);
  424|     15|			msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
  ------------------
  |  |   44|     15|# define TRUE  true
  ------------------
  425|     15|							PB_ERROR_UNSUPPORTED_MANDATORY_MSG, this->offset);
  426|     15|			goto fatal;
  427|     15|		}
  428|  42.7k|		else
  429|  42.7k|		{
  430|  42.7k|			DBG1(DBG_TNC, "ignore PB-TNC message (0x%06x/0x%08x)",
  ------------------
  |  |  133|  42.7k|# define DBG1(...) {}
  ------------------
  431|  42.7k|						   vendor_id, msg_type);
  432|  42.7k|			this->offset += msg_len;
  433|  42.7k|			return SUCCESS;
  434|  42.7k|		}
  435|  42.7k|	}
  436|       |
  437|  94.6k|	if (msg_infos[msg_type].has_noskip_flag != TRUE_OR_FALSE &&
  ------------------
  |  |   92|   189k|#define	TRUE_OR_FALSE	2
  ------------------
  |  Branch (437:6): [True: 59.4k, False: 35.1k]
  ------------------
  438|  59.4k|		msg_infos[msg_type].has_noskip_flag != noskip_flag)
  ------------------
  |  Branch (438:3): [True: 14, False: 59.4k]
  ------------------
  439|     14|	{
  440|     14|		DBG1(DBG_TNC, "%N/%N message must%s have NOSKIP flag set",
  ------------------
  |  |  133|     14|# define DBG1(...) {}
  ------------------
  441|     14|			 pen_names, vendor_id, msg_type_names, msg_type,
  442|     14|			 msg_infos[msg_type].has_noskip_flag ? "" : " not");
  443|     14|		msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
  ------------------
  |  |   44|     14|# define TRUE  true
  ------------------
  444|     14|							PB_ERROR_INVALID_PARAMETER, this->offset);
  445|     14|		goto fatal;
  446|     14|	}
  447|       |
  448|  94.6k|	if (msg_len < msg_infos[msg_type].min_size ||
  ------------------
  |  Branch (448:6): [True: 38, False: 94.6k]
  ------------------
  449|  94.6k|	   (msg_infos[msg_type].exact_size &&
  ------------------
  |  Branch (449:6): [True: 1.79k, False: 92.8k]
  ------------------
  450|  1.79k|		msg_len != msg_infos[msg_type].min_size))
  ------------------
  |  Branch (450:3): [True: 40, False: 1.75k]
  ------------------
  451|     78|	{
  452|     78|		DBG1(DBG_TNC, "%N/%N message length must be %s %u bytes but is %u bytes",
  ------------------
  |  |  133|     78|# define DBG1(...) {}
  ------------------
  453|     78|			 pen_names, vendor_id, msg_type_names, msg_type,
  454|     78|			 msg_infos[msg_type].exact_size ? "exactly" : "at least",
  455|     78|			 msg_infos[msg_type].min_size, msg_len);
  456|     78|		msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
  ------------------
  |  |   44|     78|# define TRUE  true
  ------------------
  457|     78|							PB_ERROR_INVALID_PARAMETER, this->offset);
  458|     78|		goto fatal;
  459|     78|	}
  460|       |
  461|  94.5k|	if (msg_infos[msg_type].in_result_batch && this->type != PB_BATCH_RESULT)
  ------------------
  |  Branch (461:6): [True: 14.1k, False: 80.3k]
  |  Branch (461:45): [True: 5.00k, False: 9.17k]
  ------------------
  462|  5.00k|	{
  463|  5.00k|		if (this->is_server)
  ------------------
  |  Branch (463:7): [True: 0, False: 5.00k]
  ------------------
  464|      0|		{
  465|      0|			DBG1(DBG_TNC,"reject %N/%N message received from a PB-TNC client",
  ------------------
  |  |  133|      0|# define DBG1(...) {}
  ------------------
  466|      0|				 pen_names, vendor_id, msg_type_names, msg_type);
  467|      0|			msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
  ------------------
  |  |   44|      0|# define TRUE  true
  ------------------
  468|      0|								PB_ERROR_INVALID_PARAMETER, this->offset);
  469|      0|			goto fatal;
  470|      0|		}
  471|  5.00k|		else
  472|  5.00k|		{
  473|  5.00k|			DBG1(DBG_TNC,"ignore %N/%N message not received within RESULT batch",
  ------------------
  |  |  133|  5.00k|# define DBG1(...) {}
  ------------------
  474|  5.00k|				 pen_names, vendor_id, msg_type_names, msg_type);
  475|  5.00k|			this->offset += msg_len;
  476|  5.00k|			return SUCCESS;
  477|  5.00k|		}
  478|  5.00k|	}
  479|       |
  480|  89.5k|	DBG2(DBG_TNC, "processing %N/%N message (%u bytes)", pen_names, vendor_id,
  ------------------
  |  |  136|  89.5k|# define DBG2(...) {}
  ------------------
  481|  89.5k|		 msg_type_names, msg_type, msg_len);
  482|  89.5k|	data.len = msg_len;
  483|  89.5k|	msg_value = chunk_skip(data, PB_TNC_MSG_HEADER_SIZE);
  ------------------
  |  |   34|  89.5k|#define PB_TNC_MSG_HEADER_SIZE		12
  ------------------
  484|  89.5k|	msg_pen_type = pen_type_create(vendor_id, msg_type);
  485|  89.5k|	pb_tnc_msg = pb_tnc_msg_create_from_data(msg_pen_type, msg_value);
  486|       |
  487|  89.5k|	status = pb_tnc_msg->process(pb_tnc_msg, &offset);
  488|  89.5k|	if (status == FAILED || status == VERIFY_ERROR)
  ------------------
  |  Branch (488:6): [True: 366, False: 89.1k]
  |  Branch (488:26): [True: 0, False: 89.1k]
  ------------------
  489|    366|	{
  490|    366|		msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
  ------------------
  |  |   44|    366|# define TRUE  true
  ------------------
  491|    366|							PB_ERROR_INVALID_PARAMETER, this->offset + offset);
  492|    366|		this->errors->insert_last(this->errors, msg);
  493|    366|	}
  494|  89.5k|	if (status == FAILED)
  ------------------
  |  Branch (494:6): [True: 366, False: 89.1k]
  ------------------
  495|    366|	{
  496|    366|		pb_tnc_msg->destroy(pb_tnc_msg);
  497|    366|		return FAILED;
  498|    366|	}
  499|  89.1k|	this->messages->insert_last(this->messages, pb_tnc_msg);
  500|  89.1k|	this->offset += msg_len;
  501|  89.1k|	return status;
  502|       |
  503|    728|fatal:
  504|    728|	this->errors->insert_last(this->errors, msg);
  505|    728|	return FAILED;
  506|  89.5k|}
pb_tnc_batch.c:create_msg_enumerator:
  550|  1.68k|{
  551|  1.68k|	return this->messages->create_enumerator(this->messages);
  552|  1.68k|}
pb_tnc_batch.c:create_error_enumerator:
  556|  1.68k|{
  557|  1.68k|	return this->errors->create_enumerator(this->errors);
  558|  1.68k|}
pb_tnc_batch.c:destroy:
  562|  1.68k|{
  563|  1.68k|	this->messages->destroy_offset(this->messages,
  564|  1.68k|								   offsetof(pb_tnc_msg_t, destroy));
  565|  1.68k|	this->errors->destroy_offset(this->errors,
  566|       |								   offsetof(pb_tnc_msg_t, destroy));
  567|  1.68k|	free(this->encoding.ptr);
  568|  1.68k|	free(this);
  569|  1.68k|}
pb_tnc_batch.c:process_header:
  249|  2.87k|{
  250|  2.87k|	bio_reader_t *reader;
  251|  2.87k|	pb_tnc_msg_t *msg;
  252|  2.87k|	pb_error_msg_t *err_msg;
  253|  2.87k|	uint8_t version, flags, reserved, type;
  254|  2.87k|	uint32_t batch_len;
  255|       |
  256|  2.87k|	if (this->encoding.len < PB_TNC_BATCH_HEADER_SIZE)
  ------------------
  |  |   33|  2.87k|#define PB_TNC_BATCH_HEADER_SIZE	 8
  ------------------
  |  Branch (256:6): [True: 8, False: 2.86k]
  ------------------
  257|      8|	{
  258|      8|		DBG1(DBG_TNC, "%u bytes insufficient to parse PB-TNC batch header",
  ------------------
  |  |  133|      8|# define DBG1(...) {}
  ------------------
  259|      8|					   this->encoding.len);
  260|      8|		msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
  ------------------
  |  |   44|      8|# define TRUE  true
  ------------------
  261|      8|							PB_ERROR_INVALID_PARAMETER, 0);
  262|      8|		goto fatal;
  263|      8|	}
  264|       |
  265|  2.86k|	reader = bio_reader_create(this->encoding);
  266|  2.86k|	reader->read_uint8 (reader, &version);
  267|  2.86k|	reader->read_uint8 (reader, &flags);
  268|  2.86k|	reader->read_uint8 (reader, &reserved);
  269|  2.86k|	reader->read_uint8 (reader, &type);
  270|  2.86k|	reader->read_uint32(reader, &batch_len);
  271|  2.86k|	reader->destroy(reader);
  272|       |
  273|       |	/* Version */
  274|  2.86k|	if (version != PB_TNC_VERSION)
  ------------------
  |  |   32|  2.86k|#define PB_TNC_VERSION		2
  ------------------
  |  Branch (274:6): [True: 38, False: 2.82k]
  ------------------
  275|     38|	{
  276|     38|		DBG1(DBG_TNC, "unsupported TNCCS batch version 0x%02x", version);
  ------------------
  |  |  133|     38|# define DBG1(...) {}
  ------------------
  277|     38|		msg = pb_error_msg_create(TRUE, PEN_IETF,
  ------------------
  |  |   44|     38|# define TRUE  true
  ------------------
  278|     38|								  PB_ERROR_VERSION_NOT_SUPPORTED);
  279|     38|		err_msg = (pb_error_msg_t*)msg;
  280|     38|		err_msg->set_bad_version(err_msg, version);
  281|     38|		goto fatal;
  282|     38|	}
  283|       |
  284|       |	/* Directionality */
  285|  2.82k|	*from_server = (flags & PB_TNC_BATCH_FLAG_D) != PB_TNC_BATCH_FLAG_NONE;
  ------------------
  |  |   55|  2.82k|#define PB_TNC_BATCH_FLAG_D			(1<<7)
  ------------------
              	*from_server = (flags & PB_TNC_BATCH_FLAG_D) != PB_TNC_BATCH_FLAG_NONE;
  ------------------
  |  |   54|  2.82k|#define PB_TNC_BATCH_FLAG_NONE		0x00
  ------------------
  286|       |
  287|  2.82k|	if (directionality & (*from_server == is_server))
  ------------------
  |  Branch (287:6): [True: 1.16k, False: 1.66k]
  ------------------
  288|  1.16k|	{
  289|  1.16k|		DBG1(DBG_TNC, "wrong Directionality: batch is from a PB-TNC %s",
  ------------------
  |  |  133|  1.16k|# define DBG1(...) {}
  ------------------
  290|  1.16k|					   is_server ? "server" : "client");
  291|  1.16k|		msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
  ------------------
  |  |   44|  1.16k|# define TRUE  true
  ------------------
  292|  1.16k|					   PB_ERROR_INVALID_PARAMETER, 1);
  293|  1.16k|		goto fatal;
  294|  1.16k|	}
  295|       |
  296|       |	/* Batch Type */
  297|  1.66k|	this->type = type & 0x0F;
  298|  1.66k|	if (this->type > PB_BATCH_ROOF)
  ------------------
  |  Branch (298:6): [True: 5, False: 1.65k]
  ------------------
  299|      5|	{
  300|      5|		DBG1(DBG_TNC, "unknown PB-TNC batch type: %d", this->type);
  ------------------
  |  |  133|      5|# define DBG1(...) {}
  ------------------
  301|      5|		msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
  ------------------
  |  |   44|      5|# define TRUE  true
  ------------------
  302|      5|							PB_ERROR_INVALID_PARAMETER, 3);
  303|      5|		goto fatal;
  304|      5|	}
  305|       |
  306|       |	/* Batch Length */
  307|  1.65k|	if (this->encoding.len != batch_len)
  ------------------
  |  Branch (307:6): [True: 83, False: 1.57k]
  ------------------
  308|     83|	{
  309|     83|		DBG1(DBG_TNC, "%u bytes of data is not equal to batch length of %u bytes",
  ------------------
  |  |  133|     83|# define DBG1(...) {}
  ------------------
  310|     83|					   this->encoding.len, batch_len);
  311|     83|		msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
  ------------------
  |  |   44|     83|# define TRUE  true
  ------------------
  312|     83|							PB_ERROR_INVALID_PARAMETER, 4);
  313|     83|		goto fatal;
  314|     83|	}
  315|       |
  316|  1.57k|	this->offset = PB_TNC_BATCH_HEADER_SIZE;
  ------------------
  |  |   33|  1.57k|#define PB_TNC_BATCH_HEADER_SIZE	 8
  ------------------
  317|       |
  318|  1.57k|	return SUCCESS;
  319|       |
  320|  1.29k|fatal:
  321|  1.29k|	this->errors->insert_last(this->errors, msg);
  322|  1.29k|	return FAILED;
  323|  1.65k|}

pb_access_recommendation_msg_create_from_data:
  138|    699|{
  139|    699|	private_pb_access_recommendation_msg_t *this;
  140|       |
  141|    699|	INIT(this,
  ------------------
  |  |   44|    699|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.39k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  |  |  ------------------
  |  |  |  Branch (45:39): [True: 699, False: 0]
  |  |  ------------------
  ------------------
  142|    699|		.public = {
  143|    699|			.pb_interface = {
  144|    699|				.get_type = _get_type,
  145|    699|				.get_encoding = _get_encoding,
  146|    699|				.build = _build,
  147|    699|				.process = _process,
  148|    699|				.destroy = _destroy,
  149|    699|			},
  150|    699|			.get_access_recommendation = _get_access_recommendation,
  151|    699|		},
  152|    699|		.type = { PEN_IETF, PB_MSG_ACCESS_RECOMMENDATION },
  153|    699|		.encoding = chunk_clone(data),
  154|    699|	);
  155|       |
  156|    699|	return &this->public.pb_interface;
  157|    699|}
pb_access_recommendation_msg.c:get_type:
   71|    675|{
   72|    675|	return this->type;
   73|    675|}
pb_access_recommendation_msg.c:process:
  100|    699|{
  101|    699|	bio_reader_t *reader;
  102|    699|	uint16_t reserved;
  103|       |
  104|    699|	reader = bio_reader_create(this->encoding);
  105|    699|	reader->read_uint16(reader, &reserved);
  106|    699|	reader->read_uint16(reader, &this->recommendation);
  107|    699|	reader->destroy(reader);
  108|       |
  109|    699|	if (this->recommendation < PB_REC_ACCESS_ALLOWED ||
  ------------------
  |  Branch (109:6): [True: 2, False: 697]
  ------------------
  110|    697|		this->recommendation > PB_REC_QUARANTINED)
  ------------------
  |  Branch (110:3): [True: 22, False: 675]
  ------------------
  111|     24|	{
  112|     24|		DBG1(DBG_TNC, "invalid access recommendation code (%u)",
  ------------------
  |  |  133|     24|# define DBG1(...) {}
  ------------------
  113|     24|					   this->recommendation);
  114|     24|		*offset = 2;
  115|     24|		return FAILED;
  116|     24|	}
  117|       |
  118|    675|	return SUCCESS;
  119|    699|}
pb_access_recommendation_msg.c:destroy:
  123|    699|{
  124|    699|	free(this->encoding.ptr);
  125|    699|	free(this);
  126|    699|}

pb_assessment_result_msg_create_from_data:
  131|    466|{
  132|    466|	private_pb_assessment_result_msg_t *this;
  133|       |
  134|    466|	INIT(this,
  ------------------
  |  |   44|    466|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|    932|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  |  |  ------------------
  |  |  |  Branch (45:39): [True: 466, False: 0]
  |  |  ------------------
  ------------------
  135|    466|		.public = {
  136|    466|			.pb_interface = {
  137|    466|				.get_type = _get_type,
  138|    466|				.get_encoding = _get_encoding,
  139|    466|				.build = _build,
  140|    466|				.process = _process,
  141|    466|				.destroy = _destroy,
  142|    466|			},
  143|    466|			.get_assessment_result = _get_assessment_result,
  144|    466|		},
  145|    466|		.type = { PEN_IETF, PB_MSG_ASSESSMENT_RESULT },
  146|    466|		.encoding = chunk_clone(data),
  147|    466|	);
  148|       |
  149|    466|	return &this->public.pb_interface;
  150|    466|}
pb_assessment_result_msg.c:get_type:
   67|    425|{
   68|    425|	return this->type;
   69|    425|}
pb_assessment_result_msg.c:process:
   95|    466|{
   96|    466|	bio_reader_t *reader;
   97|       |
   98|    466|	reader = bio_reader_create(this->encoding);
   99|    466|	reader->read_uint32(reader, &this->assessment_result);
  100|    466|	reader->destroy(reader);
  101|       |
  102|    466|	if (this->assessment_result < TNC_IMV_EVALUATION_RESULT_COMPLIANT ||
  ------------------
  |  |  199|    932|#define TNC_IMV_EVALUATION_RESULT_COMPLIANT 0
  ------------------
  |  Branch (102:6): [True: 0, False: 466]
  ------------------
  103|    466|		this->assessment_result > TNC_IMV_EVALUATION_RESULT_DONT_KNOW)
  ------------------
  |  |  203|    466|#define TNC_IMV_EVALUATION_RESULT_DONT_KNOW 4
  ------------------
  |  Branch (103:3): [True: 41, False: 425]
  ------------------
  104|     41|	{
  105|     41|		DBG1(DBG_TNC, "invalid assessment result (%u)",
  ------------------
  |  |  133|     41|# define DBG1(...) {}
  ------------------
  106|     41|					   this->assessment_result);
  107|     41|		*offset = 0;
  108|     41|		return FAILED;
  109|     41|	}
  110|       |
  111|    425|	return SUCCESS;
  112|    466|}
pb_assessment_result_msg.c:destroy:
  116|    466|{
  117|    466|	free(this->encoding.ptr);
  118|    466|	free(this);
  119|    466|}

pb_error_msg_create:
  255|     38|{
  256|     38|	private_pb_error_msg_t *this;
  257|       |
  258|     38|	INIT(this,
  ------------------
  |  |   44|     38|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|     38|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  259|     38|		.public = {
  260|     38|			.pb_interface = {
  261|     38|				.get_type = _get_type,
  262|     38|				.get_encoding = _get_encoding,
  263|     38|				.build = _build,
  264|     38|				.process = _process,
  265|     38|				.get_ref = _get_ref,
  266|     38|				.destroy = _destroy,
  267|     38|			},
  268|     38|			.get_fatal_flag = _get_fatal_flag,
  269|     38|			.get_vendor_id = _get_vendor_id,
  270|     38|			.get_error_code = _get_error_code,
  271|     38|			.get_offset = _get_offset,
  272|     38|			.get_bad_version = _get_bad_version,
  273|     38|			.set_bad_version = _set_bad_version,
  274|     38|		},
  275|     38|		.type = { PEN_IETF, PB_MSG_ERROR },
  276|     38|		.ref = 1,
  277|     38|		.fatal = fatal,
  278|     38|		.vendor_id = vendor_id,
  279|     38|		.error_code = error_code,
  280|     38|	);
  281|       |
  282|     38|	return &this->public.pb_interface;
  283|     38|}
pb_error_msg_create_with_offset:
  291|  2.35k|{
  292|  2.35k|	private_pb_error_msg_t *this;
  293|       |
  294|  2.35k|	INIT(this,
  ------------------
  |  |   44|  2.35k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  2.35k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  ------------------
  295|  2.35k|		.public = {
  296|  2.35k|			.pb_interface = {
  297|  2.35k|				.get_type = _get_type,
  298|  2.35k|				.get_encoding = _get_encoding,
  299|  2.35k|				.build = _build,
  300|  2.35k|				.process = _process,
  301|  2.35k|				.get_ref = _get_ref,
  302|  2.35k|				.destroy = _destroy,
  303|  2.35k|			},
  304|  2.35k|			.get_fatal_flag = _get_fatal_flag,
  305|  2.35k|			.get_vendor_id = _get_vendor_id,
  306|  2.35k|			.get_error_code = _get_error_code,
  307|  2.35k|			.get_offset = _get_offset,
  308|  2.35k|			.get_bad_version = _get_bad_version,
  309|  2.35k|			.set_bad_version = _set_bad_version,
  310|  2.35k|		},
  311|  2.35k|		.type = { PEN_IETF, PB_MSG_ERROR },
  312|  2.35k|		.ref = 1,
  313|  2.35k|		.fatal = fatal,
  314|  2.35k|		.vendor_id = vendor_id,
  315|  2.35k|		.error_code = error_code,
  316|  2.35k|		.error_offset = error_offset,
  317|  2.35k|	);
  318|       |
  319|  2.35k|	return &this->public.pb_interface;
  320|  2.35k|}
pb_error_msg_create_from_data:
  326|  11.5k|{
  327|  11.5k|	private_pb_error_msg_t *this;
  328|       |
  329|  11.5k|	INIT(this,
  ------------------
  |  |   44|  11.5k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  23.0k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  |  |  ------------------
  |  |  |  Branch (45:39): [True: 11.5k, False: 0]
  |  |  ------------------
  ------------------
  330|  11.5k|		.public = {
  331|  11.5k|			.pb_interface = {
  332|  11.5k|				.get_type = _get_type,
  333|  11.5k|				.get_encoding = _get_encoding,
  334|  11.5k|				.build = _build,
  335|  11.5k|				.process = _process,
  336|  11.5k|				.get_ref = _get_ref,
  337|  11.5k|				.destroy = _destroy,
  338|  11.5k|			},
  339|  11.5k|			.get_fatal_flag = _get_fatal_flag,
  340|  11.5k|			.get_vendor_id = _get_vendor_id,
  341|  11.5k|			.get_error_code = _get_error_code,
  342|  11.5k|			.get_offset = _get_offset,
  343|  11.5k|			.get_bad_version = _get_bad_version,
  344|  11.5k|			.set_bad_version = _set_bad_version,
  345|  11.5k|		},
  346|  11.5k|		.type = { PEN_IETF, PB_MSG_ERROR },
  347|  11.5k|		.ref = 1,
  348|  11.5k|		.encoding = chunk_clone(data),
  349|  11.5k|	);
  350|       |
  351|  11.5k|	return &this->public.pb_interface;
  352|  11.5k|}
pb_error_msg.c:get_type:
  109|  11.5k|{
  110|  11.5k|	return this->type;
  111|  11.5k|}
pb_error_msg.c:process:
  158|  11.5k|{
  159|  11.5k|	uint8_t flags, max_version, min_version;
  160|  11.5k|	uint16_t reserved;
  161|  11.5k|	bio_reader_t *reader;
  162|       |
  163|  11.5k|	if (this->encoding.len < ERROR_HEADER_SIZE)
  ------------------
  |  |   54|  11.5k|#define ERROR_HEADER_SIZE	8
  ------------------
  |  Branch (163:6): [True: 0, False: 11.5k]
  ------------------
  164|      0|	{
  165|      0|		DBG1(DBG_TNC,"%N message is shorter than header size of %u bytes",
  ------------------
  |  |  133|      0|# define DBG1(...) {}
  ------------------
  166|      0|			 pb_tnc_msg_type_names, PB_MSG_ERROR, ERROR_HEADER_SIZE);
  167|      0|		*offset = 0;
  168|      0|		return FAILED;
  169|      0|	}
  170|       |
  171|       |	/* process message header */
  172|  11.5k|	reader = bio_reader_create(this->encoding);
  173|  11.5k|	reader->read_uint8 (reader, &flags);
  174|  11.5k|	reader->read_uint24(reader, &this->vendor_id);
  175|  11.5k|	reader->read_uint16(reader, &this->error_code);
  176|  11.5k|	reader->read_uint16(reader, &reserved);
  177|  11.5k|	this->fatal = (flags & ERROR_FLAG_FATAL) != ERROR_FLAG_NONE;
  ------------------
  |  |   52|  11.5k|#define ERROR_FLAG_FATAL	(1<<7)
  ------------------
              	this->fatal = (flags & ERROR_FLAG_FATAL) != ERROR_FLAG_NONE;
  ------------------
  |  |   51|  11.5k|#define ERROR_FLAG_NONE		0x00
  ------------------
  178|       |
  179|  11.5k|	if (this->vendor_id == PEN_IETF && reader->remaining(reader) == 4)
  ------------------
  |  Branch (179:6): [True: 7.63k, False: 3.90k]
  |  Branch (179:37): [True: 3.32k, False: 4.30k]
  ------------------
  180|  3.32k|	{
  181|  3.32k|		if (this->error_code == PB_ERROR_VERSION_NOT_SUPPORTED)
  ------------------
  |  Branch (181:7): [True: 1.08k, False: 2.24k]
  ------------------
  182|  1.08k|		{
  183|  1.08k|			reader->read_uint8(reader, &this->bad_version);
  184|  1.08k|			reader->read_uint8(reader, &max_version);
  185|  1.08k|			reader->read_uint8(reader, &min_version);
  186|  1.08k|		}
  187|  2.24k|		else
  188|  2.24k|		{
  189|  2.24k|			reader->read_uint32(reader, &this->error_offset);
  190|  2.24k|		}
  191|  3.32k|	}
  192|  11.5k|	reader->destroy(reader);
  193|       |
  194|  11.5k|	return SUCCESS;
  195|  11.5k|}
pb_error_msg.c:destroy:
  206|  13.9k|{
  207|  13.9k|	if (ref_put(&this->ref))
  ------------------
  |  |   54|  13.9k|#define ref_put(ref) (!__atomic_sub_fetch(ref, 1, __ATOMIC_ACQ_REL))
  |  |  ------------------
  |  |  |  Branch (54:22): [True: 13.9k, False: 0]
  |  |  ------------------
  ------------------
  208|  13.9k|	{
  209|  13.9k|		free(this->encoding.ptr);
  210|  13.9k|		free(this);
  211|  13.9k|	}
  212|  13.9k|}
pb_error_msg.c:get_error_code:
  228|  2.39k|{
  229|  2.39k|	return this->error_code;
  230|  2.39k|}
pb_error_msg.c:set_bad_version:
  246|     38|{
  247|     38|	this->bad_version = version;
  248|     38|}

pb_experimental_msg_create_from_data:
   77|  35.1k|{
   78|  35.1k|	private_pb_experimental_msg_t *this;
   79|       |
   80|  35.1k|	INIT(this,
  ------------------
  |  |   44|  35.1k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  70.3k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  |  |  ------------------
  |  |  |  Branch (45:39): [True: 5.28k, False: 29.8k]
  |  |  ------------------
  ------------------
   81|  35.1k|		.public = {
   82|  35.1k|			.pb_interface = {
   83|  35.1k|				.get_type = _get_type,
   84|  35.1k|				.get_encoding = _get_encoding,
   85|  35.1k|				.build = _build,
   86|  35.1k|				.process = _process,
   87|  35.1k|				.destroy = _destroy,
   88|  35.1k|			},
   89|  35.1k|		},
   90|  35.1k|		.type = { PEN_IETF, PB_MSG_EXPERIMENTAL },
   91|  35.1k|		.encoding = chunk_clone(data),
   92|  35.1k|	);
   93|       |
   94|  35.1k|	return &this->public.pb_interface;
   95|  35.1k|}
pb_experimental_msg.c:get_type:
   44|  35.1k|{
   45|  35.1k|	return this->type;
   46|  35.1k|}
pb_experimental_msg.c:process:
   62|  35.1k|{
   63|  35.1k|	return SUCCESS;
   64|  35.1k|}
pb_experimental_msg.c:destroy:
   68|  35.1k|{
   69|  35.1k|	free(this->encoding.ptr);
   70|  35.1k|	free(this);
   71|  35.1k|}

pb_language_preference_msg_create_from_data:
  136|    800|{
  137|    800|	private_pb_language_preference_msg_t *this;
  138|       |
  139|    800|	INIT(this,
  ------------------
  |  |   44|    800|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.60k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  |  |  ------------------
  |  |  |  Branch (45:39): [True: 799, False: 1]
  |  |  ------------------
  ------------------
  140|    800|		.public = {
  141|    800|			.pb_interface = {
  142|    800|				.get_type = _get_type,
  143|    800|				.get_encoding = _get_encoding,
  144|    800|				.build = _build,
  145|    800|				.process = _process,
  146|    800|				.destroy = _destroy,
  147|    800|			},
  148|    800|			.get_language_preference = _get_language_preference,
  149|    800|		},
  150|    800|		.type = { PEN_IETF, PB_MSG_LANGUAGE_PREFERENCE },
  151|    800|		.encoding = chunk_clone(data),
  152|    800|	);
  153|       |
  154|    800|	return &this->public.pb_interface;
  155|    800|}
pb_language_preference_msg.c:get_type:
   66|    634|{
   67|    634|	return this->type;
   68|    634|}
pb_language_preference_msg.c:process:
   90|    800|{
   91|    800|	chunk_t lang;
   92|       |
   93|    800|	if (this->encoding.len >= PB_LANG_PREFIX_LEN &&
  ------------------
  |  |   36|  1.60k|#define PB_LANG_PREFIX_LEN		strlen(PB_LANG_PREFIX)
  |  |  ------------------
  |  |  |  |   35|    800|#define PB_LANG_PREFIX			"Accept-Language: "
  |  |  ------------------
  ------------------
  |  Branch (93:6): [True: 788, False: 12]
  ------------------
   94|    788|		memeq(this->encoding.ptr, PB_LANG_PREFIX, PB_LANG_PREFIX_LEN))
  ------------------
  |  |   35|    788|#define PB_LANG_PREFIX			"Accept-Language: "
  ------------------
              		memeq(this->encoding.ptr, PB_LANG_PREFIX, PB_LANG_PREFIX_LEN))
  ------------------
  |  |   36|    788|#define PB_LANG_PREFIX_LEN		strlen(PB_LANG_PREFIX)
  |  |  ------------------
  |  |  |  |   35|    788|#define PB_LANG_PREFIX			"Accept-Language: "
  |  |  ------------------
  ------------------
  |  Branch (94:3): [True: 643, False: 145]
  ------------------
   95|    643|	{
   96|    643|		lang = chunk_skip(this->encoding, PB_LANG_PREFIX_LEN);
  ------------------
  |  |   36|    643|#define PB_LANG_PREFIX_LEN		strlen(PB_LANG_PREFIX)
  |  |  ------------------
  |  |  |  |   35|    643|#define PB_LANG_PREFIX			"Accept-Language: "
  |  |  ------------------
  ------------------
   97|    643|		this->language_preference = lang.len ? chunk_clone(lang) : chunk_empty;
  ------------------
  |  |  278|    566|#define chunk_clone(chunk) ({chunk_t x = (chunk); chunk_create_clone(x.len ? malloc(x.len) : NULL, x);})
  |  |  ------------------
  |  |  |  Branch (278:70): [True: 566, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (97:31): [True: 566, False: 77]
  ------------------
   98|    643|	}
   99|    157|	else
  100|    157|    {
  101|    157|		DBG1(DBG_TNC, "language preference must be preceded by '%s'",
  ------------------
  |  |  133|    157|# define DBG1(...) {}
  ------------------
  102|    157|					   PB_LANG_PREFIX);
  103|    157|		*offset = 0;
  104|    157|		return FAILED;
  105|    157|	}
  106|       |
  107|    643|	if (this->language_preference.len &&
  ------------------
  |  Branch (107:6): [True: 566, False: 77]
  ------------------
  108|    566|		this->language_preference.ptr[this->language_preference.len-1] == '\0')
  ------------------
  |  Branch (108:3): [True: 9, False: 557]
  ------------------
  109|      9|	{
  110|      9|		DBG1(DBG_TNC, "language preference must not be null terminated");
  ------------------
  |  |  133|      9|# define DBG1(...) {}
  ------------------
  111|      9|		*offset = PB_LANG_PREFIX_LEN + this->language_preference.len - 1;
  ------------------
  |  |   36|      9|#define PB_LANG_PREFIX_LEN		strlen(PB_LANG_PREFIX)
  |  |  ------------------
  |  |  |  |   35|      9|#define PB_LANG_PREFIX			"Accept-Language: "
  |  |  ------------------
  ------------------
  112|      9|		return FAILED;
  113|      9|	}
  114|       |
  115|    634|	return SUCCESS;
  116|    643|}
pb_language_preference_msg.c:destroy:
  120|    800|{
  121|    800|	free(this->encoding.ptr);
  122|    800|	free(this->language_preference.ptr);
  123|    800|	free(this);
  124|    800|}

pb_pa_msg_create_from_data:
  218|  1.32k|{
  219|  1.32k|	private_pb_pa_msg_t *this;
  220|       |
  221|  1.32k|	INIT(this,
  ------------------
  |  |   44|  1.32k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  2.64k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  |  |  ------------------
  |  |  |  Branch (45:39): [True: 1.32k, False: 0]
  |  |  ------------------
  ------------------
  222|  1.32k|		.public = {
  223|  1.32k|			.pb_interface = {
  224|  1.32k|				.get_type = _get_type,
  225|  1.32k|				.get_encoding = _get_encoding,
  226|  1.32k|				.process = _process,
  227|  1.32k|				.destroy = _destroy,
  228|  1.32k|			},
  229|  1.32k|			.get_subtype = _get_subtype,
  230|  1.32k|			.get_collector_id = _get_collector_id,
  231|  1.32k|			.get_validator_id = _get_validator_id,
  232|  1.32k|			.get_body = _get_body,
  233|  1.32k|			.get_exclusive_flag = _get_exclusive_flag,
  234|  1.32k|		},
  235|  1.32k|		.type = { PEN_IETF, PB_MSG_PA },
  236|  1.32k|		.encoding = chunk_clone(data),
  237|  1.32k|	);
  238|       |
  239|  1.32k|	return &this->public.pb_interface;
  240|  1.32k|}
pb_pa_msg.c:get_type:
   99|  1.31k|{
  100|  1.31k|	return this->type;
  101|  1.31k|}
pb_pa_msg.c:process:
  136|  1.32k|{
  137|  1.32k|	uint8_t flags;
  138|  1.32k|	size_t msg_body_len;
  139|  1.32k|	bio_reader_t *reader;
  140|       |
  141|       |	/* process message header */
  142|  1.32k|	reader = bio_reader_create(this->encoding);
  143|  1.32k|	reader->read_uint8 (reader, &flags);
  144|  1.32k|	reader->read_uint24(reader, &this->subtype.vendor_id);
  145|  1.32k|	reader->read_uint32(reader, &this->subtype.type);
  146|  1.32k|	reader->read_uint16(reader, &this->collector_id);
  147|  1.32k|	reader->read_uint16(reader, &this->validator_id);
  148|  1.32k|	this->excl = ((flags & PA_FLAG_EXCL) != PA_FLAG_NONE);
  ------------------
  |  |   47|  1.32k|#define PA_FLAG_EXCL			(1<<7)
  ------------------
              	this->excl = ((flags & PA_FLAG_EXCL) != PA_FLAG_NONE);
  ------------------
  |  |   46|  1.32k|#define PA_FLAG_NONE			0x00
  ------------------
  149|       |
  150|       |	/* process message body */
  151|  1.32k|	msg_body_len = reader->remaining(reader);
  152|  1.32k|	if (msg_body_len)
  ------------------
  |  Branch (152:6): [True: 575, False: 749]
  ------------------
  153|    575|	{
  154|    575|		reader->read_data(reader, msg_body_len, &this->msg_body);
  155|    575|		this->msg_body = chunk_clone(this->msg_body);
  ------------------
  |  |  278|    575|#define chunk_clone(chunk) ({chunk_t x = (chunk); chunk_create_clone(x.len ? malloc(x.len) : NULL, x);})
  |  |  ------------------
  |  |  |  Branch (278:70): [True: 575, False: 0]
  |  |  ------------------
  ------------------
  156|    575|	}
  157|  1.32k|	reader->destroy(reader);
  158|       |
  159|  1.32k|	if (this->subtype.vendor_id == PEN_RESERVED)
  ------------------
  |  Branch (159:6): [True: 2, False: 1.32k]
  ------------------
  160|      2|	{
  161|      2|		DBG1(DBG_TNC, "Vendor ID 0x%06x is reserved", PEN_RESERVED);
  ------------------
  |  |  133|      2|# define DBG1(...) {}
  ------------------
  162|      2|		*offset = 1;
  163|      2|		return FAILED;
  164|      2|	}
  165|       |
  166|  1.32k|	if (this->subtype.type == PA_RESERVED_SUBTYPE)
  ------------------
  |  |   48|  1.32k|#define PA_RESERVED_SUBTYPE		0xffffffff
  ------------------
  |  Branch (166:6): [True: 3, False: 1.31k]
  ------------------
  167|      3|	{
  168|      3|		DBG1(DBG_TNC, "PA Subtype 0x%08x is reserved", PA_RESERVED_SUBTYPE);
  ------------------
  |  |  133|      3|# define DBG1(...) {}
  ------------------
  169|      3|		*offset = 4;
  170|      3|		return FAILED;
  171|      3|	}
  172|       |
  173|  1.31k|	return SUCCESS;
  174|  1.32k|}
pb_pa_msg.c:destroy:
  178|  1.32k|{
  179|  1.32k|	free(this->encoding.ptr);
  180|  1.32k|	free(this->msg_body.ptr);
  181|  1.32k|	free(this);
  182|  1.32k|}

pb_reason_string_msg_create_from_data:
  170|  3.99k|{
  171|  3.99k|	private_pb_reason_string_msg_t *this;
  172|       |
  173|  3.99k|	INIT(this,
  ------------------
  |  |   44|  3.99k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  7.98k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  |  |  ------------------
  |  |  |  Branch (45:39): [True: 3.99k, False: 0]
  |  |  ------------------
  ------------------
  174|  3.99k|		.public = {
  175|  3.99k|			.pb_interface = {
  176|  3.99k|				.get_type = _get_type,
  177|  3.99k|				.get_encoding = _get_encoding,
  178|  3.99k|				.build = _build,
  179|  3.99k|				.process = _process,
  180|  3.99k|				.destroy = _destroy,
  181|  3.99k|			},
  182|  3.99k|			.get_reason_string = _get_reason_string,
  183|  3.99k|			.get_language_code = _get_language_code,
  184|  3.99k|		},
  185|  3.99k|		.type = { PEN_IETF, PB_MSG_REASON_STRING },
  186|  3.99k|		.encoding = chunk_clone(data),
  187|  3.99k|	);
  188|       |
  189|  3.99k|	return &this->public.pb_interface;
  190|  3.99k|}
pb_reason_string_msg.c:get_type:
   72|  3.87k|{
   73|  3.87k|	return this->type;
   74|  3.87k|}
pb_reason_string_msg.c:process:
  102|  3.99k|{
  103|  3.99k|	bio_reader_t *reader;
  104|       |
  105|  3.99k|	reader = bio_reader_create(this->encoding);
  106|  3.99k|	if (!reader->read_data32(reader, &this->reason_string))
  ------------------
  |  Branch (106:6): [True: 52, False: 3.94k]
  ------------------
  107|     52|	{
  108|     52|		DBG1(DBG_TNC, "could not parse reason string");
  ------------------
  |  |  133|     52|# define DBG1(...) {}
  ------------------
  109|     52|		reader->destroy(reader);
  110|     52|		*offset = 0;
  111|     52|		return FAILED;
  112|     52|	}
  113|  3.94k|	this->reason_string = chunk_clone(this->reason_string);
  ------------------
  |  |  278|  3.94k|#define chunk_clone(chunk) ({chunk_t x = (chunk); chunk_create_clone(x.len ? malloc(x.len) : NULL, x);})
  |  |  ------------------
  |  |  |  Branch (278:70): [True: 1.60k, False: 2.33k]
  |  |  ------------------
  ------------------
  114|       |
  115|  3.94k|	if (this->reason_string.len &&
  ------------------
  |  Branch (115:6): [True: 1.60k, False: 2.33k]
  ------------------
  116|  1.60k|		this->reason_string.ptr[this->reason_string.len-1] == '\0')
  ------------------
  |  Branch (116:3): [True: 11, False: 1.59k]
  ------------------
  117|     11|	{
  118|     11|		DBG1(DBG_TNC, "reason string must not be null terminated");
  ------------------
  |  |  133|     11|# define DBG1(...) {}
  ------------------
  119|     11|		reader->destroy(reader);
  120|     11|		*offset = 3 + this->reason_string.len;
  121|     11|		return FAILED;
  122|     11|	}
  123|       |
  124|  3.93k|	if (!reader->read_data8(reader, &this->language_code))
  ------------------
  |  Branch (124:6): [True: 30, False: 3.90k]
  ------------------
  125|     30|	{
  126|     30|		DBG1(DBG_TNC, "could not parse language code");
  ------------------
  |  |  133|     30|# define DBG1(...) {}
  ------------------
  127|     30|		reader->destroy(reader);
  128|     30|		*offset = 4 + this->reason_string.len;
  129|     30|		return FAILED;
  130|     30|	}
  131|  3.90k|	this->language_code = chunk_clone(this->language_code);
  ------------------
  |  |  278|  3.90k|#define chunk_clone(chunk) ({chunk_t x = (chunk); chunk_create_clone(x.len ? malloc(x.len) : NULL, x);})
  |  |  ------------------
  |  |  |  Branch (278:70): [True: 819, False: 3.08k]
  |  |  ------------------
  ------------------
  132|  3.90k|	reader->destroy(reader);
  133|       |
  134|  3.90k|	if (this->language_code.len &&
  ------------------
  |  Branch (134:6): [True: 819, False: 3.08k]
  ------------------
  135|    819|		this->language_code.ptr[this->language_code.len-1] == '\0')
  ------------------
  |  Branch (135:3): [True: 24, False: 795]
  ------------------
  136|     24|	{
  137|     24|		DBG1(DBG_TNC, "language code must not be null terminated");
  ------------------
  |  |  133|     24|# define DBG1(...) {}
  ------------------
  138|     24|		*offset = 4 + this->reason_string.len + this->language_code.len;
  139|     24|		return FAILED;
  140|     24|	}
  141|       |
  142|  3.87k|	return SUCCESS;
  143|  3.90k|}
pb_reason_string_msg.c:destroy:
  147|  3.99k|{
  148|  3.99k|	free(this->encoding.ptr);
  149|  3.99k|	free(this->reason_string.ptr);
  150|  3.99k|	free(this->language_code.ptr);
  151|  3.99k|	free(this);
  152|  3.99k|}

pb_remediation_parameters_msg_create_from_data:
  289|  4.01k|{
  290|  4.01k|	private_pb_remediation_parameters_msg_t *this;
  291|       |
  292|  4.01k|	INIT(this,
  ------------------
  |  |   44|  4.01k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  8.03k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  |  |  ------------------
  |  |  |  Branch (45:39): [True: 4.01k, False: 0]
  |  |  ------------------
  ------------------
  293|  4.01k|		.public = {
  294|  4.01k|			.pb_interface = {
  295|  4.01k|				.get_type = _get_type,
  296|  4.01k|				.get_encoding = _get_encoding,
  297|  4.01k|				.build = _build,
  298|  4.01k|				.process = _process,
  299|  4.01k|				.destroy = _destroy,
  300|  4.01k|			},
  301|  4.01k|			.get_parameters_type = _get_parameters_type,
  302|  4.01k|			.get_parameters = _get_parameters,
  303|  4.01k|			.get_uri = _get_parameters,
  304|  4.01k|			.get_string = _get_string,
  305|  4.01k|		},
  306|  4.01k|		.type = { PEN_IETF, PB_MSG_REMEDIATION_PARAMETERS },
  307|  4.01k|		.encoding = chunk_clone(data),
  308|  4.01k|	);
  309|       |
  310|  4.01k|	return &this->public.pb_interface;
  311|  4.01k|}
pb_remediation_parameters_msg.c:get_type:
   97|  4.00k|{
   98|  4.00k|	return this->type;
   99|  4.00k|}
pb_remediation_parameters_msg.c:process:
  128|  4.01k|{
  129|  4.01k|	bio_reader_t *reader;
  130|  4.01k|	uint8_t reserved;
  131|  4.01k|	status_t status = SUCCESS;
  132|  4.01k|	u_char *pos;
  133|       |
  134|  4.01k|	*offset = 0;
  135|       |
  136|       |	/* process message */
  137|  4.01k|	reader = bio_reader_create(this->encoding);
  138|  4.01k|	reader->read_uint8 (reader, &reserved);
  139|  4.01k|	reader->read_uint24(reader, &this->parameters_type.vendor_id);
  140|  4.01k|	reader->read_uint32(reader, &this->parameters_type.type);
  141|  4.01k|	reader->read_data  (reader, reader->remaining(reader), &this->parameters);
  142|       |
  143|  4.01k|	this->parameters = chunk_clone(this->parameters);
  ------------------
  |  |  278|  4.01k|#define chunk_clone(chunk) ({chunk_t x = (chunk); chunk_create_clone(x.len ? malloc(x.len) : NULL, x);})
  |  |  ------------------
  |  |  |  Branch (278:70): [True: 2.25k, False: 1.76k]
  |  |  ------------------
  ------------------
  144|  4.01k|	reader->destroy(reader);
  145|       |
  146|  4.01k|	if (this->parameters_type.vendor_id == PEN_IETF &&
  ------------------
  |  Branch (146:6): [True: 1.62k, False: 2.39k]
  ------------------
  147|  1.62k|		this->parameters_type.type == PB_REMEDIATION_STRING)
  ------------------
  |  Branch (147:3): [True: 1.05k, False: 567]
  ------------------
  148|  1.05k|	{
  149|  1.05k|		reader = bio_reader_create(this->parameters);
  150|  1.05k|		status = FAILED;
  151|  1.05k|		*offset = 8;
  152|       |
  153|  1.05k|		if (!reader->read_data32(reader, &this->string))
  ------------------
  |  Branch (153:7): [True: 4, False: 1.05k]
  ------------------
  154|      4|		{
  155|      4|			DBG1(DBG_TNC, "insufficient data for remediation string");
  ------------------
  |  |  133|      4|# define DBG1(...) {}
  ------------------
  156|      4|			goto end;
  157|      4|		}
  158|  1.05k|		*offset += 4;
  159|       |
  160|  1.05k|		pos = memchr(this->string.ptr, '\0', this->string.len);
  161|  1.05k|		if (pos)
  ------------------
  |  Branch (161:7): [True: 1, False: 1.05k]
  ------------------
  162|      1|		{
  163|      1|			DBG1(DBG_TNC, "nul termination in remediation string");
  ------------------
  |  |  133|      1|# define DBG1(...) {}
  ------------------
  164|      1|			*offset += (pos - this->string.ptr);
  165|      1|			goto end;
  166|      1|		}
  167|  1.05k|		*offset += this->string.len;
  168|       |
  169|  1.05k|		if (!reader->read_data8(reader, &this->lang_code))
  ------------------
  |  Branch (169:7): [True: 1, False: 1.04k]
  ------------------
  170|      1|		{
  171|      1|			DBG1(DBG_TNC, "insufficient data for remediation string lang code");
  ------------------
  |  |  133|      1|# define DBG1(...) {}
  ------------------
  172|      1|			goto end;
  173|      1|		}
  174|  1.04k|		*offset += 1;
  175|       |
  176|  1.04k|		pos = memchr(this->lang_code.ptr, '\0', this->lang_code.len);
  177|       |
  178|  1.04k|		if (pos)
  ------------------
  |  Branch (178:7): [True: 2, False: 1.04k]
  ------------------
  179|      2|		{
  180|      2|			DBG1(DBG_TNC, "nul termination in remediation string lang code");
  ------------------
  |  |  133|      2|# define DBG1(...) {}
  ------------------
  181|      2|			*offset += (pos - this->lang_code.ptr);
  182|      2|			goto end;
  183|      2|		}
  184|  1.04k|		status = SUCCESS;
  185|       |
  186|  1.05k|end:
  187|  1.05k|		reader->destroy(reader);
  188|  1.05k|	}
  189|  4.01k|	return status;
  190|  4.01k|}
pb_remediation_parameters_msg.c:destroy:
  194|  4.01k|{
  195|  4.01k|	free(this->encoding.ptr);
  196|  4.01k|	free(this->parameters.ptr);
  197|  4.01k|	free(this);
  198|  4.01k|}

pb_mutual_capability_msg_create_from_data:
  157|    576|{
  158|    576|	private_pb_mutual_capability_msg_t *this;
  159|       |
  160|    576|	INIT(this,
  ------------------
  |  |   44|    576|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  1.15k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  |  |  ------------------
  |  |  |  Branch (45:39): [True: 576, False: 0]
  |  |  ------------------
  ------------------
  161|    576|		.public = {
  162|    576|			.pb_interface = {
  163|    576|				.get_type = _get_type,
  164|    576|				.get_encoding = _get_encoding,
  165|    576|				.build = _build,
  166|    576|				.process = _process,
  167|    576|				.destroy = _destroy,
  168|    576|			},
  169|    576|			.get_protocols = _get_protocols,
  170|    576|		},
  171|    576|		.type = { PEN_ITA, PB_ITA_MSG_MUTUAL_CAPABILITY },
  172|    576|		.encoding = chunk_clone(data),
  173|    576|	);
  174|       |
  175|    576|	return &this->public.pb_interface;
  176|    576|}
pb_mutual_capability_msg.c:get_type:
   73|    576|{
   74|    576|	return this->type;
   75|    576|}
pb_mutual_capability_msg.c:process:
  102|    576|{
  103|    576|	bio_reader_t *reader;
  104|       |
  105|    576|	*offset = 0;
  106|       |
  107|       |	/* process message */
  108|    576|	reader = bio_reader_create(this->encoding);
  109|    576|	reader->read_uint32(reader, &this->protocols);
  110|    576|	reader->destroy(reader);
  111|       |
  112|    576|	return SUCCESS;
  113|    576|}
pb_mutual_capability_msg.c:destroy:
  117|    576|{
  118|    576|	free(this->encoding.ptr);
  119|    576|	free(this);
  120|    576|}

pb_tnc_msg_create_from_data:
   78|  89.5k|{
   79|  89.5k|	if (msg_type.vendor_id == PEN_IETF)
  ------------------
  |  Branch (79:6): [True: 58.0k, False: 31.5k]
  ------------------
   80|  58.0k|	{
   81|  58.0k|		switch (msg_type.type)
  ------------------
  |  Branch (81:11): [True: 58.0k, False: 0]
  ------------------
   82|  58.0k|		{
   83|  1.32k|			case PB_MSG_PA:
  ------------------
  |  Branch (83:4): [True: 1.32k, False: 56.6k]
  ------------------
   84|  1.32k|				return pb_pa_msg_create_from_data(value);
   85|  11.5k|			case PB_MSG_ERROR:
  ------------------
  |  Branch (85:4): [True: 11.5k, False: 46.4k]
  ------------------
   86|  11.5k|				return pb_error_msg_create_from_data(value);
   87|  35.1k|			case PB_MSG_EXPERIMENTAL:
  ------------------
  |  Branch (87:4): [True: 35.1k, False: 22.8k]
  ------------------
   88|  35.1k|				return pb_experimental_msg_create_from_data(value);
   89|    800|			case PB_MSG_LANGUAGE_PREFERENCE:
  ------------------
  |  Branch (89:4): [True: 800, False: 57.2k]
  ------------------
   90|    800|				return pb_language_preference_msg_create_from_data(value);
   91|    466|			case PB_MSG_ASSESSMENT_RESULT:
  ------------------
  |  Branch (91:4): [True: 466, False: 57.5k]
  ------------------
   92|    466|				return pb_assessment_result_msg_create_from_data(value);
   93|    699|			case PB_MSG_ACCESS_RECOMMENDATION:
  ------------------
  |  Branch (93:4): [True: 699, False: 57.3k]
  ------------------
   94|    699|				return pb_access_recommendation_msg_create_from_data(value);
   95|  4.01k|			case PB_MSG_REMEDIATION_PARAMETERS:
  ------------------
  |  Branch (95:4): [True: 4.01k, False: 53.9k]
  ------------------
   96|  4.01k|				return pb_remediation_parameters_msg_create_from_data(value);
   97|  3.99k|			case PB_MSG_REASON_STRING:
  ------------------
  |  Branch (97:4): [True: 3.99k, False: 54.0k]
  ------------------
   98|  3.99k|				return pb_reason_string_msg_create_from_data(value);
   99|  58.0k|		}
  100|  58.0k|	}
  101|  31.5k|	else if (msg_type.vendor_id == PEN_TCG)
  ------------------
  |  Branch (101:11): [True: 30.9k, False: 576]
  ------------------
  102|  30.9k|	{
  103|  30.9k|		if (msg_type.type == PB_TCG_MSG_PDP_REFERRAL)
  ------------------
  |  Branch (103:7): [True: 30.9k, False: 0]
  ------------------
  104|  30.9k|		{
  105|  30.9k|			return pb_pdp_referral_msg_create_from_data(value);
  106|  30.9k|		}
  107|  30.9k|	}
  108|    576|	else if (msg_type.vendor_id == PEN_ITA)
  ------------------
  |  Branch (108:11): [True: 576, False: 0]
  ------------------
  109|    576|	{
  110|    576|		if (msg_type.type == PB_ITA_MSG_MUTUAL_CAPABILITY)
  ------------------
  |  Branch (110:7): [True: 576, False: 0]
  ------------------
  111|    576|		{
  112|    576|			return pb_mutual_capability_msg_create_from_data(value);
  113|    576|		}
  114|    576|	}
  115|      0|	return NULL;
  116|  89.5k|}

pb_pdp_referral_msg_create_from_data:
  293|  30.9k|{
  294|  30.9k|	private_pb_pdp_referral_msg_t *this;
  295|       |
  296|  30.9k|	INIT(this,
  ------------------
  |  |   44|  30.9k|#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
  |  |   45|  61.9k|						   *(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })
  |  |  ------------------
  |  |  |  Branch (45:39): [True: 30.9k, False: 0]
  |  |  ------------------
  ------------------
  297|  30.9k|		.public = {
  298|  30.9k|			.pb_interface = {
  299|  30.9k|				.get_type = _get_type,
  300|  30.9k|				.get_encoding = _get_encoding,
  301|  30.9k|				.build = _build,
  302|  30.9k|				.process = _process,
  303|  30.9k|				.destroy = _destroy,
  304|  30.9k|			},
  305|  30.9k|			.get_identifier_type = _get_identifier_type,
  306|  30.9k|			.get_identifier = _get_identifier,
  307|  30.9k|			.get_fqdn = _get_fqdn,
  308|  30.9k|		},
  309|  30.9k|		.type = { PEN_TCG, PB_TCG_MSG_PDP_REFERRAL },
  310|  30.9k|		.encoding = chunk_clone(data),
  311|  30.9k|	);
  312|       |
  313|  30.9k|	return &this->public.pb_interface;
  314|  30.9k|}
pb_pdp_referral_msg.c:get_type:
  136|  30.9k|{
  137|  30.9k|	return this->type;
  138|  30.9k|}
pb_pdp_referral_msg.c:process:
  168|  30.9k|{
  169|  30.9k|	bio_reader_t *reader;
  170|  30.9k|	uint8_t reserved;
  171|       |
  172|  30.9k|	*offset = 0;
  173|       |
  174|       |	/* process message */
  175|  30.9k|	reader = bio_reader_create(this->encoding);
  176|  30.9k|	reader->read_uint8 (reader, &reserved);
  177|  30.9k|	reader->read_uint24(reader, &this->identifier_type.vendor_id);
  178|  30.9k|	reader->read_uint32(reader, &this->identifier_type.type);
  179|  30.9k|	reader->read_data  (reader, reader->remaining(reader), &this->identifier);
  180|       |
  181|  30.9k|	this->identifier = chunk_clone(this->identifier);
  ------------------
  |  |  278|  30.9k|#define chunk_clone(chunk) ({chunk_t x = (chunk); chunk_create_clone(x.len ? malloc(x.len) : NULL, x);})
  |  |  ------------------
  |  |  |  Branch (278:70): [True: 3.52k, False: 27.4k]
  |  |  ------------------
  ------------------
  182|  30.9k|	reader->destroy(reader);
  183|       |
  184|  30.9k|	if (this->identifier_type.vendor_id == PEN_TCG &&
  ------------------
  |  Branch (184:6): [True: 18.4k, False: 12.5k]
  ------------------
  185|  18.4k|		this->identifier_type.type == PB_PDP_ID_FQDN)
  ------------------
  |  Branch (185:3): [True: 394, False: 18.0k]
  ------------------
  186|    394|	{
  187|    394|		reader = bio_reader_create(this->identifier);
  188|    394|		*offset += PDP_REFERRAL_HEADER_SIZE;
  ------------------
  |  |   83|    394|# define PDP_REFERRAL_HEADER_SIZE		8
  ------------------
  189|       |
  190|    394|		if (this->identifier.len <= PDP_REFERRAL_ID_HEADER_SIZE)
  ------------------
  |  |   84|    394|# define PDP_REFERRAL_ID_HEADER_SIZE	4
  ------------------
  |  Branch (190:7): [True: 5, False: 389]
  ------------------
  191|      5|		{
  192|      5|			reader->destroy(reader);
  193|      5|			return FAILED;
  194|      5|		}
  195|    389|		reader->read_uint8 (reader, &reserved);
  196|    389|		reader->read_uint8 (reader, &this->protocol);
  197|    389|		reader->read_uint16(reader, &this->port);
  198|    389|		reader->read_data  (reader, reader->remaining(reader), &this->fqdn);
  199|    389|		this->fqdn = chunk_clone(this->fqdn);
  ------------------
  |  |  278|    389|#define chunk_clone(chunk) ({chunk_t x = (chunk); chunk_create_clone(x.len ? malloc(x.len) : NULL, x);})
  |  |  ------------------
  |  |  |  Branch (278:70): [True: 389, False: 0]
  |  |  ------------------
  ------------------
  200|    389|		reader->destroy(reader);
  201|    389|	}
  202|  30.9k|	return SUCCESS;
  203|  30.9k|}
pb_pdp_referral_msg.c:destroy:
  207|  30.9k|{
  208|  30.9k|	free(this->encoding.ptr);
  209|  30.9k|	free(this->identifier.ptr);
  210|  30.9k|	free(this->fqdn.ptr);
  211|  30.9k|	free(this);
  212|  30.9k|}

