Fossil SCM
Simplify usage of the new TH1 Find structure.
Commit
b0eb21b66a270c913e8803c68563ee4d524325a6
Parent
9b3b1d0714b1bd0…
1 file changed
+3
-4
M
src/th.c
+3
-4
| --- src/th.c | ||
| +++ src/th.c | ||
| @@ -1053,13 +1053,12 @@ | ||
| 1053 | 1053 | } |
| 1054 | 1054 | |
| 1055 | 1055 | /* |
| 1056 | 1056 | ** The Find structure is used to return extra information to callers of the |
| 1057 | 1057 | ** thFindValue function. The fields within it are populated by thFindValue |
| 1058 | -** as soon as the necessary information is available. Callers should zero | |
| 1059 | -** out the structure prior to calling thFindValue and then check each field | |
| 1060 | -** of interest upon return. | |
| 1058 | +** as soon as the necessary information is available. Callers should check | |
| 1059 | +** each field of interest upon return. | |
| 1061 | 1060 | */ |
| 1062 | 1061 | |
| 1063 | 1062 | struct Find { |
| 1064 | 1063 | Th_HashEntry *pValueEntry; /* Pointer to the scalar or array hash entry */ |
| 1065 | 1064 | Th_HashEntry *pElemEntry; /* Pointer to the element hash entry, if any */ |
| @@ -1101,10 +1100,11 @@ | ||
| 1101 | 1100 | Th_Frame *pFrame = interp->pFrame; |
| 1102 | 1101 | Th_Variable *pValue; |
| 1103 | 1102 | |
| 1104 | 1103 | thAnalyseVarname(zVar, nVar, &zOuter, &nOuter, &zInner, &nInner, &isGlobal); |
| 1105 | 1104 | if( pFind ){ |
| 1105 | + memset(pFind, 0, sizeof(Find)); | |
| 1106 | 1106 | pFind->zElem = zInner; |
| 1107 | 1107 | pFind->nElem = nInner; |
| 1108 | 1108 | } |
| 1109 | 1109 | if( isGlobal ){ |
| 1110 | 1110 | while( pFrame->pCaller ) pFrame = pFrame->pCaller; |
| @@ -1288,11 +1288,10 @@ | ||
| 1288 | 1288 | Find find; |
| 1289 | 1289 | Th_Variable *pValue; |
| 1290 | 1290 | Th_HashEntry *pEntry; |
| 1291 | 1291 | int rc = TH_ERROR; |
| 1292 | 1292 | |
| 1293 | - memset(&find, 0, sizeof(Find)); | |
| 1294 | 1293 | pValue = thFindValue(interp, zVar, nVar, 0, 1, 0, &find); |
| 1295 | 1294 | if( !pValue ){ |
| 1296 | 1295 | return rc; |
| 1297 | 1296 | } |
| 1298 | 1297 | |
| 1299 | 1298 |
| --- src/th.c | |
| +++ src/th.c | |
| @@ -1053,13 +1053,12 @@ | |
| 1053 | } |
| 1054 | |
| 1055 | /* |
| 1056 | ** The Find structure is used to return extra information to callers of the |
| 1057 | ** thFindValue function. The fields within it are populated by thFindValue |
| 1058 | ** as soon as the necessary information is available. Callers should zero |
| 1059 | ** out the structure prior to calling thFindValue and then check each field |
| 1060 | ** of interest upon return. |
| 1061 | */ |
| 1062 | |
| 1063 | struct Find { |
| 1064 | Th_HashEntry *pValueEntry; /* Pointer to the scalar or array hash entry */ |
| 1065 | Th_HashEntry *pElemEntry; /* Pointer to the element hash entry, if any */ |
| @@ -1101,10 +1100,11 @@ | |
| 1101 | Th_Frame *pFrame = interp->pFrame; |
| 1102 | Th_Variable *pValue; |
| 1103 | |
| 1104 | thAnalyseVarname(zVar, nVar, &zOuter, &nOuter, &zInner, &nInner, &isGlobal); |
| 1105 | if( pFind ){ |
| 1106 | pFind->zElem = zInner; |
| 1107 | pFind->nElem = nInner; |
| 1108 | } |
| 1109 | if( isGlobal ){ |
| 1110 | while( pFrame->pCaller ) pFrame = pFrame->pCaller; |
| @@ -1288,11 +1288,10 @@ | |
| 1288 | Find find; |
| 1289 | Th_Variable *pValue; |
| 1290 | Th_HashEntry *pEntry; |
| 1291 | int rc = TH_ERROR; |
| 1292 | |
| 1293 | memset(&find, 0, sizeof(Find)); |
| 1294 | pValue = thFindValue(interp, zVar, nVar, 0, 1, 0, &find); |
| 1295 | if( !pValue ){ |
| 1296 | return rc; |
| 1297 | } |
| 1298 | |
| 1299 |
| --- src/th.c | |
| +++ src/th.c | |
| @@ -1053,13 +1053,12 @@ | |
| 1053 | } |
| 1054 | |
| 1055 | /* |
| 1056 | ** The Find structure is used to return extra information to callers of the |
| 1057 | ** thFindValue function. The fields within it are populated by thFindValue |
| 1058 | ** as soon as the necessary information is available. Callers should check |
| 1059 | ** each field of interest upon return. |
| 1060 | */ |
| 1061 | |
| 1062 | struct Find { |
| 1063 | Th_HashEntry *pValueEntry; /* Pointer to the scalar or array hash entry */ |
| 1064 | Th_HashEntry *pElemEntry; /* Pointer to the element hash entry, if any */ |
| @@ -1101,10 +1100,11 @@ | |
| 1100 | Th_Frame *pFrame = interp->pFrame; |
| 1101 | Th_Variable *pValue; |
| 1102 | |
| 1103 | thAnalyseVarname(zVar, nVar, &zOuter, &nOuter, &zInner, &nInner, &isGlobal); |
| 1104 | if( pFind ){ |
| 1105 | memset(pFind, 0, sizeof(Find)); |
| 1106 | pFind->zElem = zInner; |
| 1107 | pFind->nElem = nInner; |
| 1108 | } |
| 1109 | if( isGlobal ){ |
| 1110 | while( pFrame->pCaller ) pFrame = pFrame->pCaller; |
| @@ -1288,11 +1288,10 @@ | |
| 1288 | Find find; |
| 1289 | Th_Variable *pValue; |
| 1290 | Th_HashEntry *pEntry; |
| 1291 | int rc = TH_ERROR; |
| 1292 | |
| 1293 | pValue = thFindValue(interp, zVar, nVar, 0, 1, 0, &find); |
| 1294 | if( !pValue ){ |
| 1295 | return rc; |
| 1296 | } |
| 1297 | |
| 1298 |