Skip to content
This repository was archived by the owner on Jun 27, 2025. It is now read-only.

Commit 01c37d2

Browse files
committed
renamed methods to *_obj to isolate object-only implementations
1 parent f9a461e commit 01c37d2

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

automap.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ famv_new(FAMObject *fam, int kind)
700700

701701
// Given a key and a computed hash, return the table_pos if that hash and key are found, or if not, the first table position that has not been assigned. Return -1 on error.
702702
static Py_ssize_t
703-
lookup_hash(FAMObject *self, PyObject *key, Py_hash_t hash)
703+
lookup_hash_obj(FAMObject *self, PyObject *key, Py_hash_t hash)
704704
{
705705
TableElement *table = self->table;
706706
Py_ssize_t mask = self->table_size - 1;
@@ -1281,7 +1281,7 @@ lookup(FAMObject *self, PyObject *key) {
12811281
if (hash == -1) {
12821282
return -1;
12831283
}
1284-
table_pos = lookup_hash(self, key, hash);
1284+
table_pos = lookup_hash_obj(self, key, hash);
12851285
break;
12861286
}
12871287
}
@@ -1294,7 +1294,7 @@ lookup(FAMObject *self, PyObject *key) {
12941294

12951295
// Insert a key_pos, hash pair into the table. Assumes table already has appropriate size. When inserting a new itme, `hash` is -1, forcing a fresh hash to be computed here. Return 0 on success, -1 on error.
12961296
static int
1297-
insert(FAMObject *self, PyObject *key, Py_ssize_t keys_pos, Py_hash_t hash)
1297+
insert_obj(FAMObject *self, PyObject *key, Py_ssize_t keys_pos, Py_hash_t hash)
12981298
{
12991299
if (hash == -1) {
13001300
hash = PyObject_Hash(key);
@@ -1303,7 +1303,7 @@ insert(FAMObject *self, PyObject *key, Py_ssize_t keys_pos, Py_hash_t hash)
13031303
}
13041304
}
13051305
// table position is not dependent on keys_pos
1306-
Py_ssize_t table_pos = lookup_hash(self, key, hash);
1306+
Py_ssize_t table_pos = lookup_hash_obj(self, key, hash);
13071307

13081308
if (table_pos < 0) {
13091309
return -1;
@@ -1497,7 +1497,7 @@ grow_table(FAMObject *self, Py_ssize_t keys_size)
14971497
for (table_pos = 0; table_pos < size_old + SCAN - 1; table_pos++) {
14981498
i = table_old[table_pos].keys_pos;
14991499
h = table_old[table_pos].hash;
1500-
if ((h != -1) && insert(self, PyList_GET_ITEM(self->keys, i), i, h))
1500+
if ((h != -1) && insert_obj(self, PyList_GET_ITEM(self->keys, i), i, h))
15011501
{
15021502
goto restore;
15031503
}
@@ -1602,7 +1602,7 @@ extend(FAMObject *self, PyObject *keys)
16021602

16031603
for (Py_ssize_t index = 0; index < size_extend; index++) {
16041604
// get the new keys_size after each append
1605-
if (insert(self, keys_fi[index], PyList_GET_SIZE(self->keys), -1) ||
1605+
if (insert_obj(self, keys_fi[index], PyList_GET_SIZE(self->keys), -1) ||
16061606
PyList_Append(self->keys, keys_fi[index]))
16071607
{
16081608
Py_DECREF(keys);
@@ -1629,7 +1629,7 @@ append(FAMObject *self, PyObject *key)
16291629
return -1;
16301630
}
16311631
// keys_size is already incremented; provide last index
1632-
if (insert(self, key, self->keys_size - 1, -1) ||
1632+
if (insert_obj(self, key, self->keys_size - 1, -1) ||
16331633
PyList_Append(self->keys, key))
16341634
{
16351635
return -1;
@@ -1849,7 +1849,7 @@ fam_new(PyTypeObject *cls, PyObject *args, PyObject *kwargs)
18491849
}
18501850

18511851

1852-
// This macro can be used with integer and floating point NumPy types, given an `npy_type` and a specialized `insert_func`. Uses context of `fam_init` to get `fam`, `contiguous`, `a`, `keys_size`, and `i`. An optional `pre_insert` function can be supplied to transform extracted values before calling the insert function.
1852+
// This macro can be used with integer and floating point NumPy types, given an `npy_type` and a specialized `insert_func`. Uses context of `fam_init` to get `fam`, `contiguous`, `a`, `keys_size`, and `i`. An optional `pre_insert` function can be supplied to transform extracted values before calling the appropriate insert function.
18531853
# define INSERT_SCALARS(npy_type, insert_func, pre_insert) \
18541854
if (contiguous) { \
18551855
npy_type* b = (npy_type*)PyArray_DATA(a); \
@@ -2032,7 +2032,7 @@ fam_init(PyObject *self, PyObject *args, PyObject *kwargs)
20322032
}
20332033
else {
20342034
for (; i < keys_size; i++) {
2035-
if (insert(fam, PyList_GET_ITEM(keys, i), i, -1)) {
2035+
if (insert_obj(fam, PyList_GET_ITEM(keys, i), i, -1)) {
20362036
goto error;
20372037
}
20382038
}

0 commit comments

Comments
 (0)