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

Commit 0da6358

Browse files
committed
Cleanup use of 16 that should be NAMEDATALEN.
1 parent 34797d4 commit 0da6358

File tree

14 files changed

+35
-44
lines changed

14 files changed

+35
-44
lines changed

src/backend/access/gist/gist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1347,7 +1347,7 @@ text_range_out(TXTRANGE *r)
13471347

13481348
if (r == NULL)
13491349
return (NULL);
1350-
result = (char *) palloc(16 + VARSIZE(TRLOWER(r)) + VARSIZE(TRUPPER(r))
1350+
result = (char *) palloc(NAMEDATALEN + VARSIZE(TRLOWER(r)) + VARSIZE(TRUPPER(r))
13511351
- 2 * VARHDRSZ);
13521352

13531353
lower = (char *) palloc(VARSIZE(TRLOWER(r)) + 1 - VARHDRSZ);

src/backend/access/heap/heapam.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/access/heap/heapam.c,v 1.29 1998/06/16 02:53:25 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.30 1998/07/20 16:56:53 momjian Exp $
1111
*
1212
*
1313
* INTERFACE ROUTINES
@@ -239,18 +239,18 @@ heapgettup(Relation relation,
239239
#ifdef HEAPDEBUGALL
240240
if (ItemPointerIsValid(tid))
241241
{
242-
elog(DEBUG, "heapgettup(%.16s, tid=0x%x[%d,%d], dir=%d, ...)",
242+
elog(DEBUG, "heapgettup(%s, tid=0x%x[%d,%d], dir=%d, ...)",
243243
RelationGetRelationName(relation), tid, tid->ip_blkid,
244244
tid->ip_posid, dir);
245245
}
246246
else
247247
{
248-
elog(DEBUG, "heapgettup(%.16s, tid=0x%x, dir=%d, ...)",
248+
elog(DEBUG, "heapgettup(%s, tid=0x%x, dir=%d, ...)",
249249
RelationGetRelationName(relation), tid, dir);
250250
}
251251
elog(DEBUG, "heapgettup(..., b=0x%x, nkeys=%d, key=0x%x", b, nkeys, key);
252252

253-
elog(DEBUG, "heapgettup: relation(%c)=`%.16s', %s",
253+
elog(DEBUG, "heapgettup: relation(%c)=`%s', %s",
254254
relation->rd_rel->relkind, &relation->rd_rel->relname,
255255
(seeself == true) ? "SeeSelf" : "NoSeeSelf");
256256
#endif /* !defined(HEAPDEBUGALL) */

src/backend/storage/ipc/shmqueue.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/storage/ipc/shmqueue.c,v 1.6 1997/09/08 21:47:10 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmqueue.c,v 1.7 1998/07/20 16:56:54 momjian Exp $
1111
*
1212
* NOTES
1313
*
@@ -99,7 +99,7 @@ SHMQueueDelete(SHM_QUEUE *queue)
9999
void
100100
dumpQ(SHM_QUEUE *q, char *s)
101101
{
102-
char elem[16];
102+
char elem[NAMEDATALEN];
103103
char buf[1024];
104104
SHM_QUEUE *start = q;
105105
int count = 0;

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.32 1998/07/20 16:14:14 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.33 1998/07/20 16:56:55 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -686,7 +686,7 @@ mdnblocks(Relation reln)
686686
{
687687
v->mdfd_chain = _mdfd_openseg(reln, segno, O_CREAT);
688688
if (v->mdfd_chain == (MdfdVec *) NULL)
689-
elog(ERROR, "cannot count blocks for %.16s -- open failed",
689+
elog(ERROR, "cannot count blocks for %s -- open failed",
690690
RelationGetRelationName(reln));
691691
}
692692

@@ -940,7 +940,7 @@ _mdfd_getseg(Relation reln, int blkno, int oflag)
940940
if (fd < 0)
941941
{
942942
if ((fd = mdopen(reln)) < 0)
943-
elog(ERROR, "cannot open relation %.16s",
943+
elog(ERROR, "cannot open relation %s",
944944
RelationGetRelationName(reln));
945945
reln->rd_fd = fd;
946946
}
@@ -956,7 +956,7 @@ _mdfd_getseg(Relation reln, int blkno, int oflag)
956956
v->mdfd_chain = _mdfd_openseg(reln, i, oflag);
957957

958958
if (v->mdfd_chain == (MdfdVec *) NULL)
959-
elog(ERROR, "cannot open segment %d of relation %.16s",
959+
elog(ERROR, "cannot open segment %d of relation %s",
960960
i, RelationGetRelationName(reln));
961961
}
962962
v = v->mdfd_chain;

src/backend/tcop/dest.c

Lines changed: 2 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/tcop/dest.c,v 1.20 1998/05/19 18:05:47 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/tcop/dest.c,v 1.21 1998/07/20 16:56:57 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -284,8 +284,7 @@ BeginCommand(char *pname,
284284

285285
for (i = 0; i < natts; ++i)
286286
{
287-
pq_putstr(attrs[i]->attname.data); /* if 16 char name
288-
* oops.. */
287+
pq_putstr(attrs[i]->attname.data);
289288
pq_putint((int) attrs[i]->atttypid, sizeof(attrs[i]->atttypid));
290289
pq_putint(attrs[i]->attlen, sizeof(attrs[i]->attlen));
291290
if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 2)

src/backend/utils/adt/regproc.c

Lines changed: 4 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/utils/adt/regproc.c,v 1.19 1998/06/15 19:29:37 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.20 1998/07/20 16:57:01 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -130,7 +130,7 @@ regprocout(RegProcedure proid)
130130
RelationGetTupleDescriptor(proc), &isnull);
131131
if (!isnull)
132132
{
133-
StrNCpy(result, s, 16);
133+
StrNCpy(result, s, NAMEDATALEN);
134134
break;
135135
}
136136
elog(FATAL, "regprocout: null procedure %d", proid);
@@ -207,7 +207,8 @@ oid8types(Oid (*oidArray)[])
207207
RelationGetTupleDescriptor(type), &isnull);
208208
if (!isnull)
209209
{
210-
StrNCpy(VARDATA(result) + strlen(VARDATA(result)), s, 16);
210+
StrNCpy(VARDATA(result) + strlen(VARDATA(result)), s,
211+
NAMEDATALEN);
211212
strcat(VARDATA(result), " ");
212213
}
213214
else

src/backend/utils/adt/sets.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.13 1998/04/27 04:07:00 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.14 1998/07/20 16:57:02 momjian Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -47,7 +47,7 @@ SetDefine(char *querystr, char *typename)
4747
Oid setoid;
4848
char *procname = GENERICSETNAME;
4949
char *fileName = "-";
50-
char realprocname[16];
50+
char realprocname[NAMEDATALEN];
5151
HeapTuple tup,
5252
newtup = NULL;
5353
Form_pg_proc proc;

src/backend/utils/cache/catcache.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/utils/cache/catcache.c,v 1.29 1998/06/15 19:29:38 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.30 1998/07/20 16:57:03 momjian Exp $
1111
*
1212
* Notes:
1313
* XXX This needs to use exception.h to handle recovery when
@@ -220,7 +220,7 @@ CatalogCacheInitializeCache(struct catcache * cache,
220220
&cache->cc_skey[i].sk_func);
221221
cache->cc_skey[i].sk_nargs = cache->cc_skey[i].sk_func.fn_nargs;
222222

223-
CACHE5_elog(DEBUG, "CatalogCacheInit %16s %d %d %x",
223+
CACHE5_elog(DEBUG, "CatalogCacheInit %s %d %d %x",
224224
&relation->rd_rel->relname,
225225
i,
226226
tupdesc->attrs[cache->cc_key[i] - 1]->attlen,

src/backend/utils/cache/syscache.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/utils/cache/syscache.c,v 1.18 1998/06/15 19:29:40 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.19 1998/07/20 16:57:05 momjian Exp $
1111
*
1212
* NOTES
1313
* These routines allow the parser/planner/executor to perform
@@ -372,7 +372,7 @@ InitCatalogCache()
372372
if (!PointerIsValid((char *) SysCache[cacheId]))
373373
{
374374
elog(ERROR,
375-
"InitCatalogCache: Can't init cache %.16s(%d)",
375+
"InitCatalogCache: Can't init cache %s(%d)",
376376
cacheinfo[cacheId].name,
377377
cacheId);
378378
}
@@ -419,7 +419,7 @@ SearchSysCacheTuple(int cacheId,/* cache selection code */
419419
cacheinfo[cacheId].iScanFunc);
420420
if (!PointerIsValid(SysCache[cacheId]))
421421
elog(ERROR,
422-
"InitCatalogCache: Can't init cache %.16s(%d)",
422+
"InitCatalogCache: Can't init cache %s(%d)",
423423
cacheinfo[cacheId].name,
424424
cacheId);
425425
}

src/include/libpq/libpq.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: libpq.h,v 1.19 1998/07/18 18:34:23 momjian Exp $
9+
* $Id: libpq.h,v 1.20 1998/07/20 16:57:06 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -44,7 +44,7 @@ typedef struct
4444
* Information about an attribute.
4545
* ----------------
4646
*/
47-
#define NameLength 16
47+
#define NameLength NAMEDATALEN
4848

4949
typedef struct TypeBlock
5050
{

src/include/storage/buf_internals.h

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: buf_internals.h,v 1.23 1998/07/13 16:34:55 momjian Exp $
9+
* $Id: buf_internals.h,v 1.24 1998/07/20 16:57:10 momjian Exp $
1010
*
1111
* NOTE
1212
* If BUFFERPAGE0 is defined, then 0 will be used as a
@@ -86,15 +86,6 @@ struct buftag
8686
#define BAD_BUFFER_ID(bid) ((bid<1) || (bid>(NBuffers)))
8787
#define INVALID_DESCRIPTOR (-3)
8888

89-
/*
90-
* bletch hack -- anyplace that we declare space for relation or
91-
* database names, we just use '16', not a symbolic constant, to
92-
* specify their lengths. BM_NAMESIZE is the length of these names,
93-
* and is used in the buffer manager code. somebody with lots of
94-
* spare time should do this for all the other modules, too.
95-
*/
96-
#define BM_NAMESIZE 16
97-
9889
/*
9990
* struct sbufdesc -- shared buffer cache metadata for a single
10091
* shared buffer descriptor.

src/interfaces/libpq/fe-auth.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/interfaces/libpq/fe-auth.c,v 1.19 1998/07/09 03:32:09 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.20 1998/07/20 16:57:13 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -58,7 +58,7 @@
5858

5959
struct authsvc
6060
{
61-
char name[16]; /* service nickname (for command line) */
61+
char name[NAMEDATALEN]; /* service nickname (for command line) */
6262
MsgType msgtype; /* startup packet header type */
6363
int allowed; /* initially allowed (before command line
6464
* option parsing)? */

src/interfaces/odbc/connection.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ typedef enum {
8383
#define NO_AUTHENTICATION 7
8484
#define PATH_SIZE 64
8585
#define ARGV_SIZE 64
86-
#define NAMEDATALEN 16
86+
#define NAMEDATALEN 32
8787

8888
typedef unsigned int ProtocolVersion;
8989

src/test/regress/regress.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.26 1998/04/26 04:10:07 momjian Exp $
2+
* $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.27 1998/07/20 16:57:18 momjian Exp $
33
*/
44

55
#include <float.h> /* faked on sunos */
@@ -283,15 +283,15 @@ char *string;
283283
int len;
284284
char *new_string;
285285

286-
if (!(new_string = palloc(16)))
286+
if (!(new_string = palloc(NAMEDATALEN)))
287287
{
288288
fprintf(stderr, "reverse_name: palloc failed\n");
289289
return (NULL);
290290
}
291-
MemSet(new_string, 0, 16);
292-
for (i = 0; i < 16 && string[i]; ++i)
291+
MemSet(new_string, 0, NAMEDATALEN);
292+
for (i = 0; i < NAMEDATALEN && string[i]; ++i)
293293
;
294-
if (i == 16 || !string[i])
294+
if (i == NAMEDATALEN || !string[i])
295295
--i;
296296
len = i;
297297
for (; i >= 0; --i)

0 commit comments

Comments
 (0)