Skip to content

Commit 5fed1a2

Browse files
committed
don't use "index" as a variable name, it's a C library function
the compilers aren't smart enough to notice this and complain.
1 parent 782d1a5 commit 5fed1a2

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/modules/rlm_python/rlm_python.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -520,17 +520,17 @@ static int py_freeradius_state_init(PyObject *self, UNUSED PyObject *args, UNUSE
520520
*/
521521
static PyObject *py_freeradius_attribute_instance(PyObject *self, PyObject *attr)
522522
{
523-
long index;
523+
long idx;
524524
py_freeradius_pair_t *pair, *init_pair = (py_freeradius_pair_t *)self;
525525

526526
if (!PyLong_CheckExact(attr)) Py_RETURN_NONE;
527-
index = PyLong_AsLong(attr);
527+
idx = PyLong_AsLong(attr);
528528

529-
if (index < 0) {
529+
if (idx < 0) {
530530
PyErr_SetString(PyExc_AttributeError, "Cannot use negative attribute instance values");
531531
return NULL;
532532
}
533-
if (index == 0) return self;
533+
if (idx == 0) return self;
534534

535535
if (fr_type_is_leaf(init_pair->da->type)) {
536536
pair = PyObject_New(py_freeradius_pair_t, (PyTypeObject *)&py_freeradius_value_pair_def);
@@ -548,8 +548,8 @@ static PyObject *py_freeradius_attribute_instance(PyObject *self, PyObject *attr
548548
pair->parent = init_pair->parent;
549549
Py_INCREF(init_pair->parent);
550550
pair->da = init_pair->da;
551-
pair->idx = index;
552-
if (init_pair->vp) pair->vp = fr_pair_find_by_da_idx(fr_pair_parent_list(init_pair->vp), pair->da, (unsigned int)index);
551+
pair->idx = idx;
552+
if (init_pair->vp) pair->vp = fr_pair_find_by_da_idx(fr_pair_parent_list(init_pair->vp), pair->da, (unsigned int)idx);
553553
return (PyObject *)pair;
554554
}
555555

@@ -729,10 +729,10 @@ static int py_freeradius_pair_map_set(PyObject* self, PyObject* attr, PyObject*
729729
* Look for instance n, creating if necessary
730730
*/
731731
} else if (PyLong_CheckExact(attr)) {
732-
long index = PyLong_AsLong(attr);
732+
long idx = PyLong_AsLong(attr);
733733
py_freeradius_pair_t *parent = (py_freeradius_pair_t *)our_self->parent;
734734

735-
if (index < 0) {
735+
if (idx < 0) {
736736
PyErr_SetString(PyExc_AttributeError, "Cannot use negative attribute instance values");
737737
return -1;
738738
}
@@ -745,7 +745,7 @@ static int py_freeradius_pair_map_set(PyObject* self, PyObject* attr, PyObject*
745745

746746
list = &parent->vp->vp_group;
747747

748-
if (index == 0) {
748+
if (idx == 0) {
749749
if (!our_self->vp) {
750750
if (fr_pair_append_by_da(fr_pair_list_parent(list), &our_self->vp, list, our_self->da) < 0) {
751751
PyErr_Format(PyExc_MemoryError, "Failed to add attribute %s", our_self->da->name);
@@ -757,12 +757,12 @@ static int py_freeradius_pair_map_set(PyObject* self, PyObject* attr, PyObject*
757757
vp = our_self->vp;
758758
if (del) goto del;
759759
} else {
760-
vp = fr_pair_find_by_da_idx(list, our_self->da, index);
760+
vp = fr_pair_find_by_da_idx(list, our_self->da, idx);
761761
if (del) goto del;
762762
if (!vp) {
763763
unsigned int count = fr_pair_count_by_da(list, our_self->da);
764-
if (count < index) {
765-
PyErr_Format(PyExc_AttributeError, "Attempt to set instance %ld when only %d exist", index, count);
764+
if (count < idx) {
765+
PyErr_Format(PyExc_AttributeError, "Attempt to set instance %ld when only %d exist", idx, count);
766766
return -1;
767767
}
768768
if (fr_pair_append_by_da(fr_pair_list_parent(list), &vp, list, our_self->da) < 0) {

0 commit comments

Comments
 (0)