| 547 | } |
| 548 | |
| 549 | static h2_push_diary *diary_create(apr_pool_t *p, h2_push_digest_type dtype, |
| 550 | int N) |
| 551 | { |
| 552 | h2_push_diary *diary = NULL; |
| 553 | |
| 554 | if (N > 0) { |
| 555 | diary = apr_pcalloc(p, sizeof(*diary)); |
| 556 | |
| 557 | diary->NMax = ceil_power_of_2(N); |
| 558 | diary->N = diary->NMax; |
| 559 | /* the mask we use in value comparison depends on where we got |
| 560 | * the values from. If we calculate them ourselves, we can use |
| 561 | * the full 64 bits. |
| 562 | * If we set the diary via a compressed golomb set, we have less |
| 563 | * relevant bits and need to use a smaller mask. */ |
| 564 | diary->mask_bits = 64; |
| 565 | /* grows by doubling, start with a power of 2 */ |
| 566 | diary->entries = apr_array_make(p, 16, sizeof(h2_push_diary_entry)); |
| 567 | |
| 568 | switch (dtype) { |
| 569 | #ifdef H2_OPENSSL |
| 570 | case H2_PUSH_DIGEST_SHA256: |
| 571 | diary->dtype = H2_PUSH_DIGEST_SHA256; |
| 572 | diary->dcalc = calc_sha256_hash; |
| 573 | break; |
| 574 | #endif /* ifdef H2_OPENSSL */ |
| 575 | default: |
| 576 | diary->dtype = H2_PUSH_DIGEST_APR_HASH; |
| 577 | diary->dcalc = calc_apr_hash; |
| 578 | break; |
| 579 | } |
| 580 | } |
| 581 | |
| 582 | return diary; |
| 583 | } |
| 584 | |
| 585 | h2_push_diary *h2_push_diary_create(apr_pool_t *p, int N) |
| 586 | { |
no test coverage detected