~ubuntu-branches/ubuntu/raring/mdadm/raring

« back to all changes in this revision

Viewing changes to dlink.h

  • Committer: Package Import Robot
  • Author(s): Fabio M. Di Nitto
  • Date: 2004-10-01 06:23:38 UTC
  • Revision ID: package-import@ubuntu.com-20041001062338-qbvwn77thdz9fbwi
Tags: upstream-1.5.0
ImportĀ upstreamĀ versionĀ 1.5.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/* doubley linked lists */
 
3
/* This is free software. No strings attached. No copyright claimed */
 
4
 
 
5
struct __dl_head
 
6
{
 
7
    struct __dl_head *  dh_prev;
 
8
    struct __dl_head *  dh_next;
 
9
};
 
10
 
 
11
#define dl_alloc(size)  ((void*)(((char*)calloc(1,(size)+sizeof(struct __dl_head)))+sizeof(struct __dl_head)))
 
12
#define dl_new(t)       ((t*)dl_alloc(sizeof(t)))
 
13
#define dl_newv(t,n)    ((t*)dl_alloc(sizeof(t)*n))
 
14
 
 
15
#define dl_next(p) *((void**)&(((struct __dl_head*)(p))[-1].dh_next))
 
16
#define dl_prev(p) *((void**)&(((struct __dl_head*)(p))[-1].dh_prev))
 
17
 
 
18
void *dl_head(void);
 
19
char *dl_strdup(char *);
 
20
char *dl_strndup(char *, int);
 
21
void dl_insert(void*, void*);
 
22
void dl_add(void*, void*);
 
23
void dl_del(void*);
 
24
void dl_free(void*);
 
25
void dl_init(void*);