From d8626dd40f82baf616134cfd179b894429fce501 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 7 Feb 2002 14:55:43 -0500 Subject: [svn-r4920] Purpose: Bug fix Description: Correct inefficient property copying when using derived property list classes. Platforms tested: FreeBSD 4.5 (sleipnir) --- src/H5P.c | 29 ++--------------------------- test/tgenprop.c | 2 +- 2 files changed, 3 insertions(+), 28 deletions(-) diff --git a/src/H5P.c b/src/H5P.c index 5706145..cca556e 100644 --- a/src/H5P.c +++ b/src/H5P.c @@ -4759,31 +4759,6 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, unsigned hashsize, if(par_class!=NULL) { if(H5P_access_class(par_class,H5P_MOD_INC_CLS)<0) HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, NULL,"Can't increment parent class ref count"); - - /* Copy parent class's properties into this new class */ - if(par_class->nprops>0) { - /* Walk through the hash table */ - for(u=0; uhashsize; u++) { - tmp=par_class->props[u]; - - /* Walk through the list of properties at each hash location */ - while(tmp!=NULL) { - /* Make a copy of the class's property */ - if((pcopy=H5P_dup_prop(tmp))==NULL) - HGOTO_ERROR (H5E_PLIST, H5E_CANTCOPY, NULL,"Can't copy property"); - - /* Insert the initialized property into the property list */ - if(H5P_add_prop(pclass->props,pclass->hashsize,pcopy)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINSERT, NULL,"Can't insert property into class"); - - /* Increment property count for class */ - pclass->nprops++; - - /* Go to next registered property in class */ - tmp=tmp->next; - } /* end while */ - } /* end for */ - } /* end if */ } /* end if */ /* Set return value */ @@ -4946,7 +4921,7 @@ static H5P_genplist_t *H5P_create(H5P_genclass_t *pclass) /* Walk through the list of properties at each hash location */ while(tmp!=NULL) { /* Check for property already existing in list */ - if(H5P_find_prop(plist->props,tclass->hashsize,tmp->name)==NULL) { + if(H5P_find_prop(plist->props,pclass->hashsize,tmp->name)==NULL) { /* Make a copy of the class's property */ if((pcopy=H5P_dup_prop(tmp))==NULL) HGOTO_ERROR (H5E_PLIST, H5E_CANTCOPY, NULL,"Can't copy property"); @@ -4973,7 +4948,7 @@ static H5P_genplist_t *H5P_create(H5P_genclass_t *pclass) } /* end if */ /* Insert the initialized property into the property list */ - if(H5P_add_prop(plist->props,tclass->hashsize,pcopy)<0) + if(H5P_add_prop(plist->props,pclass->hashsize,pcopy)<0) HGOTO_ERROR (H5E_PLIST, H5E_CANTINSERT, NULL,"Can't insert property into class"); /* Increment the number of properties in list */ diff --git a/test/tgenprop.c b/test/tgenprop.c index 71ab27a..4f97322 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -1307,7 +1307,7 @@ test_genprop_class_addprop(void) /* Check existence of an original property */ ret = H5Pexist(cid,H5D_CRT_DATA_PIPELINE_NAME); - VERIFY(ret, 1, "H5Pexist"); + VERIFY(ret, 0, "H5Pexist"); /* Insert first property into class (with no callbacks) */ ret = H5Pregister(cid,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); -- cgit v0.12