File: list.h

package info (click to toggle)
hx 0.7.14-7
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 564 kB
  • ctags: 834
  • sloc: ansic: 7,901; sh: 152; makefile: 81
file content (25 lines) | stat: -rw-r--r-- 451 bytes parent folder | download | duplicates (3)
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
#ifndef _LIST_H
#define _LIST_H

#define LISTADD(_list_type, _list, _ptr) \
{ if (!_list)\
	_list = _ptr;\
else {\
	register _list_type _p;\
	for (_p = _list; _p->next; _p = _p->next);\
	_p->next = _ptr;\
} }

#define LISTREM(_list_type, _list, _ptr) \
{ if (_list == _ptr)\
	_list = _ptr->next;\
else {\
	register _list_type _p;\
	for (_p = _list; _p; _p = _p->next)\
		if (_p->next == _ptr) {\
			_p->next = _ptr->next;\
			break;\
		}\
} }

#endif