Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 34797d4

Browse files
committed
Cleanup Name usage.
1 parent 7193719 commit 34797d4

File tree

7 files changed

+48
-69
lines changed

7 files changed

+48
-69
lines changed

src/backend/access/gist/gist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ gistbuild(Relation heap,
130130
*/
131131

132132
if (oldPred == NULL && (nb = RelationGetNumberOfBlocks(index)) != 0)
133-
elog(ERROR, "%.16s already contains data", &(index->rd_rel->relname.data[0]));
133+
elog(ERROR, "%s already contains data", index->rd_rel->relname.data);
134134

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

src/backend/executor/execMain.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*
2727
*
2828
* IDENTIFICATION
29-
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.49 1998/07/19 03:46:29 momjian Exp $
29+
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.50 1998/07/20 16:14:13 momjian Exp $
3030
*
3131
*-------------------------------------------------------------------------
3232
*/
@@ -606,16 +606,6 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
606606

607607
estate->es_into_relation_descriptor = intoRelationDesc;
608608

609-
/* ----------------
610-
* return the type information..
611-
* ----------------
612-
*/
613-
/*
614-
attinfo = (AttrInfo *)palloc(sizeof(AttrInfo));
615-
attinfo->numAttr = len;
616-
attinfo->attrs = tupType->attrs;
617-
*/
618-
619609
return tupType;
620610
}
621611

src/backend/executor/execUtils.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.32 1998/06/15 19:28:20 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.33 1998/07/20 16:14:13 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -309,8 +309,7 @@ ExecFreeResultType(CommonState *commonstate)
309309
slot = commonstate->cs_ResultTupleSlot;
310310
tupType = slot->ttc_tupleDescriptor;
311311

312-
/* ExecFreeTypeInfo(tupType); */
313-
pfree(tupType);
312+
ExecFreeTypeInfo(tupType);
314313
}
315314

316315
#endif
@@ -407,8 +406,7 @@ ExecFreeScanType(CommonScanState *csstate)
407406
slot = csstate->css_ScanTupleSlot;
408407
tupType = slot->ttc_tupleDescriptor;
409408

410-
/* ExecFreeTypeInfo(tupType); */
411-
pfree(tupType);
409+
ExecFreeTypeInfo(tupType);
412410
}
413411

414412
#endif

src/backend/storage/smgr/md.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.31 1998/06/15 19:29:23 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.32 1998/07/20 16:14:14 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -139,7 +139,7 @@ mdcreate(Relation reln)
139139
vfd;
140140
char *path;
141141

142-
path = relpath(&(reln->rd_rel->relname.data[0]));
142+
path = relpath(reln->rd_rel->relname.data);
143143
fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL, 0600);
144144

