8000 Improved variable names [skip ci] · postgrespro/pgvector@4ac86f6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4ac86f6

Browse files
committed
Improved variable names [skip ci]
1 parent 648dd8a commit 4ac86f6

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/hnsw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ void HnswUpdateNeighborsOnDisk(Relation index, FmgrInfo *procinfo, Oid collatio
393393
void HnswLoadElementFromTuple(HnswElement element, HnswElementTuple etup, bool loadHeaptids, bool loadVec);
394394
void HnswLoadElement(HnswElement element, double *distance, Datum *q, Relation index, FmgrInfo *procinfo, Oid collation, bool loadVec, double *maxDistance);
395395
void HnswSetElementTuple(char *base, HnswElementTuple etup, HnswElement element);
396-
void HnswUpdateConnection(char *base, HnswElement element, HnswCandidate * hc, HnswNeighborArray * currentNeighbors, int lm, int *updateIdx, Relation index, FmgrInfo *procinfo, Oid collation);
396+
void HnswUpdateConnection(char *base, HnswElement element, HnswCandidate * hc, HnswNeighborArray * neighbors, int lm, int *updateIdx, Relation index, FmgrInfo *procinfo, Oid collation);
397397
bool HnswLoadNeighborTids(HnswElement element, ItemPointerData *indextids, Relation index, int m, int lm, int lc);
398398
void HnswInitLockTranche(void);
399399
const HnswTypeInfo *HnswGetTypeInfo(Relation index);

src/hnswutils.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,17 +1104,17 @@ LoadElementsForInsert(HnswNeighborArray * neighbors, Datum q, HnswCandidate * *p
11041104
* Update connections
11051105
*/
11061106
void
1107-
HnswUpdateConnection(char *base, HnswElement element, HnswCandidate * hc, HnswNeighborArray * currentNeighbors, int lm, int *updateIdx, Relation index, FmgrInfo *procinfo, Oid collation)
1107+
HnswUpdateConnection(char *base, HnswElement element, HnswCandidate * hc, HnswNeighborArray * neighbors, int lm, int *updateIdx, Relation index, FmgrInfo *procinfo, Oid collation)
11081108
{
11091109
HnswElement hce = HnswPtrAccess(base, hc->element);
1110-
HnswCandidate hc2;
1110+
HnswCandidate newHc;
11111111

1112-
HnswPtrStore(base, hc2.element, element);
1113-
hc2.distance = hc->distance;
1112+
HnswPtrStore(base, newHc.element, element);
1113+
newHc.distance = hc->distance;
11141114

1115-
if (currentNeighbors->length < lm)
1115+
if (neighbors->length < lm)
11161116
{
1117-
currentNeighbors->items[currentNeighbors->length++] = hc2;
1117+
neighbors->items[neighbors->length++] = newHc;
11181118

11191119
/* Track update */
11201120
if (updateIdx != NULL)
@@ -1127,30 +1127,30 @@ HnswUpdateConnection(char *base, HnswElement element, HnswCandidate * hc, HnswNe
11271127

11281128
/* Load elements on insert */
11291129
if (index != NULL)
1130-
LoadElementsForInsert(currentNeighbors, HnswGetValue(base, hce), &pruned, index, procinfo, collation);
1130+
LoadElementsForInsert(neighbors, HnswGetValue(base, hce), &pruned, index, procinfo, collation);
11311131

11321132
if (pruned == NULL)
11331133
{
11341134
List *c = NIL;
11351135

11361136
/* Add candidates */
1137-
for (int i = 0; i < currentNeighbors->length; i++)
1138-
c = lappend(c, &currentNeighbors->items[i]);
1139-
c = lappend(c, &hc2);
1137+
for (int i = 0; i < neighbors->length; i++)
1138+
c = lappend(c, &neighbors->items[i]);
1139+
c = lappend(c, &newHc);
11401140

1141-
SelectNeighbors(base, c, lm, procinfo, collation, currentNeighbors, &hc2, &pruned, true);
1141+
SelectNeighbors(base, c, lm, procinfo, collation, neighbors, &newHc, &pruned, true);
11421142

11431143
/* Should not happen */
11441144
if (pruned == NULL)
11451145
return;
11461146
}
11471147

11481148
/* Find and replace the pruned element */
1149-
for (int i = 0; i < currentNeighbors->length; i++)
1149+
for (int i = 0; i < neighbors->length; i++)
11501150
{
1151-
if (HnswPtrEqual(base, currentNeighbors->items[i].element, pruned->element))
1151+
if (HnswPtrEqual(base, neighbors->items[i].element, pruned->element))
11521152
{
1153-
currentNeighbors->items[i] = hc2;
1153+
neighbors->items[i] = newHc;
11541154

11551155
/* Track update */
11561156
if (updateIdx != NULL)

0 commit comments

Comments
 (0)
0