Fixed bug in hash table copy.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@924 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
4e2fb1a6df
commit
9a2dbc637a
1 changed files with 5 additions and 2 deletions
|
|
@ -427,6 +427,8 @@ static DOH *
|
||||||
CopyHash(DOH *ho) {
|
CopyHash(DOH *ho) {
|
||||||
Hash *h, *nh;
|
Hash *h, *nh;
|
||||||
HashNode *n;
|
HashNode *n;
|
||||||
|
DOH *nho;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
h = (Hash *) ObjData(ho);
|
h = (Hash *) ObjData(ho);
|
||||||
nh = (Hash *) DohMalloc(sizeof(Hash));
|
nh = (Hash *) DohMalloc(sizeof(Hash));
|
||||||
|
|
@ -442,15 +444,16 @@ CopyHash(DOH *ho) {
|
||||||
nh->file = h->file;
|
nh->file = h->file;
|
||||||
if (nh->file) Incref(nh->file);
|
if (nh->file) Incref(nh->file);
|
||||||
|
|
||||||
|
nho = DohObjMalloc(DOHTYPE_HASH, nh);
|
||||||
for (i = 0; i < h->hashsize; i++) {
|
for (i = 0; i < h->hashsize; i++) {
|
||||||
if ((n = h->hashtable[i])) {
|
if ((n = h->hashtable[i])) {
|
||||||
while (n) {
|
while (n) {
|
||||||
Hash_setattr(nh, n->key, n->object);
|
Hash_setattr(nho, n->key, n->object);
|
||||||
n = n->next;
|
n = n->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return DohObjMalloc(DOHTYPE_HASH, nh);
|
return nho;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue