Hello,
I'm new to PostgreSQL and git, but having read through the wiki entries such as
http://wiki.postgresql.org/wiki/Submitting_a_Patch, I think I have a patch
worthy of submission.
It's a readability improvement in src/backend/commands/comment.c
(CreateComments function), which changes the existing code from incrementing a
variable for use as the array index, to use explicit ``values'' instead.
This has the following benefits
1) The structure of ``values'' is now clear at first glance.
2) ``i'' is then only used for 1 reason; the for loop
The patch is based on "master", and all existing tests pass.
Regards
Richard
commit fd4f57d8e67d723c071bdc374ede58d453c854ca (master)
Author: Richard Hopkins <richhguard-monot...@yahoo.co.uk>
Date: Sun Jun 12 12:03:28 2011 +0100
CreateComment: use explicit indexing for ``values''
This improves readability, and clarifies the structure of ``values''. No
functionality has changed, and all existing tests pass.
diff --git a/src/backend/commands/comment.c b/src/backend/commands/comment.c
index d09bef0..20603dc 100644
--- a/src/backend/commands/comment.c
+++ b/src/backend/commands/comment.c
@@ -157,11 +157,10 @@ CreateComments(Oid oid, Oid classoid, int32 subid, char *comment)
nulls[i] = false;
replaces[i] = true;
}
- i = 0;
- values[i++] = ObjectIdGetDatum(oid);
- values[i++] = ObjectIdGetDatum(classoid);
- values[i++] = Int32GetDatum(subid);
- values[i++] = CStringGetTextDatum(comment);
+ values[0] = ObjectIdGetDatum(oid);
+ values[1] = ObjectIdGetDatum(classoid);
+ values[2] = Int32GetDatum(subid);
+ values[3] = CStringGetTextDatum(comment);
}
/* Use the index to search for a matching old tuple */
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers