Rev 3666 | Rev 3886 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3666 | Rev 3846 | ||
---|---|---|---|
Line 63... | Line 63... | ||
63 | name##_item_ref items; \ |
63 | name##_item_ref items; \ |
64 | int magic; \ |
64 | int magic; \ |
65 | }; \ |
65 | }; \ |
66 | \ |
66 | \ |
67 | int name##_add( name##_ref map, int key, type * value ); \ |
67 | int name##_add( name##_ref map, int key, type * value ); \ |
- | 68 | void name##_clear( name##_ref map ); \ |
|
68 | int name##_count( name##_ref map ); \ |
69 | int name##_count( name##_ref map ); \ |
69 | void name##_destroy( name##_ref map ); \ |
70 | void name##_destroy( name##_ref map ); \ |
70 | void name##_exclude( name##_ref map, int key ); \ |
71 | void name##_exclude( name##_ref map, int key ); \ |
71 | void name##_exclude_index( name##_ref map, int index ); \ |
72 | void name##_exclude_index( name##_ref map, int index ); \ |
72 | type * name##_find( name##_ref map, int key ); \ |
73 | type * name##_find( name##_ref map, int key ); \ |
Line 98... | Line 99... | ||
98 | return map->next - 1; \ |
99 | return map->next - 1; \ |
99 | } \ |
100 | } \ |
100 | return EINVAL; \ |
101 | return EINVAL; \ |
101 | } \ |
102 | } \ |
102 | \ |
103 | \ |
- | 104 | void name##_clear( name##_ref map ){ \ |
|
- | 105 | if( name##_is_valid( map )){ \ |
|
- | 106 | int index; \ |
|
- | 107 | \ |
|
- | 108 | /* map->magic = 0;*/ \ |
|
- | 109 | for( index = 0; index < map->next; ++ index ){ \ |
|
- | 110 | if( name##_item_is_valid( &( map->items[ index ] ))){ \ |
|
- | 111 | name##_item_destroy( &( map->items[ index ] )); \ |
|
- | 112 | } \ |
|
- | 113 | } \ |
|
- | 114 | map->next = 0; \ |
|
- | 115 | map->items[ map->next ].magic = 0; \ |
|
- | 116 | /* map->magic = INT_MAP_MAGIC_VALUE;*/ \ |
|
- | 117 | } \ |
|
- | 118 | } \ |
|
- | 119 | \ |
|
103 | int name##_count( name##_ref map ){ \ |
120 | int name##_count( name##_ref map ){ \ |
104 | return name##_is_valid( map ) ? map->next : -1; \ |
121 | return name##_is_valid( map ) ? map->next : -1; \ |
105 | } \ |
122 | } \ |
106 | \ |
123 | \ |
107 | void name##_destroy( name##_ref map ){ \ |
124 | void name##_destroy( name##_ref map ){ \ |