diff options
Diffstat (limited to 'tools/h5repack/h5repack_opttable.c')
-rw-r--r-- | tools/h5repack/h5repack_opttable.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c index 4fd450d..bdcae02 100644 --- a/tools/h5repack/h5repack_opttable.c +++ b/tools/h5repack/h5repack_opttable.c @@ -33,7 +33,7 @@ extern char *progname; void init_packobject(pack_info_t *obj) { int j, k; - + strcpy(obj->path,"\0"); for ( j=0; j<H5_REPACK_MAX_NFILTERS; j++) { @@ -87,7 +87,7 @@ static void aux_tblinsert_layout(pack_opttbl_t *table, pack_info_t *pack) { int k; - + table->objs[I].layout = pack->layout; if (H5D_CHUNKED==pack->layout) { @@ -122,7 +122,7 @@ static void aux_tblinsert_layout(pack_opttbl_t *table, static int aux_inctable(pack_opttbl_t *table, int n_objs ) { unsigned int i; - + table->size += n_objs; table->objs = (pack_info_t*)realloc(table->objs, table->size * sizeof(pack_info_t)); if (table->objs==NULL) { @@ -154,7 +154,7 @@ int options_table_init( pack_opttbl_t **tbl ) error_msg(progname, "not enough memory for options table\n"); return -1; } - + table->size = 30; table->nelems = 0; table->objs = (pack_info_t*) malloc(table->size * sizeof(pack_info_t)); @@ -162,12 +162,12 @@ int options_table_init( pack_opttbl_t **tbl ) error_msg(progname, "not enough memory for options table\n"); return -1; } - + for ( i=0; i<table->size; i++) { init_packobject(&table->objs[i]); } - + *tbl = table; return 0; } @@ -207,14 +207,14 @@ int options_add_layout( obj_list_t *obj_list, { unsigned int i, I; int j, added=0, found=0; - + /* increase the size of the collection by N_OBJS if necessary */ if (table->nelems+n_objs >= table->size) { if (aux_inctable(table,n_objs)<0) return -1; } - + /* search if this object is already in the table; "path" is the key */ if (table->nelems>0) { @@ -242,7 +242,7 @@ int options_add_layout( obj_list_t *obj_list, } } /* if */ } /* i */ - + if (found==0) { /* keep the grow in a temp var */ @@ -266,7 +266,7 @@ int options_add_layout( obj_list_t *obj_list, } } /* j */ } - + /* first time insertion */ else { @@ -277,12 +277,12 @@ int options_add_layout( obj_list_t *obj_list, added++; strcpy(table->objs[I].path,obj_list[j].obj); aux_tblinsert_layout(table,I,pack); - + } } - + table->nelems+= added; - + return 0; } @@ -303,17 +303,17 @@ int options_add_filter(obj_list_t *obj_list, filter_info_t filt, pack_opttbl_t *table ) { - + unsigned int i, I; int j, added=0, found=0; - + /* increase the size of the collection by N_OBJS if necessary */ if (table->nelems+n_objs >= table->size) { if (aux_inctable(table,n_objs)<0) return -1; } - + /* search if this object is already in the table; "path" is the key */ if (table->nelems>0) { @@ -332,7 +332,7 @@ int options_add_filter(obj_list_t *obj_list, break; } /* if */ } /* i */ - + if (found==0) { /* keep the grow in a temp var */ @@ -356,7 +356,7 @@ int options_add_filter(obj_list_t *obj_list, } } /* j */ } - + /* first time insertion */ else { @@ -369,9 +369,9 @@ int options_add_filter(obj_list_t *obj_list, aux_tblinsert_filter(table,I,filt); } } - + table->nelems+= added; - + return 0; } @@ -389,7 +389,7 @@ pack_info_t* options_get_object( const char *path, pack_opttbl_t *table ) { unsigned int i; - + for ( i = 0; i < table->nelems; i++) { /* found it */ @@ -398,7 +398,7 @@ pack_info_t* options_get_object( const char *path, return (&table->objs[i]); } } - + return NULL; } |