Skip to content

Commit b99c63c

Browse files
committed
Now that names are null terminated, no need to do all that NAMEDATALEN stuff.
1 parent 022903f commit b99c63c

File tree

26 files changed

+207
-220
lines changed

26 files changed

+207
-220
lines changed

src/backend/access/common/printtup.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.13 1997/01/10 20:16:22 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.14 1997/08/18 20:51:30 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -131,9 +131,8 @@ printatt(unsigned attributeId,
131131
AttributeTupleForm attributeP,
132132
char *value)
133133
{
134-
printf("\t%2d: %.*s%s%s%s\t(typeid = %u, len = %d, byval = %c)\n",
134+
printf("\t%2d: %s%s%s%s\t(typeid = %u, len = %d, byval = %c)\n",
135135
attributeId,
136-
NAMEDATALEN, /* attname is a char16 */
137136
attributeP->attname.data,
138137
value != NULL ? " = \"" : "",
139138
value != NULL ? value : "",

src/backend/access/common/tupdesc.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.12 1997/08/03 02:34:19 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.13 1997/08/18 20:51:31 momjian Exp $
1111
*
1212
* NOTES
1313
* some of the executor utility code such as "ExecTypeFromTL" should be
@@ -347,18 +347,11 @@ BuildDescForRelation(List *schema, char *relname)
347347
arry = entry->typename->arrayBounds;
348348
attisset = entry->typename->setof;
349349

350-
if (arry != NIL) {
351-
char buf[20];
352-
350+
strNcpy(typename, entry->typename->name,NAMEDATALEN-1);
351+
if (arry != NIL)
353352
attdim = length(arry);
354-
355-
/* array of XXX is _XXX (inherited from release 3) */
356-
sprintf(buf, "_%.*s", NAMEDATALEN, entry->typename->name);
357-
strcpy(typename, buf);
358-
} else {
359-
strcpy(typename, entry->typename->name);
353+
else
360354
attdim = 0;
361-
}
362355

363356
if (! TupleDescInitEntry(desc, attnum, attname,
364357
typename, attdim, attisset)) {
@@ -372,8 +365,8 @@ BuildDescForRelation(List *schema, char *relname)
372365
if (!strcmp(typename, relname)) {
373366
TupleDescMakeSelfReference(desc, attnum, relname);
374367
} else
375-
elog(WARN, "DefineRelation: no such type %.*s",
376-
NAMEDATALEN, typename);
368+
elog(WARN, "DefineRelation: no such type %s",
369+
typename);
377370
}
378371

379372
/*

src/backend/access/hash/hashpage.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.8 1997/08/12 22:51:37 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.9 1997/08/18 20:51:34 momjian Exp $
1111
*
1212
* NOTES
1313
* Postgres hash pages look like ordinary relation pages. The opaque
@@ -195,8 +195,8 @@ _hash_getbuf(Relation rel, BlockNumber blkno, int access)
195195
_hash_setpagelock(rel, blkno, access);
196196
break;
197197
default:
198-
elog(WARN, "_hash_getbuf: invalid access (%d) on new blk: %.*s",
199-
access, NAMEDATALEN, RelationGetRelationName(rel));
198+
elog(WARN, "_hash_getbuf: invalid access (%d) on new blk: %s",
199+
access, RelationGetRelationName(rel));
200200
break;
201201
}
202202
buf = ReadBuffer(rel, blkno);
@@ -221,8 +221,8 @@ _hash_relbuf(Relation rel, Buffer buf, int access)
221221
_hash_unsetpagelock(rel, blkno, access);
222222
break;
223223
default:
224-
elog(WARN, "_hash_relbuf: invalid access (%d) on blk %x: %.*s",
225-
access, blkno, NAMEDATALEN, RelationGetRelationName(rel));
224+
elog(WARN, "_hash_relbuf: invalid access (%d) on blk %x: %s",
225+
access, blkno, RelationGetRelationName(rel));
226226
}
227227

228228
ReleaseBuffer(buf);
@@ -279,8 +279,8 @@ _hash_chgbufaccess(Relation rel,
279279
_hash_relbuf(rel, *bufp, from_access);
280280
break;
281281
default:
282-
elog(WARN, "_hash_chgbufaccess: invalid access (%d) on blk %x: %.*s",
283-
from_access, blkno, NAMEDATALEN, RelationGetRelationName(rel));
282+
elog(WARN, "_hash_chgbufaccess: invalid access (%d) on blk %x: %s",
283+
from_access, blkno, RelationGetRelationName(rel));
284284
break;
285285
}
286286
*bufp = _hash_getbuf(rel, blkno, to_access);
@@ -325,8 +325,8 @@ _hash_setpagelock(Relation rel,
325325
RelationSetSingleRLockPage(rel, &iptr);
326326
break;
327327
default:
328-
elog(WARN, "_hash_setpagelock: invalid access (%d) on blk %x: %.*s",
329-
access, blkno, NAMEDATALEN, RelationGetRelationName(rel));
328+
elog(WARN, "_hash_setpagelock: invalid access (%d) on blk %x: %s",
329+
access, blkno, RelationGetRelationName(rel));
330330
break;
331331
}
332332
}
@@ -350,8 +350,8 @@ _hash_unsetpagelock(Relation rel,
350350
RelationUnsetSingleRLockPage(rel, &iptr);
351351
break;
352352
default:
353-
elog(WARN, "_hash_unsetpagelock: invalid access (%d) on blk %x: %.*s",
354-
access, blkno, NAMEDATALEN, RelationGetRelationName(rel));
353+
elog(WARN, "_hash_unsetpagelock: invalid access (%d) on blk %x: %s",
354+
access, blkno, RelationGetRelationName(rel));
355355
break;
356356
}
357357
}

src/backend/bootstrap/bootstrap.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.19 1997/08/12 22:52:04 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.20 1997/08/18 20:51:44 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -510,8 +510,8 @@ boot_openrel(char *relname)
510510

511511
if (DebugMode) {
512512
AttributeTupleForm at = attrtypes[i];
513-
printf("create attribute %d name %.*s len %d num %d type %d\n",
514-
i, NAMEDATALEN, at->attname.data, at->attlen, at->attnum,
513+
printf("create attribute %d name %s len %d num %d type %d\n",
514+
i, at->attname.data, at->attlen, at->attnum,
515515
at->atttypid
516516
);
517517
fflush(stdout);
@@ -572,16 +572,14 @@ DefineAttr(char *name, char *type, int attnum)
572572
if (Typ != (struct typmap **)NULL) {
573573
attrtypes[attnum]->atttypid = Ap->am_oid;
574574
namestrcpy(&attrtypes[attnum]->attname, name);
575-
if (!Quiet) printf("<%.*s %s> ", NAMEDATALEN,
576-
attrtypes[attnum]->attname.data, type);
575+
if (!Quiet) printf("<%s %s> ", attrtypes[attnum]->attname.data, type);
577576
attrtypes[attnum]->attnum = 1 + attnum; /* fillatt */
578577
attlen = attrtypes[attnum]->attlen = Ap->am_typ.typlen;
579578
attrtypes[attnum]->attbyval = Ap->am_typ.typbyval;
580579
} else {
581580
attrtypes[attnum]->atttypid = Procid[t].oid;
582581
namestrcpy(&attrtypes[attnum]->attname,name);
583-
if (!Quiet) printf("<%.*s %s> ", NAMEDATALEN,
584-
attrtypes[attnum]->attname.data, type);
582+
if (!Quiet) printf("<%s %s> ", attrtypes[attnum]->attname.data, type);
585583
attrtypes[attnum]->attnum = 1 + attnum; /* fillatt */
586584
attlen = attrtypes[attnum]->attlen = Procid[t].len;
587585
attrtypes[attnum]->attbyval = (attlen==1) || (attlen==2)||(attlen==4);
@@ -775,7 +773,7 @@ gettype(char *type)
775773
}
776774
}
777775
if (DebugMode)
778-
printf("bootstrap.c: External Type: %.*s\n", NAMEDATALEN, type);
776+
printf("bootstrap.c: External Type: %s\n", type);
779777
rdesc = heap_openr(TypeRelationName);
780778
sdesc = heap_beginscan(rdesc, 0, NowTimeQual, 0, (ScanKey)NULL);
781779
i = 0;

src/backend/catalog/catalog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.6 1997/01/10 20:16:34 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.7 1997/08/18 20:51:59 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -33,7 +33,7 @@ relpath(char relname[])
3333

3434
if (IsSharedSystemRelationName(relname)) {
3535
path = (char *) palloc(strlen(DataDir) + sizeof(NameData) + 2);
36-
sprintf(path, "%s/%.*s", DataDir, NAMEDATALEN, relname);
36+
sprintf(path, "%s/%s", DataDir, relname);
3737
return (path);
3838
}
3939
return(relname);

src/backend/catalog/pg_operator.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.10 1997/08/12 22:52:11 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.11 1997/08/18 20:52:04 momjian Exp $
1111
*
1212
* NOTES
1313
* these routines moved here from commands/define.c and somewhat cleaned up.
@@ -483,8 +483,8 @@ OperatorDef(char *operatorName,
483483
rightTypeName);
484484

485485
if (OidIsValid(operatorObjectId) && !definedOK)
486-
elog(WARN, "OperatorDef: operator \"%-.*s\" already defined",
487-
NAMEDATALEN, operatorName);
486+
elog(WARN, "OperatorDef: operator \"%s\" already defined",
487+
operatorName);
488488

489489
if (leftTypeName)
490490
leftTypeId = TypeGet(leftTypeName, &leftDefined);

src/backend/commands/cluster.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*
1616
* IDENTIFICATION
17-
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.11 1997/08/03 02:34:45 momjian Exp $
17+
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.12 1997/08/18 20:52:07 momjian Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -116,15 +116,15 @@ cluster(char oldrelname[], char oldindexname[])
116116

117117
OldHeap = heap_openr(oldrelname);
118118
if (!RelationIsValid(OldHeap)) {
119-
elog(WARN, "cluster: unknown relation: \"%-.*s\"",
120-
NAMEDATALEN, oldrelname);
119+
elog(WARN, "cluster: unknown relation: \"%s\"",
120+
oldrelname);
121121
}
122122
OIDOldHeap = OldHeap->rd_id; /* Get OID for the index scan */
123123

124124
OldIndex=index_openr(oldindexname);/* Open old index relation */
125125
if (!RelationIsValid(OldIndex)) {
126-
elog(WARN, "cluster: unknown index: \"%-.*s\"",
127-
NAMEDATALEN, oldindexname);
126+
elog(WARN, "cluster: unknown index: \"%s\"",
127+
oldindexname);
128128
}
129129
OIDOldIndex = OldIndex->rd_id; /* OID for the index scan */
130130

src/backend/commands/command.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.8 1997/08/12 22:52:18 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.9 1997/08/18 20:52:11 momjian Exp $
1111
*
1212
* NOTES
1313
* The PortalExecutorHeapMemory crap needs to be eliminated
@@ -117,8 +117,8 @@ PerformPortalFetch(char *name,
117117
*/
118118
portal = GetPortalByName(name);
119119
if (! PortalIsValid(portal)) {
120-
elog(NOTICE, "PerformPortalFetch: portal \"%-.*s\" not found",
121-
NAMEDATALEN, name);
120+
elog(NOTICE, "PerformPortalFetch: portal \"%s\" not found",
121+
name);
122122
return;
123123
}
124124

@@ -202,8 +202,8 @@ PerformPortalClose(char *name, CommandDest dest)
202202
*/
203203
portal = GetPortalByName(name);
204204
if (! PortalIsValid(portal)) {
205-
elog(NOTICE, "PerformPortalClose: portal \"%-.*s\" not found",
206-
NAMEDATALEN, name);
205+
elog(NOTICE, "PerformPortalClose: portal \"%s\" not found",
206+
name);
207207
return;
208208
}
209209

@@ -272,8 +272,8 @@ PerformAddAttribute(char *relationName,
272272
* normally, only the owner of a class can change its schema.
273273
*/
274274
if (IsSystemRelationName(relationName))
275-
elog(WARN, "PerformAddAttribute: class \"%-.*s\" is a system catalog",
276-
NAMEDATALEN, relationName);
275+
elog(WARN, "PerformAddAttribute: class \"%s\" is a system catalog",
276+
relationName);
277277
#ifndef NO_SECURITY
278278
if (!pg_ownercheck(userName, relationName, RELNAME))
279279
elog(WARN, "PerformAddAttribute: you do not own class \"%s\"",
@@ -296,8 +296,8 @@ PerformAddAttribute(char *relationName,
296296

297297
relrdesc = heap_openr(relationName);
298298
if (!RelationIsValid(relrdesc)) {
299-
elog(WARN, "PerformAddAttribute: unknown relation: \"%-.*s\"",
300-
NAMEDATALEN, relationName);
299+
elog(WARN, "PerformAddAttribute: unknown relation: \"%s\"",
300+
relationName);
301301
}
302302
myrelid = relrdesc->rd_id;
303303
heap_close(relrdesc);

src/backend/commands/creatinh.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.10 1997/08/12 22:52:20 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.11 1997/08/18 20:52:16 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -549,7 +549,7 @@ MakeArchiveName(Oid relationId)
549549
* of the relation they archive. Create a string containing
550550
* this name and find the reldesc for the archive relation.
551551
*/
552-
arch = palloc(NAMEDATALEN);
552+
arch = palloc(NAMEDATALEN);
553553
sprintf(arch, "a,%d",relationId);
554554

555555
return arch;

src/backend/commands/explain.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.9 1997/04/05 06:42:32 vadim Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.10 1997/08/18 20:52:17 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -177,7 +177,7 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
177177
case T_IndexScan:
178178
if (((Scan*)plan)->scanrelid > 0) {
179179
RangeTblEntry *rte = nth(((Scan*)plan)->scanrelid-1, es->rtable);
180-
sprintf(buf, " on %.*s", NAMEDATALEN, rte->refname);
180+
sprintf(buf, " on %s", rte->refname);
181181
appendStringInfo(str, buf);
182182
}
183183
break;

src/backend/commands/remove.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.9 1997/06/03 06:23:24 vadim Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.10 1997/08/18 20:52:17 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -393,8 +393,8 @@ RemoveFunction(char *functionName, /* function name to be removed */
393393
/* ok, function has been found */
394394

395395
if (the_proc->prolang == INTERNALlanguageId)
396-
elog(WARN, "RemoveFunction: function \"%-.*s\" is built-in",
397-
NAMEDATALEN, functionName);
396+
elog(WARN, "RemoveFunction: function \"%s\" is built-in",
397+
functionName);
398398

399399
ItemPointerCopy(&tup->t_ctid, &itemPointerData);
400400
heap_delete(relation, &itemPointerData);

0 commit comments

Comments
 (0)