-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist.h
70 lines (57 loc) · 1.47 KB
/
list.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
* This file is part of John the Ripper password cracker,
* Copyright (c) 1996-98,2013 by Solar Designer
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted.
*
* There's ABSOLUTELY NO WARRANTY, express or implied.
*/
/*
* String list management routines.
*/
#ifndef _JOHN_LIST_H
#define _JOHN_LIST_H
/*
* String list entry, allocated as (sizeof(struct list_entry) + strlen(data)).
*/
struct list_entry {
struct list_entry *next;
char data[1];
};
/*
* Main string list structure, head is used to start scanning the list, while
* tail is used to add new entries.
*/
struct list_main {
struct list_entry *head, *tail;
int count;
};
/*
* Initializes an empty string list.
*/
extern void list_init(struct list_main **list);
/*
* Adds an entry to the list.
*/
extern void list_add(struct list_main *list, char *data);
/*
* Adds a previously allocated entry to the list.
*/
extern void list_add_link(struct list_main *list, struct list_entry *entry);
/*
* Adds multiple entries to the list from a comma-separated string.
*/
extern void list_add_multi(struct list_main *list, char *data);
/*
* Adds an entry to the list checking for dupes. This is slow, and should
* only be used on tiny lists.
*/
extern void list_add_unique(struct list_main *list, char *data);
#if 0
/*
* Deletes the entry following prev from the list.
*/
extern void list_del_next(struct list_main *list, struct list_entry *prev);
#endif
#endif