Rework PH7_ClassExtractAttribute() function. Now it returns a pointer to valid attribute.
The build was successful.
Details
The build was successful.
Details
This commit is contained in:
parent
8847d645c0
commit
c206011c95
16
engine/oop.c
16
engine/oop.c
|
@ -165,14 +165,18 @@ PH7_PRIVATE ph7_class_method *PH7_ClassExtractMethod(ph7_class *pClass, const ch
|
||||||
*/
|
*/
|
||||||
PH7_PRIVATE ph7_class_attr *PH7_ClassExtractAttribute(ph7_class *pClass, const char *zName, sxu32 nByte) {
|
PH7_PRIVATE ph7_class_attr *PH7_ClassExtractAttribute(ph7_class *pClass, const char *zName, sxu32 nByte) {
|
||||||
SyHashEntry *pEntry;
|
SyHashEntry *pEntry;
|
||||||
|
ph7_class_attr *pAttr;
|
||||||
/* Perform a hash lookup */
|
/* Perform a hash lookup */
|
||||||
pEntry = SyHashGet(&pClass->hAttr, (const void *)zName, nByte);
|
SyHashResetLoopCursor(&pClass->hAttr);
|
||||||
if(pEntry == 0) {
|
while((pEntry = SyHashGetNextEntry(&pClass->hAttr)) != 0) {
|
||||||
/* No such entry */
|
/* Point to the desired method */
|
||||||
return 0;
|
pAttr = (ph7_class_attr *)pEntry->pUserData;
|
||||||
|
if(pAttr->pClass == pClass && SyStrncmp(pAttr->sName.zString, zName, nByte) == 0) {
|
||||||
|
return pAttr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* Point to the desired method */
|
/* No such entry */
|
||||||
return (ph7_class_attr *)pEntry->pUserData;
|
return 0;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Install a class attribute in the corresponding container.
|
* Install a class attribute in the corresponding container.
|
||||||
|
|
Loading…
Reference in New Issue