1,5 → 1,5 |
/* |
* Copyright (c) 2008 Lukas Mejdrech |
* Copyright (c) 2009 Lukas Mejdrech |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
79,7 → 79,7 |
if( ! name##_is_valid( map )) return EINVAL; \ |
index = name##_items_add( & map->values, value ); \ |
if( index < 0 ) return index; \ |
if( ERROR_OCCURED( char_map_add( & map->names, name, length, index ))){ \ |
if( ERROR_OCCURRED( char_map_add( & map->names, name, length, index ))){ \ |
name##_items_exclude_index( & map->values, index ); \ |
return ERROR_CODE; \ |
} \ |
121,9 → 121,14 |
} \ |
\ |
int name##_initialize( name##_ref map ){ \ |
ERROR_DECLARE; \ |
\ |
if( ! map ) return EINVAL; \ |
char_map_initialize( & map->names ); \ |
name##_items_initialize( & map->values ); \ |
ERROR_PROPAGATE( char_map_initialize( & map->names )); \ |
if( ERROR_OCCURRED( name##_items_initialize( & map->values ))){ \ |
char_map_destroy( & map->names ); \ |
return ERROR_CODE; \ |
} \ |
map->magic = GENERIC_CHAR_MAP_MAGIC_VALUE; \ |
return EOK; \ |
} \ |