- Timestamp:
- Jun 22, 2003, 1:45:23 PM (21 years ago)
- Branches:
- master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- e4eebe8
- Parents:
- e187445
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
list.c
rd09e5a1 r53f421b 8 8 #define GROWBY 1.5 9 9 10 int owl_list_create(owl_list *l) { 10 int owl_list_create(owl_list *l) 11 { 11 12 l->size=0; 12 13 l->list=(void **)owl_malloc(INITSIZE*sizeof(void *)); … … 16 17 } 17 18 18 int owl_list_get_size(owl_list *l) { 19 int owl_list_get_size(owl_list *l) 20 { 19 21 return(l->size); 20 22 } 21 23 22 void *owl_list_get_element(owl_list *l, int n) { 24 void *owl_list_get_element(owl_list *l, int n) 25 { 23 26 if (n>l->size-1) return(NULL); 24 27 return(l->list[n]); 25 28 } 26 29 27 int owl_list_append_element(owl_list *l, void *element) { 30 int owl_list_append_element(owl_list *l, void *element) 31 { 28 32 void *ptr; 29 33 … … 40 44 } 41 45 42 int owl_list_prepend_element(owl_list *l, void *element) { 46 int owl_list_prepend_element(owl_list *l, void *element) 47 { 43 48 void *ptr; 44 49 int i; … … 59 64 } 60 65 61 int owl_list_remove_element(owl_list *l, int n) { 66 int owl_list_remove_element(owl_list *l, int n) 67 { 62 68 int i; 63 69 … … 71 77 72 78 /* todo: might leak memory */ 73 int owl_list_replace_element(owl_list *l, int n, void *element) { 79 int owl_list_replace_element(owl_list *l, int n, void *element) 80 { 74 81 if (n>l->size-1) return(-1); 75 82 … … 78 85 } 79 86 80 void owl_list_free_all(owl_list *l, void (*elefree)(void *)) { 87 void owl_list_free_all(owl_list *l, void (*elefree)(void *)) 88 { 81 89 int i; 82 90 … … 87 95 } 88 96 89 void owl_list_free_simple(owl_list *l) { 97 void owl_list_free_simple(owl_list *l) 98 { 90 99 if (l->list) owl_free(l->list); 91 100 }
Note: See TracChangeset
for help on using the changeset viewer.