VirtualBox

source: vbox/trunk/src/libs/curl-8.11.1/lib/llist.h@ 108333

最後變更 在這個檔案從108333是 108048,由 vboxsync 提交於 7 週 前

curl-8.11.1: Applied and adjusted our curl changes to 8.7.1. jiraref:VBP-1535

  • 屬性 svn:eol-style 設為 native
檔案大小: 3.2 KB
 
1#ifndef HEADER_CURL_LLIST_H
2#define HEADER_CURL_LLIST_H
3/***************************************************************************
4 * _ _ ____ _
5 * Project ___| | | | _ \| |
6 * / __| | | | |_) | |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
9 *
10 * Copyright (C) Daniel Stenberg, <[email protected]>, 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
27#include "curl_setup.h"
28#include <stddef.h>
29
30typedef void (*Curl_llist_dtor)(void *user, void *elem);
31
32/* none of these struct members should be referenced directly, use the
33 dedicated functions */
34
35struct Curl_llist {
36 struct Curl_llist_node *_head;
37 struct Curl_llist_node *_tail;
38 Curl_llist_dtor _dtor;
39 size_t _size;
40#ifdef DEBUGBUILD
41 int _init; /* detect API usage mistakes */
42#endif
43};
44
45struct Curl_llist_node {
46 struct Curl_llist *_list; /* the list where this belongs */
47 void *_ptr;
48 struct Curl_llist_node *_prev;
49 struct Curl_llist_node *_next;
50#ifdef DEBUGBUILD
51 int _init; /* detect API usage mistakes */
52#endif
53};
54
55void Curl_llist_init(struct Curl_llist *, Curl_llist_dtor);
56void Curl_llist_insert_next(struct Curl_llist *, struct Curl_llist_node *,
57 const void *, struct Curl_llist_node *node);
58void Curl_llist_append(struct Curl_llist *,
59 const void *, struct Curl_llist_node *node);
60void Curl_node_uremove(struct Curl_llist_node *, void *);
61void Curl_node_remove(struct Curl_llist_node *);
62void Curl_llist_destroy(struct Curl_llist *, void *);
63
64/* Curl_llist_head() returns the first 'struct Curl_llist_node *', which
65 might be NULL */
66struct Curl_llist_node *Curl_llist_head(struct Curl_llist *list);
67
68/* Curl_llist_tail() returns the last 'struct Curl_llist_node *', which
69 might be NULL */
70struct Curl_llist_node *Curl_llist_tail(struct Curl_llist *list);
71
72/* Curl_llist_count() returns a size_t the number of nodes in the list */
73size_t Curl_llist_count(struct Curl_llist *list);
74
75/* Curl_node_elem() returns the custom data from a Curl_llist_node */
76void *Curl_node_elem(struct Curl_llist_node *n);
77
78/* Curl_node_next() returns the next element in a list from a given
79 Curl_llist_node */
80struct Curl_llist_node *Curl_node_next(struct Curl_llist_node *n);
81
82/* Curl_node_prev() returns the previous element in a list from a given
83 Curl_llist_node */
84struct Curl_llist_node *Curl_node_prev(struct Curl_llist_node *n);
85
86/* Curl_node_llist() return the list the node is in or NULL. */
87struct Curl_llist *Curl_node_llist(struct Curl_llist_node *n);
88
89#endif /* HEADER_CURL_LLIST_H */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette