2018-11-27 17:22:45 +00:00
|
|
|
/* myMPD
|
2019-01-08 00:09:43 +00:00
|
|
|
(c) 2018-2019 Juergen Mang <mail@jcgames.de>
|
2018-11-27 17:22:45 +00:00
|
|
|
This project's homepage is: https://github.com/jcorporation/mympd
|
|
|
|
|
|
|
|
This linked list implementation is based on: https://github.com/joshkunz/ashuffle
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; version 2 of the License.
|
|
|
|
|
|
|
|
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, write to the Free Software Foundation, Inc.,
|
|
|
|
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2019-01-05 00:01:34 +00:00
|
|
|
#ifndef __LIST_H__
|
|
|
|
#define __LIST_H__
|
|
|
|
|
2018-10-07 21:21:00 +00:00
|
|
|
struct node {
|
|
|
|
char *data;
|
2018-11-13 23:50:30 +00:00
|
|
|
long value;
|
2018-10-07 21:21:00 +00:00
|
|
|
struct node *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct list {
|
|
|
|
unsigned length;
|
|
|
|
struct node *list;
|
|
|
|
};
|
|
|
|
|
2018-10-08 20:44:22 +00:00
|
|
|
int list_init(struct list *l);
|
2018-10-18 21:33:11 +00:00
|
|
|
int list_push(struct list *l, const char *data, int value);
|
2018-11-13 23:50:30 +00:00
|
|
|
int list_insert(struct list *l, const char *data, int value);
|
2018-11-12 23:48:29 +00:00
|
|
|
int list_shift(struct list *l, unsigned idx);
|
|
|
|
struct node *list_node_extract(struct list *l, unsigned idx);
|
2018-10-18 21:33:11 +00:00
|
|
|
int list_replace(struct list *l, int pos, const char *data, int value);
|
2018-10-07 21:21:00 +00:00
|
|
|
int list_free(struct list *l);
|
2018-10-18 21:33:11 +00:00
|
|
|
int list_get_value(const struct list *l, const char *data);
|
2018-10-08 20:44:22 +00:00
|
|
|
int list_shuffle(struct list *l);
|
2018-10-17 22:12:00 +00:00
|
|
|
int list_sort_by_value(struct list *l, bool order);
|
2018-10-08 20:44:22 +00:00
|
|
|
int list_swap_item(struct node *n1, struct node *n2);
|
|
|
|
struct node *list_node_at(const struct list * l, unsigned index);
|
2019-01-05 00:01:34 +00:00
|
|
|
#endif
|