145145
/*
@@ -288,7 +288,7 @@ mdopen(Relation reln)
288288
int fd;
289289
int vfd;
290290

291-
path = relpath(&(reln->rd_rel->relname.data[0]));
291+
path = relpath(reln->rd_rel->relname.data);
292292

293293
fd = FileNameOpenFile(path, O_RDWR, 0600);
294294

@@ -718,7 +718,7 @@ mdtruncate(Relation reln, int nblocks)
718718
if (curnblk / RELSEG_SIZE > 0)
719719
{
720720
elog(NOTICE, "Can't truncate multi-segments relation %s",
721-
&(reln->rd_rel->relname.data[0]));
721+
reln->rd_rel->relname.data);
722722
return (curnblk);
723723
}
724724
#endif

src/backend/storage/smgr/smgr.c

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.17 1998/06/27 04:53:40 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.18 1998/07/20 16:14:15 momjian Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -132,8 +132,7 @@ smgrcreate(int16 which, Relation reln)
132132
int fd;
133133

134134
if ((fd = (*(smgrsw[which].smgr_create)) (reln)) < 0)
135-
elog(ERROR, "cannot create %s",
136-
&(reln->rd_rel->relname.data[0]));
135+
elog(ERROR, "cannot create %s", reln->rd_rel->relname.data);
137136

138137
return (fd);
139138
}
@@ -149,8 +148,7 @@ smgrunlink(int16 which, Relation reln)
149148
int status;
150149

151150
if ((status = (*(smgrsw[which].smgr_unlink)) (reln)) == SM_FAIL)
152-
elog(ERROR, "cannot unlink %s",
153-
&(reln->rd_rel->relname.data[0]));
151+
elog(ERROR, "cannot unlink %s", reln->rd_rel->relname.data);
154152

155153
return (status);
156154
}
@@ -169,8 +167,7 @@ smgrextend(int16 which, Relation reln, char *buffer)
169167
status = (*(smgrsw[which].smgr_extend)) (reln, buffer);
170168

171169
if (status == SM_FAIL)
172-
elog(ERROR, "%s: cannot extend",
173-
&(reln->rd_rel->relname.data[0]));
170+
elog(ERROR, "%s: cannot extend", reln->rd_rel->relname.data);
174171

175172
return (status);
176173
}
@@ -187,8 +184,7 @@ smgropen(int16 which, Relation reln)
187184
int fd;
188185

189186
if ((fd = (*(smgrsw[which].smgr_open)) (reln)) < 0)
190-
elog(ERROR, "cannot open %s",
191-
&(reln->rd_rel->relname.data[0]));
187+
elog(ERROR, "cannot open %s", reln->rd_rel->relname.data);
192188

193189
return (fd);
194190
}
@@ -209,8 +205,7 @@ int
209205
smgrclose(int16 which, Relation reln)
210206
{
211207
if ((*(smgrsw[which].smgr_close)) (reln) == SM_FAIL)
212-
elog(ERROR, "cannot close %s",
213-
&(reln->rd_rel->relname.data[0]));
208+
elog(ERROR, "cannot close %s", reln->rd_rel->relname.data);
214209

215210
return (SM_SUCCESS);
216211
}
@@ -234,7 +229,7 @@ smgrread(int16 which, Relation reln, BlockNumber blocknum, char *buffer)
234229

235230
if (status == SM_FAIL)
236231
elog(ERROR, "cannot read block %d of %s",
237-
blocknum, &(reln->rd_rel->relname.data[0]));
232+
blocknum, reln->rd_rel->relname.data);
238233

239234
return (status);
240235
}
@@ -256,7 +251,7 @@ smgrwrite(int16 which, Relation reln, BlockNumber blocknum, char *buffer)
256251

257252
if (status == SM_FAIL)
258253
elog(ERROR, "cannot write block %d of %s",
259-
blocknum, &(reln->rd_rel->relname.data[0]));
254+
blocknum, reln->rd_rel->relname.data);
260255

261256
return (status);
262257
}
@@ -273,7 +268,7 @@ smgrflush(int16 which, Relation reln, BlockNumber blocknum, char *buffer)
273268

274269
if (status == SM_FAIL)
275270
elog(ERROR, "cannot flush block %d of %s to stable store",
276-
blocknum, &(reln->rd_rel->relname.data[0]));
271+
blocknum, reln->rd_rel->relname.data);
277272

278273
return (status);
279274
}
@@ -332,8 +327,7 @@ smgrnblocks(int16 which, Relation reln)
332327
int nblocks;
333328

334329
if ((nblocks = (*(smgrsw[which].smgr_nblocks)) (reln)) < 0)
335-
elog(ERROR, "cannot count blocks for %s",
336-
&(reln->rd_rel->relname.data[0]));
330+
elog(ERROR, "cannot count blocks for %s", reln->rd_rel->relname.data);
337331

338332
return (nblocks);
339333
}
@@ -355,7 +349,7 @@ smgrtruncate(int16 which, Relation reln, int nblocks)
355349
{
356350
if ((newblks = (*(smgrsw[which].smgr_truncate)) (reln, nblocks)) < 0)
357351
elog(ERROR, "cannot truncate %s to %d blocks",
358-
&(reln->rd_rel->relname.data[0]), nblocks);
352+
reln->rd_rel->relname.data, nblocks);
359353
}
360354

361355
return (newblks);

src/backend/utils/cache/relcache.c

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.40 1998/06/15 19:29:40 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.41 1998/07/20 16:14:16 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -604,8 +604,8 @@ build_tupdesc_ind(RelationBuildDescInfo buildinfo,
604604
atttup = (HeapTuple) AttributeNumIndexScan(attrel, relation->rd_id, i);
605605

606606
if (!HeapTupleIsValid(atttup))
607-
elog(ERROR, "cannot find attribute %d of relation %.*s", i,
608-
NAMEDATALEN, &(relation->rd_rel->relname.data[0]));
607+
elog(ERROR, "cannot find attribute %d of relation %s", i,
608+
relation->rd_rel->relname.data);
609609
attp = (AttributeTupleForm) GETSTRUCT(atttup);
610610

611611
relation->rd_att->attrs[i - 1] =
@@ -1712,40 +1712,39 @@ AttrDefaultFetch(Relation relation)
17121712
if (adform->adnum != attrdef[i].adnum)
17131713
continue;
17141714
if (attrdef[i].adsrc != NULL)
1715-
elog(ERROR, "AttrDefaultFetch: second record found for attr %.*s in rel %.*s",
1716-
NAMEDATALEN, relation->rd_att->attrs[adform->adnum - 1]->attname.data,
1717-
NAMEDATALEN, relation->rd_rel->relname.data);
1715+
elog(ERROR, "AttrDefaultFetch: second record found for attr %s in rel %s",
1716+
relation->rd_att->attrs[adform->adnum - 1]->attname.data,
1717+
relation->rd_rel->relname.data);
17181718

17191719
val = (struct varlena *) fastgetattr(tuple,
17201720
Anum_pg_attrdef_adbin,
17211721
adrel->rd_att, &isnull);
17221722
if (isnull)
1723-
elog(ERROR, "AttrDefaultFetch: adbin IS NULL for attr %.*s in rel %.*s",
1724-
NAMEDATALEN, relation->rd_att->attrs[adform->adnum - 1]->attname.data,
1725-
NAMEDATALEN, relation->rd_rel->relname.data);
1723+
elog(ERROR, "AttrDefaultFetch: adbin IS NULL for attr %s in rel %s",
1724+
relation->rd_att->attrs[adform->adnum - 1]->attname.data,
1725+
relation->rd_rel->relname.data);
17261726
attrdef[i].adbin = textout(val);
17271727
val = (struct varlena *) fastgetattr(tuple,
17281728
Anum_pg_attrdef_adsrc,
17291729
adrel->rd_att, &isnull);
17301730
if (isnull)
1731-
elog(ERROR, "AttrDefaultFetch: adsrc IS NULL for attr %.*s in rel %.*s",
1732-
NAMEDATALEN, relation->rd_att->attrs[adform->adnum - 1]->attname.data,
1733-
NAMEDATALEN, relation->rd_rel->relname.data);
1731+
elog(ERROR, "AttrDefaultFetch: adsrc IS NULL for attr %s in rel %s",
1732+
relation->rd_att->attrs[adform->adnum - 1]->attname.data,
1733+
relation->rd_rel->relname.data);
17341734
attrdef[i].adsrc = textout(val);
17351735
break;
17361736
}
17371737

17381738
if (i >= ndef)
1739-
elog(ERROR, "AttrDefaultFetch: unexpected record found for attr %d in rel %.*s",
1739+
elog(ERROR, "AttrDefaultFetch: unexpected record found for attr %d in rel %s",
17401740
adform->adnum,
1741-
NAMEDATALEN, relation->rd_rel->relname.data);
1741+
relation->rd_rel->relname.data);
17421742
ReleaseBuffer(buffer);
17431743
}
17441744

17451745
if (found < ndef)
1746-
elog(ERROR, "AttrDefaultFetch: %d record not found for rel %.*s",
1747-
ndef - found,
1748-
NAMEDATALEN, relation->rd_rel->relname.data);
1746+
elog(ERROR, "AttrDefaultFetch: %d record not found for rel %s",
1747+
ndef - found, relation->rd_rel->relname.data);
17491748

17501749
index_endscan(sd);
17511750
pfree(sd);
@@ -1795,39 +1794,39 @@ RelCheckFetch(Relation relation)
17951794
if (!HeapTupleIsValid(tuple))
17961795
continue;
17971796
if (found == ncheck)
1798-
elog(ERROR, "RelCheckFetch: unexpected record found for rel %.*s",
1799-
NAMEDATALEN, relation->rd_rel->relname.data);
1797+
elog(ERROR, "RelCheckFetch: unexpected record found for rel %s",
1798+
relation->rd_rel->relname.data);
18001799

18011800
rcname = (Name) fastgetattr(tuple,
18021801
Anum_pg_relcheck_rcname,
18031802
rcrel->rd_att, &isnull);
18041803
if (isnull)
1805-
elog(ERROR, "RelCheckFetch: rcname IS NULL for rel %.*s",
1806-
NAMEDATALEN, relation->rd_rel->relname.data);
1804+
elog(ERROR, "RelCheckFetch: rcname IS NULL for rel %s",
1805+
relation->rd_rel->relname.data);
18071806
check[found].ccname = nameout(rcname);
18081807
val = (struct varlena *) fastgetattr(tuple,
18091808
Anum_pg_relcheck_rcbin,
18101809
rcrel->rd_att, &isnull);
18111810
if (isnull)
1812-
elog(ERROR, "RelCheckFetch: rcbin IS NULL for rel %.*s",
1813-
NAMEDATALEN, relation->rd_rel->relname.data);
1811+
elog(ERROR, "RelCheckFetch: rcbin IS NULL for rel %s",
1812+
relation->rd_rel->relname.data);
18141813
check[found].ccbin = textout(val);
18151814
val = (struct varlena *) fastgetattr(tuple,
18161815
Anum_pg_relcheck_rcsrc,
18171816
rcrel->rd_att, &isnull);
18181817
if (isnull)
1819-
elog(ERROR, "RelCheckFetch: rcsrc IS NULL for rel %.*s",
1820-
NAMEDATALEN, relation->rd_rel->relname.data);
1818+
elog(ERROR, "RelCheckFetch: rcsrc IS NULL for rel %s",
1819+
relation->rd_rel->relname.data);
18211820
check[found].ccsrc = textout(val);
18221821
found++;
18231822

18241823
ReleaseBuffer(buffer);
18251824
}
18261825

18271826
if (found < ncheck)
1828-
elog(ERROR, "RelCheckFetch: %d record not found for rel %.*s",
1827+
elog(ERROR, "RelCheckFetch: %d record not found for rel %s",
18291828
ncheck - found,
1830-
NAMEDATALEN, relation->rd_rel->relname.data);
1829+
relation->rd_rel->relname.data);
18311830

18321831
index_endscan(sd);
18331832
pfree(sd);

src/backend/utils/misc/database.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.10 1998/06/15 19:29:50 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.11 1998/07/20 16:14:18 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -267,9 +267,7 @@ GetRawDatabaseInfo(char *name, Oid *owner, Oid *db_id, char *path)
267267
*/
268268
tup_db = (Form_pg_database) GETSTRUCT(tup);
269269

270-
if (strncmp(name,
271-
&(tup_db->datname.data[0]),
272-
16) == 0)
270+
if (strcmp(name, tup_db->datname.data) == 0)
273271
{
274272
*db_id = tup->t_oid;
275273
strncpy(path, VARDATA(&(tup_db->datpath)),

0 commit comments

Comments
 (0)