diff options
author | Marc G. Fournier <scrappy@hub.org> | 1998-12-14 05:19:16 +0000 |
---|---|---|
committer | Marc G. Fournier <scrappy@hub.org> | 1998-12-14 05:19:16 +0000 |
commit | 7c3b7d27446cbe7e4d1ccf6f51caf2d38f55916c (patch) | |
tree | 77cf346913929743b747b012d14780fb369d7041 /src/backend/commands/cluster.c | |
parent | f722af618a5d6cedb0e083397f6efcec2e07b0c8 (diff) | |
download | postgresql-7c3b7d27446cbe7e4d1ccf6f51caf2d38f55916c.tar.gz postgresql-7c3b7d27446cbe7e4d1ccf6f51caf2d38f55916c.zip |
Initial attempt to clean up the code...
Switch sprintf() to snprintf()
Remove any/all #if 0 -or- #ifdef NOT_USED -or- #ifdef FALSE sections of
code
Diffstat (limited to 'src/backend/commands/cluster.c')
-rw-r--r-- | src/backend/commands/cluster.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c index c0be945d88a..9d9324e8ff5 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -14,7 +14,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.33 1998/11/27 19:51:54 vadim Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.34 1998/12/14 05:18:39 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -165,7 +165,7 @@ cluster(char *oldrelname, char *oldindexname) /* Create new index over the tuples of the new heap. */ copy_index(OIDOldIndex, OIDNewHeap); - sprintf(NewIndexName, "temp_%x", OIDOldIndex); + snprintf(NewIndexName, NAMEDATALEN, "temp_%x", OIDOldIndex); /* * make this really happen. Flush all the buffers. (Believe me, it is @@ -207,7 +207,7 @@ copy_heap(Oid OIDOldHeap) * Create a new heap relation with a temporary name, which has the * same tuple description as the old one. */ - sprintf(NewName, "temp_%x", OIDOldHeap); + snprintf(NewName, NAMEDATALEN, "temp_%x", OIDOldHeap); OldHeap = heap_open(OIDOldHeap); OldHeapDesc = RelationGetDescr(OldHeap); @@ -235,17 +235,17 @@ copy_heap(Oid OIDOldHeap) static void copy_index(Oid OIDOldIndex, Oid OIDNewHeap) { - Relation OldIndex, - NewHeap; - HeapTuple Old_pg_index_Tuple, - Old_pg_index_relation_Tuple, - pg_proc_Tuple; + Relation OldIndex, + NewHeap; + HeapTuple Old_pg_index_Tuple, + Old_pg_index_relation_Tuple, + pg_proc_Tuple; Form_pg_index Old_pg_index_Form; Form_pg_class Old_pg_index_relation_Form; - Form_pg_proc pg_proc_Form; - char *NewIndexName; - AttrNumber *attnumP; - int natts; + Form_pg_proc pg_proc_Form; + char *NewIndexName; + AttrNumber *attnumP; + int natts; FuncIndexInfo *finfo; NewHeap = heap_open(OIDNewHeap); @@ -273,8 +273,9 @@ copy_index(Oid OIDOldIndex, Oid OIDNewHeap) Old_pg_index_relation_Form = (Form_pg_class) GETSTRUCT(Old_pg_index_relation_Tuple); + /* Set the name. */ NewIndexName = palloc(NAMEDATALEN); /* XXX */ - sprintf(NewIndexName, "temp_%x", OIDOldIndex); /* Set the name. */ + snprintf(NewIndexName, NAMEDATALEN, "temp_%x", OIDOldIndex); /* * Ugly as it is, the only way I have of working out the number of |