Coverage Report

Created: 2026-10-22 06:48

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/curl/lib/ptrarray.h
Line
Count
Source
1
#ifndef HEADER_CURL_PTRARRAY_H
2
#define HEADER_CURL_PTRARRAY_H
3
/***************************************************************************
4
 *                                  _   _ ____  _
5
 *  Project                     ___| | | |  _ \| |
6
 *                             / __| | | | |_) | |
7
 *                            | (__| |_| |  _ <| |___
8
 *                             \___|\___/|_| \_\_____|
9
 *
10
 * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
11
 *
12
 * This software is licensed as described in the file COPYING, which
13
 * you should have received as part of this distribution. The terms
14
 * are also available at https://curl.se/docs/copyright.html.
15
 *
16
 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17
 * copies of the Software, and permit persons to whom the Software is
18
 * furnished to do so, under the terms of the COPYING file.
19
 *
20
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21
 * KIND, either express or implied.
22
 *
23
 * SPDX-License-Identifier: curl
24
 *
25
 ***************************************************************************/
26
#include "curl_setup.h"
27
28
/* An array of pointers with up to UINT32_MAX entries */
29
struct ptrarray {
30
  void **data; /* #capacity array of pointers */
31
  uint32_t n;
32
  uint32_t capacity;
33
};
34
35
void Curl_ptrarray_init(struct ptrarray *pa);
36
37
void Curl_ptrarray_clear(struct ptrarray *pa);
38
39
uint32_t Curl_ptrarray_count(struct ptrarray *pa);
40
41
CURLcode Curl_ptrarray_add(struct ptrarray *pa, void *ptr);
42
43
void *Curl_ptrarray_remove(struct ptrarray *pa, uint32_t idx);
44
45
void *Curl_ptrarray_get(struct ptrarray *pa, uint32_t idx);
46
47
19.0k
#define CURL_PTRARRAY_COUNT(a)    ((a)->n)
48
0
#define CURL_PTRARRAY_GET(a, i)   (((i) < ((a)->n)) ? (a)->data[(i)] : NULL)
49
50
#endif /* HEADER_CURL_PTRARRAY_H */