Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
0ef5910d
Commit
0ef5910d
authored
15 years ago
by
Bruce Momjian
Browse files
Options
Downloads
Patches
Plain Diff
Rename EnumValuesCreate() single-letter variable names to useful
variable names.
parent
c44327af
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/catalog/pg_enum.c
+11
-11
11 additions, 11 deletions
src/backend/catalog/pg_enum.c
with
11 additions
and
11 deletions
src/backend/catalog/pg_enum.c
+
11
−
11
View file @
0ef5910d
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/pg_enum.c,v 1.1
0
2009/12/
19 00:4
7:5
7
momjian Exp $
* $PostgreSQL: pgsql/src/backend/catalog/pg_enum.c,v 1.1
1
2009/12/
24 22:1
7:5
8
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -39,14 +39,14 @@ EnumValuesCreate(Oid enumTypeOid, List *vals)
...
@@ -39,14 +39,14 @@ EnumValuesCreate(Oid enumTypeOid, List *vals)
TupleDesc
tupDesc
;
TupleDesc
tupDesc
;
NameData
enumlabel
;
NameData
enumlabel
;
Oid
*
oids
;
Oid
*
oids
;
int
i
,
int
elemno
,
n
;
n
um_elems
;
Datum
values
[
Natts_pg_enum
];
Datum
values
[
Natts_pg_enum
];
bool
nulls
[
Natts_pg_enum
];
bool
nulls
[
Natts_pg_enum
];
ListCell
*
lc
;
ListCell
*
lc
;
HeapTuple
tup
;
HeapTuple
tup
;
n
=
list_length
(
vals
);
n
um_elems
=
list_length
(
vals
);
/*
/*
* XXX we do not bother to check the list of values for duplicates --- if
* XXX we do not bother to check the list of values for duplicates --- if
...
@@ -64,23 +64,23 @@ EnumValuesCreate(Oid enumTypeOid, List *vals)
...
@@ -64,23 +64,23 @@ EnumValuesCreate(Oid enumTypeOid, List *vals)
* counter wraps all the way around before we finish. Which seems
* counter wraps all the way around before we finish. Which seems
* unlikely.
* unlikely.
*/
*/
oids
=
(
Oid
*
)
palloc
(
n
*
sizeof
(
Oid
));
oids
=
(
Oid
*
)
palloc
(
n
um_elems
*
sizeof
(
Oid
));
for
(
i
=
0
;
i
<
n
;
i
++
)
for
(
elemno
=
0
;
elemno
<
num_elems
;
elemno
++
)
{
{
/*
/*
* The pg_enum.oid is stored in user tables. This oid must be
* The pg_enum.oid is stored in user tables. This oid must be
* preserved by binary upgrades.
* preserved by binary upgrades.
*/
*/
oids
[
i
]
=
GetNewOid
(
pg_enum
);
oids
[
elemno
]
=
GetNewOid
(
pg_enum
);
}
}
/* sort them, just in case counter wrapped from high to low */
/* sort them, just in case counter wrapped from high to low */
qsort
(
oids
,
n
,
sizeof
(
Oid
),
oid_cmp
);
qsort
(
oids
,
n
um_elems
,
sizeof
(
Oid
),
oid_cmp
);
/* and make the entries */
/* and make the entries */
memset
(
nulls
,
false
,
sizeof
(
nulls
));
memset
(
nulls
,
false
,
sizeof
(
nulls
));
i
=
0
;
elemno
=
0
;
foreach
(
lc
,
vals
)
foreach
(
lc
,
vals
)
{
{
char
*
lab
=
strVal
(
lfirst
(
lc
));
char
*
lab
=
strVal
(
lfirst
(
lc
));
...
@@ -101,13 +101,13 @@ EnumValuesCreate(Oid enumTypeOid, List *vals)
...
@@ -101,13 +101,13 @@ EnumValuesCreate(Oid enumTypeOid, List *vals)
values
[
Anum_pg_enum_enumlabel
-
1
]
=
NameGetDatum
(
&
enumlabel
);
values
[
Anum_pg_enum_enumlabel
-
1
]
=
NameGetDatum
(
&
enumlabel
);
tup
=
heap_form_tuple
(
tupDesc
,
values
,
nulls
);
tup
=
heap_form_tuple
(
tupDesc
,
values
,
nulls
);
HeapTupleSetOid
(
tup
,
oids
[
i
]);
HeapTupleSetOid
(
tup
,
oids
[
elemno
]);
simple_heap_insert
(
pg_enum
,
tup
);
simple_heap_insert
(
pg_enum
,
tup
);
CatalogUpdateIndexes
(
pg_enum
,
tup
);
CatalogUpdateIndexes
(
pg_enum
,
tup
);
heap_freetuple
(
tup
);
heap_freetuple
(
tup
);
i
++
;
elemno
++
;
}
}
/* clean up */
/* clean up */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment