Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit86ef36c

Browse files
committed
New NameStr macro to convert Name to Str. No need for var.data anymore.
Fewer calls to nameout.Better use of RelationGetRelationName.
1 parentdf723a8 commit86ef36c

File tree

65 files changed

+273
-266
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+273
-266
lines changed

‎src/backend/access/common/printtup.c

Lines changed: 2 additions & 2 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.49 1999/07/17 20:16:35 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.50 1999/11/07 23:07:46 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -245,7 +245,7 @@ printatt(unsigned attributeId,
245245
{
246246
printf("\t%2d: %s%s%s%s\t(typeid = %u, len = %d, typmod = %d, byval = %c)\n",
247247
attributeId,
248-
attributeP->attname.data,
248+
NameStr(attributeP->attname),
249249
value!=NULL ?" = \"" :"",
250250
value!=NULL ?value :"",
251251
value!=NULL ?"\"" :"",

‎src/backend/access/common/tupdesc.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/access/common/tupdesc.c,v 1.55 1999/10/03 23:55:25 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.56 1999/11/07 23:07:47 momjian Exp $
1111
*
1212
* NOTES
1313
* some of the executor utility code such as "ExecTypeFromTL" should be
@@ -278,7 +278,7 @@ TupleDescInitEntry(TupleDesc desc,
278278
if (attributeName!=NULL)
279279
namestrcpy(&(att->attname),attributeName);
280280
else
281-
MemSet(att->attname.data,0,NAMEDATALEN);
281+
MemSet(NameStr(att->attname),0,NAMEDATALEN);
282282

283283

284284
att->attdisbursion=0;/* dummy value */

‎src/backend/access/gist/gist.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.46 1999/09/24 00:23:42 tgl Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.47 1999/11/0723:07:48 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -111,7 +111,7 @@ gistbuild(Relation heap,
111111
*/
112112

113113
if (oldPred==NULL&& (nb=RelationGetNumberOfBlocks(index))!=0)
114-
elog(ERROR,"%s already contains data",index->rd_rel->relname.data);
114+
elog(ERROR,"%s already contains data",RelationGetRelationName(index));
115115

116116
/* initialize the root page (if this is a new index) */
117117
if (oldPred==NULL)

‎src/backend/access/hash/hashfunc.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/access/hash/hashfunc.c,v 1.19 1999/07/15 22:38:35 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.20 1999/11/07 23:07:49 momjian Exp $
1111
*
1212
* NOTES
1313
* These functions are stored in pg_amproc.For each operator class
@@ -177,7 +177,7 @@ hashname(NameData *n)
177177
intlen;
178178
char*key;
179179

180-
key=n->data;
180+
key=NameStr(*n);
181181

182182
h=0;
183183
len=NAMEDATALEN;

‎src/backend/access/heap/heapam.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.57 1999/10/30 23:10:21 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.58 1999/11/07 23:07:52 momjian Exp $
1111
*
1212
*
1313
* INTERFACE ROUTINES
@@ -259,7 +259,7 @@ heapgettup(Relation relation,
259259
elog(DEBUG,"heapgettup(..., b=0x%x, nkeys=%d, key=0x%x",buffer,nkeys,key);
260260

261261
elog(DEBUG,"heapgettup: relation(%c)=`%s', %p",
262-
relation->rd_rel->relkind,&relation->rd_rel->relname,
262+
relation->rd_rel->relkind,RelationGetRelationName(relation),
263263
snapshot);
264264
#endif/* !defined(HEAPDEBUGALL) */
265265

@@ -525,7 +525,7 @@ heap_open(Oid relationId, LOCKMODE lockmode)
525525

526526
/* Under no circumstances will we return an index as a relation. */
527527
if (RelationIsValid(r)&&r->rd_rel->relkind==RELKIND_INDEX)
528-
elog(ERROR,"%s is an index relation",r->rd_rel->relname.data);
528+
elog(ERROR,"%s is an index relation",RelationGetRelationName(r));
529529

530530
if (lockmode==NoLock)
531531
returnr;/* caller must check RelationIsValid! */
@@ -567,7 +567,7 @@ heap_openr(char *relationName, LOCKMODE lockmode)
567567

568568
/* Under no circumstances will we return an index as a relation. */
569569
if (RelationIsValid(r)&&r->rd_rel->relkind==RELKIND_INDEX)
570-
elog(ERROR,"%s is an index relation",r->rd_rel->relname.data);
570+
elog(ERROR,"%s is an index relation",RelationGetRelationName(r));
571571

572572
if (lockmode==NoLock)
573573
returnr;/* caller must check RelationIsValid! */
@@ -765,7 +765,7 @@ heap_endscan(HeapScanDesc scan)
765765
#ifdefHEAPDEBUGALL
766766
#defineHEAPDEBUG_1 \
767767
elog(DEBUG, "heap_getnext([%s,nkeys=%d],backw=%d) called", \
768-
scan->rs_rd->rd_rel->relname.data, scan->rs_nkeys, backw)
768+
RelationGetRelationName(scan->rs_rd), scan->rs_nkeys, backw)
769769

770770
#defineHEAPDEBUG_2 \
771771
elog(DEBUG, "heap_getnext called with backw (no tracing yet)")
@@ -1045,7 +1045,7 @@ heap_fetch(Relation relation,
10451045

10461046
if (!BufferIsValid(buffer))
10471047
elog(ERROR,"heap_fetch: %s relation: ReadBuffer(%lx) failed",
1048-
&relation->rd_rel->relname, (long)tid);
1048+
RelationGetRelationName(relation), (long)tid);
10491049

10501050
LockBuffer(buffer,BUFFER_LOCK_SHARE);
10511051

@@ -1121,7 +1121,7 @@ heap_get_latest_tid(Relation relation,
11211121

11221122
if (!BufferIsValid(buffer))
11231123
elog(ERROR,"heap_get_latest_tid: %s relation: ReadBuffer(%lx) failed",
1124-
&relation->rd_rel->relname, (long)tid);
1124+
RelationGetRelationName(relation), (long)tid);
11251125

11261126
LockBuffer(buffer,BUFFER_LOCK_SHARE);
11271127

@@ -1231,7 +1231,7 @@ heap_insert(Relation relation, HeapTuple tup)
12311231

12321232
RelationPutHeapTupleAtEnd(relation,tup);
12331233

1234-
if (IsSystemRelationName(RelationGetRelationName(relation)->data))
1234+
if (IsSystemRelationName(RelationGetRelationName(relation)))
12351235
RelationInvalidateHeapTuple(relation,tup);
12361236

12371237
returntup->t_data->t_oid;

‎src/backend/access/index/indexam.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/access/index/indexam.c,v 1.36 1999/09/18 19:06:04 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.37 1999/11/07 23:07:54 momjian Exp $
1111
*
1212
* INTERFACE ROUTINES
1313
*index_open- open an index relation by relationId
@@ -147,7 +147,7 @@ index_open(Oid relationId)
147147
elog(ERROR,"Index %u does not exist",relationId);
148148

149149
if (r->rd_rel->relkind!=RELKIND_INDEX)
150-
elog(ERROR,"%s is not an index relation",r->rd_rel->relname.data);
150+
elog(ERROR,"%s is not an index relation",RelationGetRelationName(r));
151151

152152
returnr;
153153
}
@@ -169,7 +169,7 @@ index_openr(char *relationName)
169169
elog(ERROR,"Index '%s' does not exist",relationName);
170170

171171
if (r->rd_rel->relkind!=RELKIND_INDEX)
172-
elog(ERROR,"%s is not an index relation",r->rd_rel->relname.data);
172+
elog(ERROR,"%s is not an index relation",RelationGetRelationName(r));
173173

174174
returnr;
175175
}

‎src/backend/access/nbtree/nbtcompare.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/access/nbtree/nbtcompare.c,v 1.27 1999/07/17 20:16:41 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.28 1999/11/07 23:07:56 momjian Exp $
1111
*
1212
*NOTES
1313
*These functions are stored in pg_amproc. For each operator class
@@ -131,7 +131,7 @@ btcharcmp(char a, char b)
131131
int32
132132
btnamecmp(NameData*a,NameData*b)
133133
{
134-
returnstrncmp(a->data,b->data,NAMEDATALEN);
134+
returnstrncmp(NameStr(*a),NameStr(*b),NAMEDATALEN);
135135
}
136136

137137
int32

‎src/backend/access/nbtree/nbtsearch.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/access/nbtree/nbtsearch.c,v 1.54 1999/09/27 18:20:21 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.55 1999/11/07 23:07:57 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -206,7 +206,7 @@ _bt_moveright(Relation rel,
206206
PageGetItemId(page,P_FIRSTKEY),
207207
BTEqualStrategyNumber))
208208
elog(FATAL,"btree: BTP_CHAIN flag was expected in %s (access = %s)",
209-
rel->rd_rel->relname.data,access ?"bt_write" :"bt_read");
209+
RelationGetRelationName(rel),access ?"bt_write" :"bt_read");
210210
if (_bt_skeycmp(rel,keysz,scankey,page,
211211
PageGetItemId(page,offmax),
212212
BTEqualStrategyNumber))

‎src/backend/access/rtree/rtree.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/access/rtree/Attic/rtree.c,v 1.38 1999/09/24 00:23:59 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.39 1999/11/0723:07:58 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -105,7 +105,7 @@ rtbuild(Relation heap,
105105
*/
106106

107107
if (oldPred==NULL&& (nb=RelationGetNumberOfBlocks(index))!=0)
108-
elog(ERROR,"%s already contains data",index->rd_rel->relname.data);
108+
elog(ERROR,"%s already contains data",RelationGetRelationName(index));
109109

110110
/* initialize the root page (if this is a new index) */
111111
if (oldPred==NULL)

‎src/backend/bootstrap/bootstrap.c

Lines changed: 7 additions & 7 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.70 1999/10/25 03:07:43 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.71 1999/11/07 23:07:59 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -479,7 +479,7 @@ boot_openrel(char *relname)
479479
*/
480480
if (namestrcmp(&attrtypes[i]->attname,"attisset")==0)
481481
attrtypes[i]->attisset=get_attisset(RelationGetRelid(reldesc),
482-
attrtypes[i]->attname.data);
482+
NameStr(attrtypes[i]->attname));
483483
else
484484
attrtypes[i]->attisset= false;
485485

@@ -488,7 +488,7 @@ boot_openrel(char *relname)
488488
Form_pg_attributeat=attrtypes[i];
489489

490490
printf("create attribute %d name %s len %d num %d type %d\n",
491-
i,at->attname.data,at->attlen,at->attnum,
491+
i,NameStr(at->attname),at->attlen,at->attnum,
492492
at->atttypid
493493
);
494494
fflush(stdout);
@@ -507,7 +507,7 @@ closerel(char *name)
507507
{
508508
if (reldesc)
509509
{
510-
if (namestrcmp(RelationGetRelationName(reldesc),name)!=0)
510+
if (strcmp(RelationGetRelationName(reldesc),name)!=0)
511511
elog(ERROR,"closerel: close of '%s' when '%s' was expected",
512512
name,relname ?relname :"(null)");
513513
}
@@ -558,7 +558,7 @@ DefineAttr(char *name, char *type, int attnum)
558558
attrtypes[attnum]->atttypid=Ap->am_oid;
559559
namestrcpy(&attrtypes[attnum]->attname,name);
560560
if (!Quiet)
561-
printf("<%s %s> ",attrtypes[attnum]->attname.data,type);
561+
printf("<%s %s> ",NameStr(attrtypes[attnum]->attname),type);
562562
attrtypes[attnum]->attnum=1+attnum;/* fillatt */
563563
attlen=attrtypes[attnum]->attlen=Ap->am_typ.typlen;
564564
attrtypes[attnum]->attbyval=Ap->am_typ.typbyval;
@@ -569,7 +569,7 @@ DefineAttr(char *name, char *type, int attnum)
569569
attrtypes[attnum]->atttypid=Procid[typeoid].oid;
570570
namestrcpy(&attrtypes[attnum]->attname,name);
571571
if (!Quiet)
572-
printf("<%s %s> ",attrtypes[attnum]->attname.data,type);
572+
printf("<%s %s> ",NameStr(attrtypes[attnum]->attname),type);
573573
attrtypes[attnum]->attnum=1+attnum;/* fillatt */
574574
attlen=attrtypes[attnum]->attlen=Procid[typeoid].len;
575575

@@ -792,7 +792,7 @@ gettype(char *type)
792792
{
793793
for (app=Typ;*app!= (structtypmap*)NULL;app++)
794794
{
795-
if (strncmp((*app)->am_typ.typname.data,type,NAMEDATALEN)==0)
795+
if (strncmp(NameStr((*app)->am_typ.typname),type,NAMEDATALEN)==0)
796796
{
797797
Ap=*app;
798798
return (*app)->am_oid;

‎src/backend/catalog/aclchk.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/aclchk.c,v 1.28 1999/09/18 19:06:33 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.29 1999/11/07 23:08:00 momjian Exp $
1111
*
1212
* NOTES
1313
* See acl.h.
@@ -192,7 +192,7 @@ get_groname(AclId grosysid)
192192
ObjectIdGetDatum(grosysid),
193193
0,0,0);
194194
if (HeapTupleIsValid(tuple))
195-
name= (((Form_pg_group)GETSTRUCT(tuple))->groname).data;
195+
name=NameStr(((Form_pg_group)GETSTRUCT(tuple))->groname);
196196
else
197197
elog(NOTICE,"get_groname: group %d not found",grosysid);
198198
returnname;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp