ogs_core_initialize:
   40|      1|{
   41|      1|    ogs_mem_init();
   42|      1|    ogs_log_init();
   43|      1|    ogs_pkbuf_init();
   44|      1|    ogs_socket_init();
   45|      1|    ogs_tlv_init();
   46|       |
   47|      1|    ogs_log_install_domain(&__ogs_mem_domain, "mem", ogs_core()->log.level);
   48|      1|    ogs_log_install_domain(&__ogs_sock_domain, "sock", ogs_core()->log.level);
   49|      1|    ogs_log_install_domain(&__ogs_event_domain, "event", ogs_core()->log.level);
   50|      1|    ogs_log_install_domain(&__ogs_thread_domain,
   51|      1|            "thread", ogs_core()->log.level);
   52|      1|    ogs_log_install_domain(&__ogs_tlv_domain, "tlv", ogs_core()->log.level);
   53|      1|}
ogs_core:
   65|    605|{
   66|    605|    return &self;
   67|    605|}

ogs_hash_make:
  366|      3|{
  367|      3|    ogs_hash_t *ht;
  368|       |
  369|       |#ifdef _WIN32
  370|       |    BOOL initialized = InitOnceExecuteOnce(
  371|       |            &hash_once, init_hash_secret, NULL, NULL);
  372|       |    ogs_assert(initialized);
  373|       |#else
  374|      3|    int rv = pthread_once(&hash_once, init_hash_secret);
  375|      3|    ogs_assert(rv == 0);
  ------------------
  |  |  113|      3|    do { \
  |  |  114|      3|        if (ogs_likely(expr)) ; \
  |  |  ------------------
  |  |  |  |   54|      3|#define ogs_likely(x) __builtin_expect (!!(x), 1)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (54:23): [True: 3, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  115|      3|        else { \
  |  |  116|      0|            ogs_fatal("%s: Assertion `%s' failed.", OGS_FUNC, #expr); \
  |  |  ------------------
  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|      0|#define OGS_LOG_DOMAIN      1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|            ogs_abort(); \
  |  |  118|      0|        } \
  |  |  119|      3|    } while(0)
  |  |  ------------------
  |  |  |  Branch (119:13): [Folded, False: 3]
  |  |  ------------------
  ------------------
  376|      3|#endif
  377|       |
  378|      3|    ht = ogs_calloc(1, sizeof(*ht));
  ------------------
  |  |   70|      3|    ogs_talloc_zero_size(__ogs_talloc_core, (nmemb) * (size), __location__)
  ------------------
  379|      3|    if (!ht)
  ------------------
  |  Branch (379:9): [True: 0, False: 3]
  ------------------
  380|      3|        ogs_error("ogs_calloc() failed");
  ------------------
  |  |   36|      0|#define ogs_error(...) ogs_log_message(OGS_LOG_ERROR, 0, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  ------------------
  |  |  |  |  |  |   32|      0|#define OGS_LOG_DOMAIN      1
  |  |  |  |  ------------------
  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  ------------------
  ------------------
  381|      3|    return ht;
  382|      3|}
ogs-hash.c:init_hash_secret:
  128|      1|{
  129|      1|    ogs_random(hash_secret, sizeof(hash_secret));
  130|      1|}

ogs-log.c:ogs_list_first:
   51|    328|{
   52|    328|    return list->next;
   53|    328|}
ogs-log.c:ogs_list_next:
   61|     21|{
   62|     21|    ogs_list_t *node = (ogs_list_t *)lnode;
   63|     21|    return node->next;
   64|     21|}
ogs-log.c:ogs_list_add:
  115|      8|{
  116|      8|    ogs_list_t *node = (ogs_list_t *)lnode;
  117|       |
  118|      8|    node->prev = list->prev;
  119|      8|    node->next = NULL;
  120|      8|    if (list->prev)
  ------------------
  |  Branch (120:9): [True: 6, False: 2]
  ------------------
  121|      6|        list->prev->next = node;
  122|      2|    else
  123|      2|        list->next = node;
  124|      8|    list->prev = node;
  125|      8|}

ogs_log_init:
  115|      1|{
  116|      1|    ogs_pool_init(&log_pool, ogs_core()->log.pool);
  ------------------
  |  |   52|      1|#define ogs_pool_init(pool, _size) do { \
  |  |   53|      1|    int i; \
  |  |   54|      1|    (pool)->name = #pool; \
  |  |   55|      1|    (pool)->free = malloc(sizeof(*(pool)->free) * _size); \
  |  |   56|      1|    ogs_assert((pool)->free); \
  |  |  ------------------
  |  |  |  |  113|      1|    do { \
  |  |  |  |  114|      1|        if (ogs_likely(expr)) ; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   54|      1|#define ogs_likely(x) __builtin_expect (!!(x), 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (54:23): [True: 1, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  115|      1|        else { \
  |  |  |  |  116|      0|            ogs_fatal("%s: Assertion `%s' failed.", OGS_FUNC, #expr); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   32|      0|#define OGS_LOG_DOMAIN      1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  117|      0|            ogs_abort(); \
  |  |  |  |  118|      0|        } \
  |  |  |  |  119|      1|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (119:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   57|      1|    (pool)->array = malloc(sizeof(*(pool)->array) * _size); \
  |  |   58|      1|    ogs_assert((pool)->array); \
  |  |  ------------------
  |  |  |  |  113|      1|    do { \
  |  |  |  |  114|      1|        if (ogs_likely(expr)) ; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   54|      1|#define ogs_likely(x) __builtin_expect (!!(x), 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (54:23): [True: 1, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  115|      1|        else { \
  |  |  |  |  116|      0|            ogs_fatal("%s: Assertion `%s' failed.", OGS_FUNC, #expr); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   32|      0|#define OGS_LOG_DOMAIN      1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  117|      0|            ogs_abort(); \
  |  |  |  |  118|      0|        } \
  |  |  |  |  119|      1|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (119:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   59|      1|    (pool)->index = malloc(sizeof(*(pool)->index) * _size); \
  |  |   60|      1|    ogs_assert((pool)->index); \
  |  |  ------------------
  |  |  |  |  113|      1|    do { \
  |  |  |  |  114|      1|        if (ogs_likely(expr)) ; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   54|      1|#define ogs_likely(x) __builtin_expect (!!(x), 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (54:23): [True: 1, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  115|      1|        else { \
  |  |  |  |  116|      0|            ogs_fatal("%s: Assertion `%s' failed.", OGS_FUNC, #expr); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   32|      0|#define OGS_LOG_DOMAIN      1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  117|      0|            ogs_abort(); \
  |  |  |  |  118|      0|        } \
  |  |  |  |  119|      1|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (119:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   61|      1|    (pool)->size = (pool)->avail = _size; \
  |  |   62|      1|    (pool)->head = (pool)->tail = 0; \
  |  |   63|      9|    for (i = 0; i < _size; i++) { \
  |  |  ------------------
  |  |  |  Branch (63:17): [True: 8, False: 1]
  |  |  ------------------
  |  |   64|      8|        (pool)->free[i] = &((pool)->array[i]); \
  |  |   65|      8|        (pool)->index[i] = NULL; \
  |  |   66|      8|    } \
  |  |   67|      1|    \
  |  |   68|      1|    (pool)->id_hash = ogs_hash_make(); \
  |  |   69|      1|    ogs_assert((pool)->id_hash); \
  |  |  ------------------
  |  |  |  |  113|      1|    do { \
  |  |  |  |  114|      1|        if (ogs_likely(expr)) ; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   54|      1|#define ogs_likely(x) __builtin_expect (!!(x), 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (54:23): [True: 1, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  115|      1|        else { \
  |  |  |  |  116|      0|            ogs_fatal("%s: Assertion `%s' failed.", OGS_FUNC, #expr); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   32|      0|#define OGS_LOG_DOMAIN      1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  117|      0|            ogs_abort(); \
  |  |  |  |  118|      0|        } \
  |  |  |  |  119|      1|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (119:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   70|      1|} while (0)
  |  |  ------------------
  |  |  |  Branch (70:10): [Folded, False: 1]
  |  |  ------------------
  ------------------
  117|      1|    ogs_pool_init(&domain_pool, ogs_core()->log.domain_pool);
  ------------------
  |  |   52|      1|#define ogs_pool_init(pool, _size) do { \
  |  |   53|      1|    int i; \
  |  |   54|      1|    (pool)->name = #pool; \
  |  |   55|      1|    (pool)->free = malloc(sizeof(*(pool)->free) * _size); \
  |  |   56|      1|    ogs_assert((pool)->free); \
  |  |  ------------------
  |  |  |  |  113|      1|    do { \
  |  |  |  |  114|      1|        if (ogs_likely(expr)) ; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   54|      1|#define ogs_likely(x) __builtin_expect (!!(x), 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (54:23): [True: 1, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  115|      1|        else { \
  |  |  |  |  116|      0|            ogs_fatal("%s: Assertion `%s' failed.", OGS_FUNC, #expr); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   32|      0|#define OGS_LOG_DOMAIN      1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  117|      0|            ogs_abort(); \
  |  |  |  |  118|      0|        } \
  |  |  |  |  119|      1|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (119:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   57|      1|    (pool)->array = malloc(sizeof(*(pool)->array) * _size); \
  |  |   58|      1|    ogs_assert((pool)->array); \
  |  |  ------------------
  |  |  |  |  113|      1|    do { \
  |  |  |  |  114|      1|        if (ogs_likely(expr)) ; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   54|      1|#define ogs_likely(x) __builtin_expect (!!(x), 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (54:23): [True: 1, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  115|      1|        else { \
  |  |  |  |  116|      0|            ogs_fatal("%s: Assertion `%s' failed.", OGS_FUNC, #expr); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   32|      0|#define OGS_LOG_DOMAIN      1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  117|      0|            ogs_abort(); \
  |  |  |  |  118|      0|        } \
  |  |  |  |  119|      1|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (119:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   59|      1|    (pool)->index = malloc(sizeof(*(pool)->index) * _size); \
  |  |   60|      1|    ogs_assert((pool)->index); \
  |  |  ------------------
  |  |  |  |  113|      1|    do { \
  |  |  |  |  114|      1|        if (ogs_likely(expr)) ; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   54|      1|#define ogs_likely(x) __builtin_expect (!!(x), 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (54:23): [True: 1, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  115|      1|        else { \
  |  |  |  |  116|      0|            ogs_fatal("%s: Assertion `%s' failed.", OGS_FUNC, #expr); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   32|      0|#define OGS_LOG_DOMAIN      1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  117|      0|            ogs_abort(); \
  |  |  |  |  118|      0|        } \
  |  |  |  |  119|      1|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (119:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   61|      1|    (pool)->size = (pool)->avail = _size; \
  |  |   62|      1|    (pool)->head = (pool)->tail = 0; \
  |  |   63|     65|    for (i = 0; i < _size; i++) { \
  |  |  ------------------
  |  |  |  Branch (63:17): [True: 64, False: 1]
  |  |  ------------------
  |  |   64|     64|        (pool)->free[i] = &((pool)->array[i]); \
  |  |   65|     64|        (pool)->index[i] = NULL; \
  |  |   66|     64|    } \
  |  |   67|      1|    \
  |  |   68|      1|    (pool)->id_hash = ogs_hash_make(); \
  |  |   69|      1|    ogs_assert((pool)->id_hash); \
  |  |  ------------------
  |  |  |  |  113|      1|    do { \
  |  |  |  |  114|      1|        if (ogs_likely(expr)) ; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   54|      1|#define ogs_likely(x) __builtin_expect (!!(x), 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (54:23): [True: 1, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  115|      1|        else { \
  |  |  |  |  116|      0|            ogs_fatal("%s: Assertion `%s' failed.", OGS_FUNC, #expr); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   32|      0|#define OGS_LOG_DOMAIN      1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  117|      0|            ogs_abort(); \
  |  |  |  |  118|      0|        } \
  |  |  |  |  119|      1|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (119:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   70|      1|} while (0)
  |  |  ------------------
  |  |  |  Branch (70:10): [Folded, False: 1]
  |  |  ------------------
  ------------------
  118|       |
  119|      1|    ogs_log_add_domain("core", ogs_core()->log.level);
  120|      1|    ogs_log_add_stderr();
  121|      1|}
ogs_log_add_stderr:
  152|      1|{
  153|      1|    ogs_log_t *log = NULL;
  154|       |    
  155|      1|    log = add_log(OGS_LOG_STDERR_TYPE);
  156|      1|    ogs_assert(log);
  ------------------
  |  |  113|      1|    do { \
  |  |  114|      1|        if (ogs_likely(expr)) ; \
  |  |  ------------------
  |  |  |  |   54|      1|#define ogs_likely(x) __builtin_expect (!!(x), 1)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (54:23): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  115|      1|        else { \
  |  |  116|      0|            ogs_fatal("%s: Assertion `%s' failed.", OGS_FUNC, #expr); \
  |  |  ------------------
  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|      0|#define OGS_LOG_DOMAIN      1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|            ogs_abort(); \
  |  |  118|      0|        } \
  |  |  119|      1|    } while(0)
  |  |  ------------------
  |  |  |  Branch (119:13): [Folded, False: 1]
  |  |  ------------------
  ------------------
  157|       |
  158|      1|    log->file.out = stderr;
  159|      1|    log->writer = file_writer;
  160|       |
  161|      1|#if !defined(_WIN32)
  162|      1|    log->print.color = 1;
  163|      1|#endif
  164|       |
  165|      1|    return log;
  166|      1|}
ogs_log_add_domain:
  204|      7|{
  205|      7|    ogs_log_domain_t *domain = NULL;
  206|       |
  207|      7|    ogs_assert(name);
  ------------------
  |  |  113|      7|    do { \
  |  |  114|      7|        if (ogs_likely(expr)) ; \
  |  |  ------------------
  |  |  |  |   54|      7|#define ogs_likely(x) __builtin_expect (!!(x), 1)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (54:23): [True: 7, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  115|      7|        else { \
  |  |  116|      0|            ogs_fatal("%s: Assertion `%s' failed.", OGS_FUNC, #expr); \
  |  |  ------------------
  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|      0|#define OGS_LOG_DOMAIN      1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|            ogs_abort(); \
  |  |  118|      0|        } \
  |  |  119|      7|    } while(0)
  |  |  ------------------
  |  |  |  Branch (119:13): [Folded, False: 7]
  |  |  ------------------
  ------------------
  208|       |
  209|      7|    ogs_pool_alloc(&domain_pool, &domain);
  ------------------
  |  |  132|      7|#define ogs_pool_alloc(pool, node) do { \
  |  |  133|      7|    *(node) = NULL; \
  |  |  134|      7|    if ((pool)->avail > 0) { \
  |  |  ------------------
  |  |  |  Branch (134:9): [True: 7, False: 0]
  |  |  ------------------
  |  |  135|      7|        (pool)->avail--; \
  |  |  136|      7|        *(node) = (void*)(pool)->free[(pool)->head]; \
  |  |  137|      7|        (pool)->free[(pool)->head] = NULL; \
  |  |  138|      7|        (pool)->head = ((pool)->head + 1) % ((pool)->size); \
  |  |  139|      7|        (pool)->index[ogs_pool_index(pool, *(node))-1] = *(node); \
  |  |  ------------------
  |  |  |  |  152|      7|#define ogs_pool_index(pool, node) (((node) - (pool)->array)+1)
  |  |  ------------------
  |  |  140|      7|    } \
  |  |  141|      7|} while (0)
  |  |  ------------------
  |  |  |  Branch (141:10): [Folded, False: 7]
  |  |  ------------------
  ------------------
  210|      7|    ogs_assert(domain);
  ------------------
  |  |  113|      7|    do { \
  |  |  114|      7|        if (ogs_likely(expr)) ; \
  |  |  ------------------
  |  |  |  |   54|      7|#define ogs_likely(x) __builtin_expect (!!(x), 1)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (54:23): [True: 7, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  115|      7|        else { \
  |  |  116|      0|            ogs_fatal("%s: Assertion `%s' failed.", OGS_FUNC, #expr); \
  |  |  ------------------
  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|      0|#define OGS_LOG_DOMAIN      1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|            ogs_abort(); \
  |  |  118|      0|        } \
  |  |  119|      7|    } while(0)
  |  |  ------------------
  |  |  |  Branch (119:13): [Folded, False: 7]
  |  |  ------------------
  ------------------
  211|       |
  212|      7|    domain->name = name;
  213|      7|    domain->id = ogs_pool_index(&domain_pool, domain);
  ------------------
  |  |  152|      7|#define ogs_pool_index(pool, node) (((node) - (pool)->array)+1)
  ------------------
  214|      7|    domain->level = level;
  215|       |
  216|      7|    ogs_list_add(&domain_list, domain);
  217|       |
  218|      7|    return domain;
  219|      7|}
ogs_log_find_domain:
  222|      6|{
  223|      6|    ogs_log_domain_t *domain = NULL;
  224|       |
  225|      6|    ogs_assert(name);
  ------------------
  |  |  113|      6|    do { \
  |  |  114|      6|        if (ogs_likely(expr)) ; \
  |  |  ------------------
  |  |  |  |   54|      6|#define ogs_likely(x) __builtin_expect (!!(x), 1)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (54:23): [True: 6, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  115|      6|        else { \
  |  |  116|      0|            ogs_fatal("%s: Assertion `%s' failed.", OGS_FUNC, #expr); \
  |  |  ------------------
  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|      0|#define OGS_LOG_DOMAIN      1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|            ogs_abort(); \
  |  |  118|      0|        } \
  |  |  119|      6|    } while(0)
  |  |  ------------------
  |  |  |  Branch (119:13): [Folded, False: 6]
  |  |  ------------------
  ------------------
  226|       |
  227|      6|    ogs_list_for_each(&domain_list, domain)
  ------------------
  |  |   76|     27|    for (node = ogs_list_first(list); (node); \
  |  |  ------------------
  |  |  |  Branch (76:39): [True: 21, False: 6]
  |  |  ------------------
  |  |   77|     21|        node = ogs_list_next(node))
  ------------------
  228|     21|        if (!ogs_strcasecmp(domain->name, name))
  ------------------
  |  |   63|     21|#define ogs_strcasecmp strcasecmp
  ------------------
  |  Branch (228:13): [True: 0, False: 21]
  ------------------
  229|      0|            return domain;
  230|       |
  231|      6|    return NULL;
  232|      6|}
ogs_log_install_domain:
  292|      6|{
  293|      6|    ogs_log_domain_t *domain = NULL;
  294|       |
  295|      6|    ogs_assert(domain_id);
  ------------------
  |  |  113|      6|    do { \
  |  |  114|      6|        if (ogs_likely(expr)) ; \
  |  |  ------------------
  |  |  |  |   54|      6|#define ogs_likely(x) __builtin_expect (!!(x), 1)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (54:23): [True: 6, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  115|      6|        else { \
  |  |  116|      0|            ogs_fatal("%s: Assertion `%s' failed.", OGS_FUNC, #expr); \
  |  |  ------------------
  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|      0|#define OGS_LOG_DOMAIN      1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|            ogs_abort(); \
  |  |  118|      0|        } \
  |  |  119|      6|    } while(0)
  |  |  ------------------
  |  |  |  Branch (119:13): [Folded, False: 6]
  |  |  ------------------
  ------------------
  296|      6|    ogs_assert(name);
  ------------------
  |  |  113|      6|    do { \
  |  |  114|      6|        if (ogs_likely(expr)) ; \
  |  |  ------------------
  |  |  |  |   54|      6|#define ogs_likely(x) __builtin_expect (!!(x), 1)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (54:23): [True: 6, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  115|      6|        else { \
  |  |  116|      0|            ogs_fatal("%s: Assertion `%s' failed.", OGS_FUNC, #expr); \
  |  |  ------------------
  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|      0|#define OGS_LOG_DOMAIN      1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|            ogs_abort(); \
  |  |  118|      0|        } \
  |  |  119|      6|    } while(0)
  |  |  ------------------
  |  |  |  Branch (119:13): [Folded, False: 6]
  |  |  ------------------
  ------------------
  297|       |
  298|      6|    domain = ogs_log_find_domain(name);
  299|      6|    if (domain) {
  ------------------
  |  Branch (299:9): [True: 0, False: 6]
  ------------------
  300|      0|        ogs_warn("`%s` log-domain duplicated", name);
  ------------------
  |  |   37|      0|#define ogs_warn(...) ogs_log_message(OGS_LOG_WARN, 0, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  ------------------
  |  |  |  |  |  |   32|      0|#define OGS_LOG_DOMAIN      1
  |  |  |  |  ------------------
  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  ------------------
  ------------------
  301|      0|        if (level != domain->level) {
  ------------------
  |  Branch (301:13): [True: 0, False: 0]
  ------------------
  302|      0|            ogs_warn("[%s]->[%s] log-level changed",
  ------------------
  |  |   37|      0|#define ogs_warn(...) ogs_log_message(OGS_LOG_WARN, 0, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  ------------------
  |  |  |  |  |  |   32|      0|#define OGS_LOG_DOMAIN      1
  |  |  |  |  ------------------
  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  ------------------
  ------------------
  303|      0|                    level_strings[domain->level], level_strings[level]);
  304|      0|            ogs_log_set_domain_level(domain->id, level);
  305|      0|        }
  306|      6|    } else {
  307|      6|        domain = ogs_log_add_domain(name, level);
  308|      6|        ogs_assert(domain);
  ------------------
  |  |  113|      6|    do { \
  |  |  114|      6|        if (ogs_likely(expr)) ; \
  |  |  ------------------
  |  |  |  |   54|      6|#define ogs_likely(x) __builtin_expect (!!(x), 1)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (54:23): [True: 6, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  115|      6|        else { \
  |  |  116|      0|            ogs_fatal("%s: Assertion `%s' failed.", OGS_FUNC, #expr); \
  |  |  ------------------
  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|      0|#define OGS_LOG_DOMAIN      1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|            ogs_abort(); \
  |  |  118|      0|        } \
  |  |  119|      6|    } while(0)
  |  |  ------------------
  |  |  |  Branch (119:13): [Folded, False: 6]
  |  |  ------------------
  ------------------
  309|      6|    }
  310|       |
  311|      6|    *domain_id = domain->id;
  312|      6|}
ogs_log_vprintf:
  404|    322|{
  405|    322|    ogs_log_t *log = NULL;
  406|    322|    ogs_log_domain_t *domain = NULL;
  407|       |
  408|    322|    char logstr[OGS_HUGE_LEN];
  409|    322|    char *p, *last;
  410|       |
  411|    322|    int wrote_stderr = 0;
  412|       |
  413|    322|    ogs_list_for_each(&log_list, log) {
  ------------------
  |  |   76|    322|    for (node = ogs_list_first(list); (node); \
  |  |  ------------------
  |  |  |  Branch (76:39): [True: 322, False: 0]
  |  |  ------------------
  |  |   77|    322|        node = ogs_list_next(node))
  ------------------
  414|    322|        domain = ogs_pool_find(&domain_pool, id);
  ------------------
  |  |  154|    322|    (_index > 0 && _index <= (pool)->size) ? (pool)->index[_index-1] : NULL
  |  |  ------------------
  |  |  |  Branch (154:6): [True: 322, False: 0]
  |  |  |  Branch (154:20): [True: 322, False: 0]
  |  |  ------------------
  ------------------
  415|    322|        if (!domain) {
  ------------------
  |  Branch (415:13): [True: 0, False: 322]
  ------------------
  416|      0|            fprintf(stderr, "No LogDomain[id:%d] in %s:%d", id, file, line);
  417|      0|            ogs_assert_if_reached();
  ------------------
  |  |  122|      0|    do { \
  |  |  123|      0|        ogs_fatal("%s: should not be reached.", OGS_FUNC); \
  |  |  ------------------
  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|      0|#define OGS_LOG_DOMAIN      1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|      0|        ogs_abort(); \
  |  |  125|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  418|      0|        }
  419|    322|        if (domain->level < level)
  ------------------
  |  Branch (419:13): [True: 322, False: 0]
  ------------------
  420|    322|            return;
  421|       |
  422|      0|        p = logstr;
  423|      0|        last = logstr + OGS_HUGE_LEN;
  ------------------
  |  |  210|      0|#define OGS_HUGE_LEN                    8192  /* Can Stack */
  ------------------
  424|       |
  425|      0|        if (!content_only) {
  ------------------
  |  Branch (425:13): [True: 0, False: 0]
  ------------------
  426|      0|            if (log->print.timestamp)
  ------------------
  |  Branch (426:17): [True: 0, False: 0]
  ------------------
  427|      0|                p = log_timestamp(p, last, log->print.color);
  428|      0|            if (log->print.domain)
  ------------------
  |  Branch (428:17): [True: 0, False: 0]
  ------------------
  429|      0|                p = log_domain(p, last, domain->name, log->print.color);
  430|      0|            if (log->print.level)
  ------------------
  |  Branch (430:17): [True: 0, False: 0]
  ------------------
  431|      0|                p = log_level(p, last, level, log->print.color);
  432|      0|        }
  433|       |
  434|      0|        p = log_content(p, last, format, ap);
  435|       |
  436|      0|        if (err) {
  ------------------
  |  Branch (436:13): [True: 0, False: 0]
  ------------------
  437|      0|            char errbuf[OGS_HUGE_LEN];
  438|      0|            p = ogs_slprintf(p, last, " (%d:%s)",
  439|      0|                    (int)err, ogs_strerror(err, errbuf, OGS_HUGE_LEN));
  ------------------
  |  |  210|      0|#define OGS_HUGE_LEN                    8192  /* Can Stack */
  ------------------
  440|      0|        }
  441|       |
  442|      0|        if (!content_only) {
  ------------------
  |  Branch (442:13): [True: 0, False: 0]
  ------------------
  443|      0|            if (log->print.fileline)
  ------------------
  |  Branch (443:17): [True: 0, False: 0]
  ------------------
  444|      0|                p = ogs_slprintf(p, last, " (%s:%d)", file, line);
  445|      0|            if (log->print.function)
  ------------------
  |  Branch (445:17): [True: 0, False: 0]
  ------------------
  446|      0|                p = ogs_slprintf(p, last, " %s()", func);
  447|      0|            if (log->print.linefeed) 
  ------------------
  |  Branch (447:17): [True: 0, False: 0]
  ------------------
  448|      0|                p = log_linefeed(p, last);
  449|      0|        }
  450|       |
  451|      0|        log->writer(log, level, logstr);
  452|       |        
  453|      0|        if (log->type == OGS_LOG_STDERR_TYPE)
  ------------------
  |  Branch (453:13): [True: 0, False: 0]
  ------------------
  454|      0|            wrote_stderr = 1;
  455|      0|    }
  456|       |
  457|      0|    if (!wrote_stderr)
  ------------------
  |  Branch (457:9): [True: 0, False: 0]
  ------------------
  458|      0|    {
  459|      0|        int use_color = 0;
  460|      0|#if !defined(_WIN32)
  461|      0|        use_color = 1;
  462|      0|#endif
  463|       |
  464|      0|        p = logstr;
  465|      0|        last = logstr + OGS_HUGE_LEN;
  ------------------
  |  |  210|      0|#define OGS_HUGE_LEN                    8192  /* Can Stack */
  ------------------
  466|       |
  467|      0|        if (!content_only) {
  ------------------
  |  Branch (467:13): [True: 0, False: 0]
  ------------------
  468|      0|            p = log_timestamp(p, last, use_color);
  469|      0|            p = log_level(p, last, level, use_color);
  470|      0|        }
  471|      0|        p = log_content(p, last, format, ap);
  472|      0|        if (!content_only) {
  ------------------
  |  Branch (472:13): [True: 0, False: 0]
  ------------------
  473|      0|            p = ogs_slprintf(p, last, " (%s:%d)", file, line);
  474|      0|            p = ogs_slprintf(p, last, " %s()", func);
  475|      0|            p = log_linefeed(p, last);
  476|      0|        }
  477|       |
  478|      0|        fprintf(stderr, "%s", logstr);
  479|       |        fflush(stderr);
  480|      0|    }
  481|      0|}
ogs_log_printf:
  486|    322|{
  487|    322|    va_list args;
  488|       |
  489|    322|    va_start(args, format);
  490|    322|    ogs_log_vprintf(level, id,
  491|    322|            err, file, line, func, content_only, format, args);
  492|       |    va_end(args);
  493|    322|}
ogs-log.c:add_log:
  536|      1|{
  537|      1|    ogs_log_t *log = NULL;
  538|       |
  539|      1|    ogs_pool_alloc(&log_pool, &log);
  ------------------
  |  |  132|      1|#define ogs_pool_alloc(pool, node) do { \
  |  |  133|      1|    *(node) = NULL; \
  |  |  134|      1|    if ((pool)->avail > 0) { \
  |  |  ------------------
  |  |  |  Branch (134:9): [True: 1, False: 0]
  |  |  ------------------
  |  |  135|      1|        (pool)->avail--; \
  |  |  136|      1|        *(node) = (void*)(pool)->free[(pool)->head]; \
  |  |  137|      1|        (pool)->free[(pool)->head] = NULL; \
  |  |  138|      1|        (pool)->head = ((pool)->head + 1) % ((pool)->size); \
  |  |  139|      1|        (pool)->index[ogs_pool_index(pool, *(node))-1] = *(node); \
  |  |  ------------------
  |  |  |  |  152|      1|#define ogs_pool_index(pool, node) (((node) - (pool)->array)+1)
  |  |  ------------------
  |  |  140|      1|    } \
  |  |  141|      1|} while (0)
  |  |  ------------------
  |  |  |  Branch (141:10): [Folded, False: 1]
  |  |  ------------------
  ------------------
  540|      1|    ogs_assert(log);
  ------------------
  |  |  113|      1|    do { \
  |  |  114|      1|        if (ogs_likely(expr)) ; \
  |  |  ------------------
  |  |  |  |   54|      1|#define ogs_likely(x) __builtin_expect (!!(x), 1)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (54:23): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  115|      1|        else { \
  |  |  116|      0|            ogs_fatal("%s: Assertion `%s' failed.", OGS_FUNC, #expr); \
  |  |  ------------------
  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|      0|#define OGS_LOG_DOMAIN      1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|            ogs_abort(); \
  |  |  118|      0|        } \
  |  |  119|      1|    } while(0)
  |  |  ------------------
  |  |  |  Branch (119:13): [Folded, False: 1]
  |  |  ------------------
  ------------------
  541|      1|    memset(log, 0, sizeof *log);
  542|       |
  543|      1|    log->type = type;
  544|       |
  545|      1|    log->print.timestamp = 1;
  546|      1|    log->print.domain = 1;
  547|      1|    log->print.level = 1;
  548|      1|    log->print.fileline = 1;
  549|      1|    log->print.linefeed = 1;
  550|       |
  551|      1|    ogs_list_add(&log_list, log);
  552|       |
  553|      1|    return log;
  554|      1|}

ogs_mem_init:
   34|      1|{
   35|      1|    ogs_thread_mutex_init(&mutex);
  ------------------
  |  |   37|      1|#define ogs_thread_mutex_init(_n) (void)pthread_mutex_init((_n), NULL)
  ------------------
   36|       |
   37|      1|    talloc_enable_null_tracking();
   38|       |
   39|      1|#define TALLOC_MEMSIZE 1
   40|      1|    __ogs_talloc_core = talloc_named_const(NULL, TALLOC_MEMSIZE, "core");
  ------------------
  |  |   39|      1|#define TALLOC_MEMSIZE 1
  ------------------
   41|      1|}
ogs_talloc_zero_size:
   78|    152|{
   79|    152|    void *ptr = NULL;
   80|       |
   81|    152|    ogs_thread_mutex_lock(&mutex);
  ------------------
  |  |   38|    152|#define ogs_thread_mutex_lock (void)pthread_mutex_lock
  ------------------
   82|       |
   83|    152|    ptr = _talloc_zero(ctx, size, name);
   84|    152|    ogs_expect(ptr);
  ------------------
  |  |  128|    152|    do { \
  |  |  129|    152|        if (ogs_likely(expr)) ; \
  |  |  ------------------
  |  |  |  |   54|    152|#define ogs_likely(x) __builtin_expect (!!(x), 1)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (54:23): [True: 152, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  130|    152|        else { \
  |  |  131|      0|            ogs_error("%s: Expectation `%s' failed.", OGS_FUNC, #expr); \
  |  |  ------------------
  |  |  |  |   36|      0|#define ogs_error(...) ogs_log_message(OGS_LOG_ERROR, 0, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   23|      0|#define OGS_LOG_DOMAIN __ogs_mem_domain
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  132|      0|        } \
  |  |  133|    152|    } while (0)
  |  |  ------------------
  |  |  |  Branch (133:14): [Folded, False: 152]
  |  |  ------------------
  ------------------
   85|       |
   86|    152|    ogs_thread_mutex_unlock(&mutex);
  ------------------
  |  |   39|    152|#define ogs_thread_mutex_unlock (void)pthread_mutex_unlock
  ------------------
   87|       |
   88|    152|    return ptr;
   89|    152|}
ogs_talloc_free:
  107|    149|{
  108|    149|    int ret;
  109|       |
  110|    149|    ogs_thread_mutex_lock(&mutex);
  ------------------
  |  |   38|    149|#define ogs_thread_mutex_lock (void)pthread_mutex_lock
  ------------------
  111|       |
  112|    149|    ret = _talloc_free(ptr, location);
  113|       |
  114|    149|    ogs_thread_mutex_unlock(&mutex);
  ------------------
  |  |   39|    149|#define ogs_thread_mutex_unlock (void)pthread_mutex_unlock
  ------------------
  115|       |
  116|    149|    return ret;
  117|    149|}

ogs_pkbuf_put_data:
   91|    149|{
   92|    149|    void *tmp = ogs_pkbuf_put(pkbuf, len);
   93|       |
   94|    149|    memcpy(tmp, data, len);
   95|    149|    return tmp;
   96|    149|}
ogs_pkbuf_init:
   99|      1|{
  100|       |#if OGS_USE_TALLOC == 0
  101|       |    ogs_pool_init(&pkbuf_pool, ogs_core()->pkbuf.pool);
  102|       |
  103|       |#endif
  104|      1|}
ogs_pkbuf_default_init:
  114|      1|{
  115|       |#if OGS_USE_TALLOC == 0
  116|       |    ogs_assert(config);
  117|       |    memset(config, 0, sizeof *config);
  118|       |
  119|       |    config->cluster_128_pool = 65536;
  120|       |    config->cluster_256_pool = 16384;
  121|       |    config->cluster_512_pool = 4096;
  122|       |    config->cluster_1024_pool = 2048;
  123|       |    config->cluster_2048_pool = 1024;
  124|       |    config->cluster_8192_pool = 256;
  125|       |    config->cluster_32768_pool = 64;
  126|       |    config->cluster_big_pool = 8;
  127|       |#endif
  128|      1|}
ogs_pkbuf_default_create:
  131|      1|{
  132|       |#if OGS_USE_TALLOC == 0
  133|       |    default_pool = ogs_pkbuf_pool_create(config);
  134|       |#endif
  135|      1|}
ogs_pkbuf_alloc_debug:
  222|    149|{
  223|    149|#if OGS_USE_TALLOC == 1
  224|    149|    ogs_pkbuf_t *pkbuf = NULL;
  225|       |
  226|    149|    pkbuf = ogs_talloc_zero_size(pool, sizeof(*pkbuf) + size, file_line);
  227|    149|    if (!pkbuf) {
  ------------------
  |  Branch (227:9): [True: 0, False: 149]
  ------------------
  228|      0|        ogs_error("ogs_pkbuf_alloc() failed [size=%d]", size);
  ------------------
  |  |   36|      0|#define ogs_error(...) ogs_log_message(OGS_LOG_ERROR, 0, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  ------------------
  |  |  |  |  |  |   23|      0|#define OGS_LOG_DOMAIN __ogs_mem_domain
  |  |  |  |  ------------------
  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  ------------------
  ------------------
  229|      0|        return NULL;
  230|      0|    }
  231|       |
  232|    149|    pkbuf->head = pkbuf->_data;
  233|    149|    pkbuf->end = pkbuf->_data + size;
  234|       |
  235|    149|    pkbuf->len = 0;
  236|       |
  237|    149|    pkbuf->data = pkbuf->_data;
  238|    149|    pkbuf->tail = pkbuf->_data;
  239|       |
  240|    149|    pkbuf->file_line = file_line; /* For debug */
  241|       |
  242|    149|    return pkbuf;
  243|       |#else
  244|       |    ogs_pkbuf_t *pkbuf = NULL;
  245|       |    ogs_cluster_t *cluster = NULL;
  246|       |
  247|       |    if (pool == NULL)
  248|       |        pool = default_pool;
  249|       |    ogs_assert(pool);
  250|       |
  251|       |    ogs_thread_mutex_lock(&pool->mutex);
  252|       |
  253|       |    cluster = cluster_alloc(pool, size);
  254|       |    if (!cluster) {
  255|       |        ogs_error("ogs_pkbuf_alloc() failed [size=%d]", size);
  256|       |        ogs_thread_mutex_unlock(&pool->mutex);
  257|       |        return NULL;
  258|       |    }
  259|       |
  260|       |    ogs_pool_alloc(&pool->pkbuf, &pkbuf);
  261|       |    if (!pkbuf) {
  262|       |        ogs_error("ogs_pkbuf_alloc() failed [size=%d]", size);
  263|       |        ogs_thread_mutex_unlock(&pool->mutex);
  264|       |        return NULL;
  265|       |    }
  266|       |    memset(pkbuf, 0, sizeof(*pkbuf));
  267|       |
  268|       |    OGS_OBJECT_REF(cluster);
  269|       |
  270|       |    pkbuf->cluster = cluster;
  271|       |
  272|       |    pkbuf->len = 0;
  273|       |
  274|       |    pkbuf->data = cluster->buffer;
  275|       |    pkbuf->head = cluster->buffer;
  276|       |    pkbuf->tail = cluster->buffer;
  277|       |    pkbuf->end = cluster->buffer + size;
  278|       |
  279|       |    pkbuf->file_line = file_line; /* For debug */
  280|       |
  281|       |    pkbuf->pool = pool;
  282|       |
  283|       |    ogs_thread_mutex_unlock(&pool->mutex);
  284|       |
  285|       |    return pkbuf;
  286|       |#endif
  287|    149|}
ogs_pkbuf_free:
  290|    149|{
  291|    149|#if OGS_USE_TALLOC == 1
  292|    149|    ogs_talloc_free(pkbuf, OGS_FILE_LINE);
  ------------------
  |  |  213|    149|#define OGS_FILE_LINE __FILE__ ":" OGS_STRINGIFY(__LINE__)
  |  |  ------------------
  |  |  |  |  167|    149|#define OGS_STRINGIFY(n)            OGS_STRINGIFY_HELPER(n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  168|    149|#define OGS_STRINGIFY_HELPER(n)     #n
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  293|       |#else
  294|       |    ogs_pkbuf_pool_t *pool = NULL;
  295|       |    ogs_cluster_t *cluster = NULL;
  296|       |    ogs_assert(pkbuf);
  297|       |
  298|       |    pool = pkbuf->pool;
  299|       |    ogs_assert(pool);
  300|       |
  301|       |    ogs_thread_mutex_lock(&pool->mutex);
  302|       |
  303|       |    cluster = pkbuf->cluster;
  304|       |    ogs_assert(cluster);
  305|       |
  306|       |    if (OGS_OBJECT_IS_REF(cluster))
  307|       |        OGS_OBJECT_UNREF(cluster);
  308|       |    else
  309|       |        cluster_free(pool, pkbuf->cluster);
  310|       |
  311|       |    ogs_pool_free(&pool->pkbuf, pkbuf);
  312|       |
  313|       |    ogs_thread_mutex_unlock(&pool->mutex);
  314|       |#endif
  315|    149|}

ogs-pkbuf.c:ogs_pkbuf_put:
  115|    149|{
  116|    149|    void *tmp = pkbuf->tail;
  117|       |
  118|    149|    if (ogs_unlikely(ogs_pkbuf_tailroom(pkbuf) < (int)len))
  ------------------
  |  |   55|    149|#define ogs_unlikely(x) __builtin_expect (!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (55:25): [True: 0, False: 149]
  |  |  ------------------
  ------------------
  119|      0|        ogs_assert_if_reached();
  ------------------
  |  |  122|      0|    do { \
  |  |  123|      0|        ogs_fatal("%s: should not be reached.", OGS_FUNC); \
  |  |  ------------------
  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|      0|#define OGS_LOG_DOMAIN      1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|      0|        ogs_abort(); \
  |  |  125|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  120|       |
  121|    149|    pkbuf->tail += len;
  122|    149|    pkbuf->len += len;
  123|       |
  124|    149|    return tmp;
  125|    149|}
ogs-pkbuf.c:ogs_pkbuf_tailroom:
   99|    149|{
  100|    149|    return pkbuf->end - pkbuf->tail;
  101|    149|}

ogs_random:
   41|      1|{
   42|       |#ifdef _WIN32
   43|       |    void arc4random_buf(void *buf, size_t n);
   44|       |    arc4random_buf(buf, buflen);
   45|       |#elif defined(HAVE_GETRANDOM)
   46|      1|    int rc = getrandom(buf, buflen, GRND_NONBLOCK);
   47|      1|    if (rc < 0) {
  ------------------
  |  Branch (47:9): [True: 0, False: 1]
  ------------------
   48|      0|        ogs_log_message(OGS_LOG_FATAL, ogs_errno, "getrandom() failed");
  ------------------
  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  ------------------
  |  |  |  |   32|      0|#define OGS_LOG_DOMAIN      1
  |  |  ------------------
  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  ------------------
  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  ------------------
  |  |   45|      0|    0, __VA_ARGS__) 
  ------------------
   49|      0|        ogs_assert_if_reached();
  ------------------
  |  |  122|      0|    do { \
  |  |  123|      0|        ogs_fatal("%s: should not be reached.", OGS_FUNC); \
  |  |  ------------------
  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|      0|#define OGS_LOG_DOMAIN      1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|      0|        ogs_abort(); \
  |  |  125|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
   50|      0|    }
   51|       |#elif defined(HAVE_ARC4RANDOM_BUF)
   52|       |    arc4random_buf(buf, buflen);
   53|       |#elif defined(OGS_DEV_RANDOM)
   54|       |    int fd = -1;
   55|       |
   56|       |    /* On BSD/OS 4.1, /dev/random gives out 8 bytes at a time, then
   57|       |     * gives EOF, so reading 'buflen' bytes may require opening the
   58|       |     * device several times. */
   59|       |    do {
   60|       |        int rc;
   61|       |
   62|       |        if (fd == -1)
   63|       |            if ((fd = open(OGS_DEV_RANDOM, O_RDONLY)) == -1) {
   64|       |                ogs_log_message(OGS_LOG_FATAL, ogs_errno, "open() failed");
   65|       |                ogs_assert_if_reached();
   66|       |            }
   67|       |        
   68|       |        do {
   69|       |            rc = read(fd, buf, buflen);
   70|       |        } while (rc == -1 && errno == EINTR);
   71|       |
   72|       |        if (rc < 0) {
   73|       |            ogs_log_message(OGS_LOG_ERROR, ogs_errno, "read() failed");
   74|       |            close(fd);
   75|       |            return;
   76|       |        }
   77|       |        else if (rc == 0) {
   78|       |            close(fd);
   79|       |            fd = -1; /* force open() again */
   80|       |        }
   81|       |        else {
   82|       |            buf = (unsigned char *)buf + rc;
   83|       |            buflen -= rc;
   84|       |        }
   85|       |    } while (buflen > 0);
   86|       |    
   87|       |    close(fd);
   88|       |#else
   89|       |#error cannot find a method which finds a pseudo-random number
   90|       |#endif
   91|      1|}

ogs_socket_init:
   36|      1|{
   37|       |#if _WIN32
   38|       |    WORD wVersionRequested;
   39|       |    WSADATA wsaData;
   40|       |    int err;
   41|       |
   42|       |    wVersionRequested = MAKEWORD(2, 2);
   43|       |
   44|       |    err = WSAStartup(wVersionRequested, &wsaData);
   45|       |    ogs_assert(err == 0);
   46|       |#endif
   47|      1|}

ogs_tlv_init:
   54|      1|{
   55|       |    ogs_pool_init(&pool, ogs_core()->tlv.pool);
  ------------------
  |  |   52|      1|#define ogs_pool_init(pool, _size) do { \
  |  |   53|      1|    int i; \
  |  |   54|      1|    (pool)->name = #pool; \
  |  |   55|      1|    (pool)->free = malloc(sizeof(*(pool)->free) * _size); \
  |  |   56|      1|    ogs_assert((pool)->free); \
  |  |  ------------------
  |  |  |  |  113|      1|    do { \
  |  |  |  |  114|      1|        if (ogs_likely(expr)) ; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   54|      1|#define ogs_likely(x) __builtin_expect (!!(x), 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (54:23): [True: 1, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  115|      1|        else { \
  |  |  |  |  116|      0|            ogs_fatal("%s: Assertion `%s' failed.", OGS_FUNC, #expr); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   24|      0|#define OGS_LOG_DOMAIN __ogs_tlv_domain
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  117|      0|            ogs_abort(); \
  |  |  |  |  118|      0|        } \
  |  |  |  |  119|      1|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (119:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   57|      1|    (pool)->array = malloc(sizeof(*(pool)->array) * _size); \
  |  |   58|      1|    ogs_assert((pool)->array); \
  |  |  ------------------
  |  |  |  |  113|      1|    do { \
  |  |  |  |  114|      1|        if (ogs_likely(expr)) ; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   54|      1|#define ogs_likely(x) __builtin_expect (!!(x), 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (54:23): [True: 1, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  115|      1|        else { \
  |  |  |  |  116|      0|            ogs_fatal("%s: Assertion `%s' failed.", OGS_FUNC, #expr); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   24|      0|#define OGS_LOG_DOMAIN __ogs_tlv_domain
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  117|      0|            ogs_abort(); \
  |  |  |  |  118|      0|        } \
  |  |  |  |  119|      1|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (119:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   59|      1|    (pool)->index = malloc(sizeof(*(pool)->index) * _size); \
  |  |   60|      1|    ogs_assert((pool)->index); \
  |  |  ------------------
  |  |  |  |  113|      1|    do { \
  |  |  |  |  114|      1|        if (ogs_likely(expr)) ; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   54|      1|#define ogs_likely(x) __builtin_expect (!!(x), 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (54:23): [True: 1, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  115|      1|        else { \
  |  |  |  |  116|      0|            ogs_fatal("%s: Assertion `%s' failed.", OGS_FUNC, #expr); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   24|      0|#define OGS_LOG_DOMAIN __ogs_tlv_domain
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  117|      0|            ogs_abort(); \
  |  |  |  |  118|      0|        } \
  |  |  |  |  119|      1|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (119:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   61|      1|    (pool)->size = (pool)->avail = _size; \
  |  |   62|      1|    (pool)->head = (pool)->tail = 0; \
  |  |   63|    513|    for (i = 0; i < _size; i++) { \
  |  |  ------------------
  |  |  |  Branch (63:17): [True: 512, False: 1]
  |  |  ------------------
  |  |   64|    512|        (pool)->free[i] = &((pool)->array[i]); \
  |  |   65|    512|        (pool)->index[i] = NULL; \
  |  |   66|    512|    } \
  |  |   67|      1|    \
  |  |   68|      1|    (pool)->id_hash = ogs_hash_make(); \
  |  |   69|      1|    ogs_assert((pool)->id_hash); \
  |  |  ------------------
  |  |  |  |  113|      1|    do { \
  |  |  |  |  114|      1|        if (ogs_likely(expr)) ; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   54|      1|#define ogs_likely(x) __builtin_expect (!!(x), 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (54:23): [True: 1, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  115|      1|        else { \
  |  |  |  |  116|      0|            ogs_fatal("%s: Assertion `%s' failed.", OGS_FUNC, #expr); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   24|      0|#define OGS_LOG_DOMAIN __ogs_tlv_domain
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  117|      0|            ogs_abort(); \
  |  |  |  |  118|      0|        } \
  |  |  |  |  119|      1|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (119:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   70|      1|} while (0)
  |  |  ------------------
  |  |  |  Branch (70:10): [Folded, False: 1]
  |  |  ------------------
  ------------------
   56|      1|}

ogs_gtpu_parse_header:
   24|    298|{
   25|    298|    ogs_gtp2_header_t *gtp_h = NULL;
   26|    298|    ogs_gtp2_extension_header_t ext_hdesc;
   27|    298|    uint8_t *ext_h = NULL;
   28|    298|    uint16_t len = 0;
   29|    298|    int i;
   30|       |
   31|    298|    ogs_assert(pkbuf);
  ------------------
  |  |  113|    298|    do { \
  |  |  114|    298|        if (ogs_likely(expr)) ; \
  |  |  ------------------
  |  |  |  |   54|    298|#define ogs_likely(x) __builtin_expect (!!(x), 1)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (54:23): [True: 298, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  115|    298|        else { \
  |  |  116|      0|            ogs_fatal("%s: Assertion `%s' failed.", OGS_FUNC, #expr); \
  |  |  ------------------
  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|      0|#define OGS_LOG_DOMAIN __ogs_gtp_domain
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|            ogs_abort(); \
  |  |  118|      0|        } \
  |  |  119|    298|    } while(0)
  |  |  ------------------
  |  |  |  Branch (119:13): [Folded, False: 298]
  |  |  ------------------
  ------------------
   32|    298|    ogs_assert(pkbuf->data);
  ------------------
  |  |  113|    298|    do { \
  |  |  114|    298|        if (ogs_likely(expr)) ; \
  |  |  ------------------
  |  |  |  |   54|    298|#define ogs_likely(x) __builtin_expect (!!(x), 1)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (54:23): [True: 298, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  115|    298|        else { \
  |  |  116|      0|            ogs_fatal("%s: Assertion `%s' failed.", OGS_FUNC, #expr); \
  |  |  ------------------
  |  |  |  |   35|      0|#define ogs_fatal(...) ogs_log_message(OGS_LOG_FATAL, 0, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|      0|#define OGS_LOG_DOMAIN __ogs_gtp_domain
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|            ogs_abort(); \
  |  |  118|      0|        } \
  |  |  119|    298|    } while(0)
  |  |  ------------------
  |  |  |  Branch (119:13): [Folded, False: 298]
  |  |  ------------------
  ------------------
   33|       |
   34|    298|    gtp_h = (ogs_gtp2_header_t *)pkbuf->data;
   35|       |
   36|    298|    if (header_desc) {
  ------------------
  |  Branch (36:9): [True: 149, False: 149]
  ------------------
   37|    149|        memset(header_desc, 0, sizeof(*header_desc));
   38|       |
   39|    149|        header_desc->flags = gtp_h->flags;
   40|    149|        header_desc->type = gtp_h->type;
   41|    149|        header_desc->teid = be32toh(gtp_h->teid);
   42|    149|    }
   43|       |
   44|    298|    len = OGS_GTPV1U_HEADER_LEN;
  ------------------
  |  |   39|    298|#define OGS_GTPV1U_HEADER_LEN   8
  ------------------
   45|    298|    if (pkbuf->len < len) {
  ------------------
  |  Branch (45:9): [True: 0, False: 298]
  ------------------
   46|      0|        ogs_error("the length of the packet is insufficient[%d:%d]",
  ------------------
  |  |   36|      0|#define ogs_error(...) ogs_log_message(OGS_LOG_ERROR, 0, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   43|      0|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|      0|#define OGS_LOG_DOMAIN __ogs_gtp_domain
  |  |  |  |  ------------------
  |  |  |  |   44|      0|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define OGS_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |   45|      0|    0, __VA_ARGS__) 
  |  |  ------------------
  ------------------
   47|      0|                pkbuf->len, len);
   48|      0|        return -1;
   49|      0|    }
   50|       |
   51|    298|    if (gtp_h->flags & OGS_GTPU_FLAGS_E) {
  ------------------
  |  |   55|    298|#define OGS_GTPU_FLAGS_E                        0x04
  ------------------
  |  Branch (51:9): [True: 260, False: 38]
  ------------------
   52|       |
   53|    260|        len += OGS_GTPV1U_EXTENSION_HEADER_LEN;
  ------------------
  |  |   52|    260|#define OGS_GTPV1U_EXTENSION_HEADER_LEN 4
  ------------------
   54|    260|        if (pkbuf->len < len) {
  ------------------
  |  Branch (54:13): [True: 6, False: 254]
  ------------------
   55|      6|            ogs_error("the length of the packet is insufficient[%d:%d]",
  ------------------
  |  |   36|      6|#define ogs_error(...) ogs_log_message(OGS_LOG_ERROR, 0, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   43|      6|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|      6|#define OGS_LOG_DOMAIN __ogs_gtp_domain
  |  |  |  |  ------------------
  |  |  |  |   44|      6|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      6|#define OGS_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |   45|      6|    0, __VA_ARGS__) 
  |  |  ------------------
  ------------------
   56|      6|                    pkbuf->len, len);
   57|      6|            return -1;
   58|      6|        }
   59|       |
   60|       |        /*
   61|       |         * TS29.281
   62|       |         * 5.2.1 General format of the GTP-U Extension Header
   63|       |         *
   64|       |         * If no such Header follows,
   65|       |         * then the value of the Next Extension Header Type shall be 0. */
   66|       |
   67|    254|        i = 0;
   68|  4.26k|        while (*(ext_h = (((uint8_t *)gtp_h) + len - 1)) &&
  ------------------
  |  Branch (68:16): [True: 4.21k, False: 50]
  ------------------
   69|  4.21k|                i < OGS_GTP2_NUM_OF_EXTENSION_HEADER) {
  ------------------
  |  |   80|  4.21k|#define OGS_GTP2_NUM_OF_EXTENSION_HEADER 8
  ------------------
  |  Branch (69:17): [True: 4.17k, False: 39]
  ------------------
   70|       |        /*
   71|       |         * The length of the Extension header shall be defined
   72|       |         * in a variable length of 4 octets, i.e. m+1 = n*4 octets,
   73|       |         * where n is a positive integer.
   74|       |         */
   75|       |            /* The Extension Header Length octet must be in the packet */
   76|  4.17k|            if (pkbuf->len < len + 1) {
  ------------------
  |  Branch (76:17): [True: 72, False: 4.10k]
  ------------------
   77|     72|                ogs_error("the length of the packet is insufficient[%d:%d]",
  ------------------
  |  |   36|     72|#define ogs_error(...) ogs_log_message(OGS_LOG_ERROR, 0, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   43|     72|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|     72|#define OGS_LOG_DOMAIN __ogs_gtp_domain
  |  |  |  |  ------------------
  |  |  |  |   44|     72|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     72|#define OGS_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |   45|     72|    0, __VA_ARGS__) 
  |  |  ------------------
  ------------------
   78|     72|                        pkbuf->len, len + 1);
   79|     72|                return -1;
   80|     72|            }
   81|       |
   82|  4.10k|            len += (*(++ext_h)) * 4;
   83|  4.10k|            if (*ext_h == 0) {
  ------------------
  |  Branch (83:17): [True: 9, False: 4.09k]
  ------------------
   84|      9|                ogs_error("No length in the Extension header");
  ------------------
  |  |   36|      9|#define ogs_error(...) ogs_log_message(OGS_LOG_ERROR, 0, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   43|      9|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|      9|#define OGS_LOG_DOMAIN __ogs_gtp_domain
  |  |  |  |  ------------------
  |  |  |  |   44|      9|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      9|#define OGS_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |   45|      9|    0, __VA_ARGS__) 
  |  |  ------------------
  ------------------
   85|      9|                return -1;
   86|      9|            }
   87|       |
   88|  4.09k|            if (((*ext_h) * 4) > OGS_GTP2_MAX_EXTENSION_HEADER_LEN) {
  ------------------
  |  |   78|  4.09k|#define OGS_GTP2_MAX_EXTENSION_HEADER_LEN 4
  ------------------
  |  Branch (88:17): [True: 62, False: 4.03k]
  ------------------
   89|     62|                ogs_error("Overflow length : %d", (*ext_h));
  ------------------
  |  |   36|     62|#define ogs_error(...) ogs_log_message(OGS_LOG_ERROR, 0, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   43|     62|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|     62|#define OGS_LOG_DOMAIN __ogs_gtp_domain
  |  |  |  |  ------------------
  |  |  |  |   44|     62|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     62|#define OGS_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |   45|     62|    0, __VA_ARGS__) 
  |  |  ------------------
  ------------------
   90|     62|                return -1;
   91|     62|            }
   92|       |
   93|  4.03k|            if (pkbuf->len < len) {
  ------------------
  |  Branch (93:17): [True: 22, False: 4.01k]
  ------------------
   94|     22|                ogs_error("the length of the packet is insufficient[%d:%d]",
  ------------------
  |  |   36|     22|#define ogs_error(...) ogs_log_message(OGS_LOG_ERROR, 0, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   43|     22|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|     22|#define OGS_LOG_DOMAIN __ogs_gtp_domain
  |  |  |  |  ------------------
  |  |  |  |   44|     22|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     22|#define OGS_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |   45|     22|    0, __VA_ARGS__) 
  |  |  ------------------
  ------------------
   95|     22|                        pkbuf->len, len);
   96|     22|                return -1;
   97|     22|            }
   98|       |
   99|  4.01k|            if (!header_desc) /* Skip to extract header content */
  ------------------
  |  Branch (99:17): [True: 3.51k, False: 495]
  ------------------
  100|  3.51k|                continue;
  101|       |
  102|       |            /* Copy Header Content */
  103|    495|            memcpy(&ext_hdesc.array[i], ext_h-1, (*ext_h) * 4);
  104|       |
  105|    495|            switch (ext_hdesc.array[i].type) {
  106|     79|            case OGS_GTP2_EXTENSION_HEADER_TYPE_PDU_SESSION_CONTAINER:
  ------------------
  |  |   55|     79|#define OGS_GTP2_EXTENSION_HEADER_TYPE_PDU_SESSION_CONTAINER 0x85
  ------------------
  |  Branch (106:13): [True: 79, False: 416]
  ------------------
  107|     79|                header_desc->pdu_type = ext_hdesc.array[i].pdu_type;
  108|     79|                if (ext_hdesc.array[i].pdu_type ==
  ------------------
  |  Branch (108:21): [True: 36, False: 43]
  ------------------
  109|     79|                    OGS_GTP2_EXTENSION_HEADER_PDU_TYPE_UL_PDU_SESSION_INFORMATION) {
  ------------------
  |  |   66|     79|#define OGS_GTP2_EXTENSION_HEADER_PDU_TYPE_UL_PDU_SESSION_INFORMATION 1
  ------------------
  110|     36|                        header_desc->qos_flow_identifier =
  111|     36|                            ext_hdesc.array[i].qos_flow_identifier;
  112|     36|                        ogs_trace("   QFI [0x%x]",
  ------------------
  |  |   40|     36|#define ogs_trace(...) ogs_log_message(OGS_LOG_TRACE, 0, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   43|     36|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|     36|#define OGS_LOG_DOMAIN __ogs_gtp_domain
  |  |  |  |  ------------------
  |  |  |  |   44|     36|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     36|#define OGS_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |   45|     36|    0, __VA_ARGS__) 
  |  |  ------------------
  ------------------
  113|     36|                                header_desc->qos_flow_identifier);
  114|     36|                }
  115|     79|                break;
  116|     25|            case OGS_GTP2_EXTENSION_HEADER_TYPE_UDP_PORT:
  ------------------
  |  |   54|     25|#define OGS_GTP2_EXTENSION_HEADER_TYPE_UDP_PORT 0x40
  ------------------
  |  Branch (116:13): [True: 25, False: 470]
  ------------------
  117|     25|                header_desc->udp.presence = true;
  118|     25|                header_desc->udp.port = be16toh(ext_hdesc.array[i].udp_port);
  119|       |
  120|     25|                ogs_trace("   UDP Port [%d]", header_desc->udp.port);
  ------------------
  |  |   40|     25|#define ogs_trace(...) ogs_log_message(OGS_LOG_TRACE, 0, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   43|     25|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|     25|#define OGS_LOG_DOMAIN __ogs_gtp_domain
  |  |  |  |  ------------------
  |  |  |  |   44|     25|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     25|#define OGS_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |   45|     25|    0, __VA_ARGS__) 
  |  |  ------------------
  ------------------
  121|     25|                break;
  122|     42|            case OGS_GTP2_EXTENSION_HEADER_TYPE_PDCP_NUMBER:
  ------------------
  |  |   56|     42|#define OGS_GTP2_EXTENSION_HEADER_TYPE_PDCP_NUMBER 0xc0
  ------------------
  |  Branch (122:13): [True: 42, False: 453]
  ------------------
  123|     42|                header_desc->pdcp_number_presence = true;
  124|     42|                header_desc->pdcp_number =
  125|     42|                    be16toh(ext_hdesc.array[i].pdcp_number);
  126|       |
  127|     42|                ogs_trace("   PDCP Number [%d]", header_desc->pdcp_number);
  ------------------
  |  |   40|     42|#define ogs_trace(...) ogs_log_message(OGS_LOG_TRACE, 0, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   43|     42|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|     42|#define OGS_LOG_DOMAIN __ogs_gtp_domain
  |  |  |  |  ------------------
  |  |  |  |   44|     42|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     42|#define OGS_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |   45|     42|    0, __VA_ARGS__) 
  |  |  ------------------
  ------------------
  128|     42|                break;
  129|    349|            default:
  ------------------
  |  Branch (129:13): [True: 349, False: 146]
  ------------------
  130|    349|                break;
  131|    495|            }
  132|       |
  133|    495|            i++;
  134|    495|        }
  135|       |
  136|     89|        if (i >= OGS_GTP2_NUM_OF_EXTENSION_HEADER) {
  ------------------
  |  |   80|     89|#define OGS_GTP2_NUM_OF_EXTENSION_HEADER 8
  ------------------
  |  Branch (136:13): [True: 40, False: 49]
  ------------------
  137|     40|            ogs_error("The number of extension headers is limited to [%d]", i);
  ------------------
  |  |   36|     40|#define ogs_error(...) ogs_log_message(OGS_LOG_ERROR, 0, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   43|     40|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|     40|#define OGS_LOG_DOMAIN __ogs_gtp_domain
  |  |  |  |  ------------------
  |  |  |  |   44|     40|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     40|#define OGS_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |   45|     40|    0, __VA_ARGS__) 
  |  |  ------------------
  ------------------
  138|     40|            return -1;
  139|     40|        }
  140|       |
  141|     89|    } else if (gtp_h->flags & (OGS_GTPU_FLAGS_S|OGS_GTPU_FLAGS_PN)) {
  ------------------
  |  |   56|     38|#define OGS_GTPU_FLAGS_S                        0x02
  ------------------
                  } else if (gtp_h->flags & (OGS_GTPU_FLAGS_S|OGS_GTPU_FLAGS_PN)) {
  ------------------
  |  |   57|     38|#define OGS_GTPU_FLAGS_PN                       0x01
  ------------------
  |  Branch (141:16): [True: 10, False: 28]
  ------------------
  142|       |        /*
  143|       |         * If and only if one or more of these three flags are set,
  144|       |         * the fields Sequence Number, N-PDU and Extension Header
  145|       |         * shall be present. The sender shall set all the bits of
  146|       |         * the unused fields to zero. The receiver shall not evaluate
  147|       |         * the unused fields.
  148|       |         * For example, if only the E flag is set to 1, then
  149|       |         * the N-PDU Number and Sequence Number fields shall also be present,
  150|       |         * but will not have meaningful values and shall not be evaluated.
  151|       |         */
  152|     10|        len += 4;
  153|     10|    }
  154|       |
  155|     87|    if (pkbuf->len < len) {
  ------------------
  |  Branch (155:9): [True: 8, False: 79]
  ------------------
  156|      8|        ogs_error("the length of the packet is insufficient[%d:%d]",
  ------------------
  |  |   36|      8|#define ogs_error(...) ogs_log_message(OGS_LOG_ERROR, 0, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   43|      8|    ogs_log_printf(level, OGS_LOG_DOMAIN, \
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|      8|#define OGS_LOG_DOMAIN __ogs_gtp_domain
  |  |  |  |  ------------------
  |  |  |  |   44|      8|    err, __FILE__, __LINE__, OGS_FUNC,  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      8|#define OGS_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |   45|      8|    0, __VA_ARGS__) 
  |  |  ------------------
  ------------------
  157|      8|                pkbuf->len, len);
  158|      8|        return -1;
  159|      8|    }
  160|       |
  161|     79|    return len;
  162|     87|}

initialize:
   24|      1|void initialize(void) {
   25|       |
   26|      1|    ogs_pkbuf_config_t config;
   27|       |
   28|      1|    ogs_core_initialize();
   29|       |
   30|      1|    ogs_pkbuf_default_init(&config);
   31|      1|    ogs_pkbuf_default_create(&config);
   32|       |
   33|      1|    initialized = 1;
   34|      1|}

LLVMFuzzerTestOneInput:
   10|    175|{
   11|    175|    ogs_pkbuf_t *pkbuf;
   12|    175|    ogs_gtp2_header_desc_t header;
   13|       |
   14|    175|    if (Size < kMinInputLength || Size > kMaxInputLength)
  ------------------
  |  |    6|    175|#define kMinInputLength OGS_GTPV1U_HEADER_LEN
  |  |  ------------------
  |  |  |  |   39|    350|#define OGS_GTPV1U_HEADER_LEN   8
  |  |  ------------------
  ------------------
                  if (Size < kMinInputLength || Size > kMaxInputLength)
  ------------------
  |  |    7|    171|#define kMaxInputLength 2048
  ------------------
  |  Branch (14:9): [True: 4, False: 171]
  |  Branch (14:35): [True: 22, False: 149]
  ------------------
   15|     26|        return 0;
   16|       |
   17|    149|    if (!initialized) {
  ------------------
  |  Branch (17:9): [True: 1, False: 148]
  ------------------
   18|      1|        initialize();
   19|      1|        ogs_log_install_domain(&__ogs_gtp_domain, "gtp", OGS_LOG_NONE);
   20|      1|    }
   21|       |
   22|    149|    pkbuf = ogs_pkbuf_alloc(NULL, Size);
  ------------------
  |  |   87|    149|    ogs_pkbuf_alloc_debug(pool, size, OGS_FILE_LINE)
  |  |  ------------------
  |  |  |  |  213|    149|#define OGS_FILE_LINE __FILE__ ":" OGS_STRINGIFY(__LINE__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  167|    149|#define OGS_STRINGIFY(n)            OGS_STRINGIFY_HELPER(n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  168|    149|#define OGS_STRINGIFY_HELPER(n)     #n
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   23|    149|    if (pkbuf == NULL)
  ------------------
  |  Branch (23:9): [True: 0, False: 149]
  ------------------
   24|      0|        return 0;
   25|       |
   26|    149|    ogs_pkbuf_put_data(pkbuf, Data, Size);
   27|    149|    ogs_gtpu_parse_header(&header, pkbuf);
   28|    149|    ogs_gtpu_parse_header(NULL, pkbuf);
   29|    149|    ogs_pkbuf_free(pkbuf);
   30|       |
   31|    149|    return 0;
   32|    149|}

