2 /* doubly linked lists */
3 /* This is free software. No strings attached. No copyright claimed */
9 char *strncpy(char *dest
, const char *src
, size_t n
) __THROW
;
25 struct __dl_head
*vv
= v
;
35 void dl_insert(void *head
, void *val
)
37 dl_next(val
) = dl_next(head
);
39 dl_next(dl_prev(val
)) = val
;
40 dl_prev(dl_next(val
)) = val
;
43 void dl_add(void *head
, void *val
)
45 dl_prev(val
) = dl_prev(head
);
47 dl_next(dl_prev(val
)) = val
;
48 dl_prev(dl_next(val
)) = val
;
51 void dl_del(void *val
)
53 if (dl_prev(val
) == 0 || dl_next(val
) == 0)
55 dl_prev(dl_next(val
)) = dl_prev(val
);
56 dl_next(dl_prev(val
)) = dl_next(val
);
57 dl_prev(val
) = dl_next(val
) = 0;
60 char *dl_strndup(char *s
, int l
)
65 n
= dl_newv(char, l
+1);
76 char *dl_strdup(char *s
)
78 return dl_strndup(s
, (int)strlen(s
));