Skip to content

Commit 0ef5910

Browse files
committed
Rename EnumValuesCreate() single-letter variable names to useful
variable names.
1 parent c44327a commit 0ef5910

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/backend/catalog/pg_enum.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/catalog/pg_enum.c,v 1.10 2009/12/19 00:47:57 momjian Exp $
10+
* $PostgreSQL: pgsql/src/backend/catalog/pg_enum.c,v 1.11 2009/12/24 22:17:58 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -39,14 +39,14 @@ EnumValuesCreate(Oid enumTypeOid, List *vals)
3939
TupleDesc tupDesc;
4040
NameData enumlabel;
4141
Oid *oids;
42-
int i,
43-
n;
42+
int elemno,
43+
num_elems;
4444
Datum values[Natts_pg_enum];
4545
bool nulls[Natts_pg_enum];
4646
ListCell *lc;
4747
HeapTuple tup;
4848

49-
n = list_length(vals);
49+
num_elems = list_length(vals);
5050

5151
/*
5252
* XXX we do not bother to check the list of values for duplicates --- if
@@ -64,23 +64,23 @@ EnumValuesCreate(Oid enumTypeOid, List *vals)
6464
* counter wraps all the way around before we finish. Which seems
6565
* unlikely.
6666
*/
67-
oids = (Oid *) palloc(n * sizeof(Oid));
68-
for (i = 0; i < n; i++)
67+
oids = (Oid *) palloc(num_elems * sizeof(Oid));
68+
for (elemno = 0; elemno < num_elems; elemno++)
6969
{
7070
/*
7171
* The pg_enum.oid is stored in user tables. This oid must be
7272
* preserved by binary upgrades.
7373
*/
74-
oids[i] = GetNewOid(pg_enum);
74+
oids[elemno] = GetNewOid(pg_enum);
7575
}
7676

7777
/* sort them, just in case counter wrapped from high to low */
78-
qsort(oids, n, sizeof(Oid), oid_cmp);
78+
qsort(oids, num_elems, sizeof(Oid), oid_cmp);
7979

8080
/* and make the entries */
8181
memset(nulls, false, sizeof(nulls));
8282

83-
i = 0;
83+
elemno = 0;
8484
foreach(lc, vals)
8585
{
8686
char *lab = strVal(lfirst(lc));
@@ -101,13 +101,13 @@ EnumValuesCreate(Oid enumTypeOid, List *vals)
101101
values[Anum_pg_enum_enumlabel - 1] = NameGetDatum(&enumlabel);
102102

103103
tup = heap_form_tuple(tupDesc, values, nulls);
104-
HeapTupleSetOid(tup, oids[i]);
104+
HeapTupleSetOid(tup, oids[elemno]);
105105

106106
simple_heap_insert(pg_enum, tup);
107107
CatalogUpdateIndexes(pg_enum, tup);
108108
heap_freetuple(tup);
109109

110-
i++;
110+
elemno++;
111111
}
112112

113113
/* clean up */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy