Singly-linked list type. More...
Include dependency graph for list.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | ListNode |
| A List node for strings. More... | |
Typedefs | |
| typedef void(* | list_free_t) (void **ptr) |
Functions | |
| STAILQ_HEAD (ListHead, ListNode) | |
| void | mutt_list_clear (struct ListHead *h) |
| Free a list, but NOT its strings. | |
| void | mutt_list_copy_tail (struct ListHead *dst, const struct ListHead *src) |
| Copy a list into another list. | |
| bool | mutt_list_equal (const struct ListHead *ah, const struct ListHead *bh) |
| Compare two string lists. | |
| struct ListNode * | mutt_list_find (const struct ListHead *h, const char *data) |
| Find a string in a List. | |
| void | mutt_list_free (struct ListHead *h) |
| Free a List AND its strings. | |
| void | mutt_list_free_type (struct ListHead *h, list_free_t fn) |
| Free a List of type. | |
| struct ListNode * | mutt_list_insert_after (struct ListHead *h, struct ListNode *n, char *s) |
| Insert a string after a given ListNode. | |
| struct ListNode * | mutt_list_insert_head (struct ListHead *h, char *s) |
| Insert a string at the beginning of a List. | |
| struct ListNode * | mutt_list_insert_tail (struct ListHead *h, char *s) |
| Append a string to the end of a List. | |
| bool | mutt_list_match (const char *s, struct ListHead *h) |
| Is the string in the list (see notes) | |
| size_t | mutt_list_str_split (struct ListHead *head, const char *src, char sep) |
| Split a string into a list using a separator char. | |
| size_t | mutt_list_write (const struct ListHead *h, struct Buffer *buf) |
| Write a list to a buffer. | |
Singly-linked list type.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file list.h.
| STAILQ_HEAD | ( | ListHead | , |
| ListNode | ) |
| void mutt_list_clear | ( | struct ListHead * | h | ) |
Free a list, but NOT its strings.
| h | Head of the List |
This can be used when the strings have a different lifetime to the List.
Definition at line 166 of file list.c.
Here is the caller graph for this function:| void mutt_list_copy_tail | ( | struct ListHead * | dst, |
| const struct ListHead * | src ) |
Copy a list into another list.
| dst | Destination list |
| src | Source list |
Definition at line 275 of file list.c.
Here is the call graph for this function:
Here is the caller graph for this function:| bool mutt_list_equal | ( | const struct ListHead * | ah, |
| const struct ListHead * | bh ) |
Compare two string lists.
| ah | First string list |
| bh | Second string list |
| true | Lists are identical |
To be identical, the lists must both be the same length and contain the same strings. Two empty lists are identical.
Definition at line 217 of file list.c.
Here is the call graph for this function:
Here is the caller graph for this function:| struct ListNode * mutt_list_find | ( | const struct ListHead * | h, |
| const char * | data ) |
Find a string in a List.
| h | Head of the List |
| data | String to find |
| ptr | ListNode containing the string |
| NULL | The string isn't found |
Definition at line 103 of file list.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void mutt_list_free | ( | struct ListHead * | h | ) |
Free a List AND its strings.
| h | Head of the List |
Definition at line 123 of file list.c.
Here is the caller graph for this function:| void mutt_list_free_type | ( | struct ListHead * | h, |
| list_free_t | fn ) |
Free a List of type.
| h | Head of the List |
| fn | Function to free contents of ListNode |
Definition at line 144 of file list.c.
Here is the caller graph for this function:Insert a string after a given ListNode.
| h | Head of the List |
| n | ListNode after which the string will be inserted |
| s | String to insert |
| ptr | Newly created ListNode containing the string |
Definition at line 85 of file list.c.
Here is the caller graph for this function:| struct ListNode * mutt_list_insert_head | ( | struct ListHead * | h, |
| char * | s ) |
Insert a string at the beginning of a List.
| h | Head of the List |
| s | String to insert |
| ptr | Newly inserted ListNode containing the string |
Definition at line 46 of file list.c.
Here is the caller graph for this function:| struct ListNode * mutt_list_insert_tail | ( | struct ListHead * | h, |
| char * | s ) |
Append a string to the end of a List.
| h | Head of the List |
| s | String to insert |
| ptr | Newly appended ListNode containing the string |
Definition at line 65 of file list.c.
Here is the caller graph for this function:| bool mutt_list_match | ( | const char * | s, |
| struct ListHead * | h ) |
Is the string in the list (see notes)
| s | String to match |
| h | Head of the List |
| true | String matches a List item (or List contains "*") |
This is a very specific function. It searches a List of strings looking for a match. If the list contains a string "*", then it match any input string.
Definition at line 194 of file list.c.
Here is the call graph for this function:
Here is the caller graph for this function:| size_t mutt_list_str_split | ( | struct ListHead * | head, |
| const char * | src, | ||
| char | sep ) |
Split a string into a list using a separator char.
| head | List to add to |
| src | String to split |
| sep | Word separator |
| num | Number of items in list |
Definition at line 246 of file list.c.
Here is the call graph for this function:
Here is the caller graph for this function:| size_t mutt_list_write | ( | const struct ListHead * | h, |
| struct Buffer * | buf ) |
Write a list to a buffer.
| h | List to write |
| buf | Buffer for the list |
Elements separated by a space. References, and In-Reply-To, use this format.
Definition at line 293 of file list.c.
Here is the call graph for this function:
Here is the caller graph for this function: