Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
2e211211
Commit
2e211211
authored
Feb 21, 2015
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use FLEXIBLE_ARRAY_MEMBER in a number of other places.
I think we're about done with this...
parent
e1a11d93
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
54 additions
and
62 deletions
+54
-62
contrib/hstore/hstore_gist.c
contrib/hstore/hstore_gist.c
+1
-1
contrib/spi/timetravel.c
contrib/spi/timetravel.c
+16
-9
src/backend/access/heap/syncscan.c
src/backend/access/heap/syncscan.c
+3
-2
src/backend/commands/async.c
src/backend/commands/async.c
+11
-11
src/backend/libpq/auth.c
src/backend/libpq/auth.c
+1
-2
src/backend/storage/buffer/freelist.c
src/backend/storage/buffer/freelist.c
+1
-1
src/backend/storage/ipc/sinvaladt.c
src/backend/storage/ipc/sinvaladt.c
+3
-10
src/backend/utils/adt/numeric.c
src/backend/utils/adt/numeric.c
+5
-5
src/backend/utils/adt/tsgistidx.c
src/backend/utils/adt/tsgistidx.c
+1
-1
src/backend/utils/adt/tsvector_op.c
src/backend/utils/adt/tsvector_op.c
+1
-1
src/backend/utils/adt/txid.c
src/backend/utils/adt/txid.c
+2
-1
src/backend/utils/fmgr/dfmgr.c
src/backend/utils/fmgr/dfmgr.c
+3
-8
src/backend/utils/sort/logtape.c
src/backend/utils/sort/logtape.c
+5
-9
src/interfaces/ecpg/ecpglib/extern.h
src/interfaces/ecpg/ecpglib/extern.h
+1
-1
No files found.
contrib/hstore/hstore_gist.c
View file @
2e211211
...
@@ -41,7 +41,7 @@ typedef struct
...
@@ -41,7 +41,7 @@ typedef struct
{
{
int32
vl_len_
;
/* varlena header (do not touch directly!) */
int32
vl_len_
;
/* varlena header (do not touch directly!) */
int32
flag
;
int32
flag
;
char
data
[
1
];
char
data
[
FLEXIBLE_ARRAY_MEMBER
];
}
GISTTYPE
;
}
GISTTYPE
;
#define ALLISTRUE 0x04
#define ALLISTRUE 0x04
...
...
contrib/spi/timetravel.c
View file @
2e211211
...
@@ -35,10 +35,10 @@ static int nPlans = 0;
...
@@ -35,10 +35,10 @@ static int nPlans = 0;
typedef
struct
_TTOffList
typedef
struct
_TTOffList
{
{
struct
_TTOffList
*
next
;
struct
_TTOffList
*
next
;
char
name
[
1
];
char
name
[
FLEXIBLE_ARRAY_MEMBER
];
}
TTOffList
;
}
TTOffList
;
static
TTOffList
TTOff
=
{
NULL
,
{
0
}}
;
static
TTOffList
*
TTOff
=
NULL
;
static
int
findTTStatus
(
char
*
name
);
static
int
findTTStatus
(
char
*
name
);
static
EPlan
*
find_plan
(
char
*
ident
,
EPlan
**
eplan
,
int
*
nplans
);
static
EPlan
*
find_plan
(
char
*
ident
,
EPlan
**
eplan
,
int
*
nplans
);
...
@@ -428,10 +428,11 @@ set_timetravel(PG_FUNCTION_ARGS)
...
@@ -428,10 +428,11 @@ set_timetravel(PG_FUNCTION_ARGS)
char
*
d
;
char
*
d
;
char
*
s
;
char
*
s
;
int32
ret
;
int32
ret
;
TTOffList
*
p
,
TTOffList
*
p
rev
,
*
pp
;
*
pp
;
for
(
pp
=
(
p
=
&
TTOff
)
->
next
;
pp
;
pp
=
(
p
=
pp
)
->
next
)
prev
=
NULL
;
for
(
pp
=
TTOff
;
pp
;
prev
=
pp
,
pp
=
pp
->
next
)
{
{
if
(
namestrcmp
(
relname
,
pp
->
name
)
==
0
)
if
(
namestrcmp
(
relname
,
pp
->
name
)
==
0
)
break
;
break
;
...
@@ -442,7 +443,10 @@ set_timetravel(PG_FUNCTION_ARGS)
...
@@ -442,7 +443,10 @@ set_timetravel(PG_FUNCTION_ARGS)
if
(
on
!=
0
)
if
(
on
!=
0
)
{
{
/* turn ON */
/* turn ON */
p
->
next
=
pp
->
next
;
if
(
prev
)
prev
->
next
=
pp
->
next
;
else
TTOff
=
pp
->
next
;
free
(
pp
);
free
(
pp
);
}
}
ret
=
0
;
ret
=
0
;
...
@@ -456,15 +460,18 @@ set_timetravel(PG_FUNCTION_ARGS)
...
@@ -456,15 +460,18 @@ set_timetravel(PG_FUNCTION_ARGS)
s
=
rname
=
DatumGetCString
(
DirectFunctionCall1
(
nameout
,
NameGetDatum
(
relname
)));
s
=
rname
=
DatumGetCString
(
DirectFunctionCall1
(
nameout
,
NameGetDatum
(
relname
)));
if
(
s
)
if
(
s
)
{
{
pp
=
malloc
(
sizeof
(
TTOffList
)
+
strlen
(
rname
)
);
pp
=
malloc
(
offsetof
(
TTOffList
,
name
)
+
strlen
(
rname
)
+
1
);
if
(
pp
)
if
(
pp
)
{
{
pp
->
next
=
NULL
;
pp
->
next
=
NULL
;
p
->
next
=
pp
;
d
=
pp
->
name
;
d
=
pp
->
name
;
while
(
*
s
)
while
(
*
s
)
*
d
++
=
tolower
((
unsigned
char
)
*
s
++
);
*
d
++
=
tolower
((
unsigned
char
)
*
s
++
);
*
d
=
'\0'
;
*
d
=
'\0'
;
if
(
prev
)
prev
->
next
=
pp
;
else
TTOff
=
pp
;
}
}
pfree
(
rname
);
pfree
(
rname
);
}
}
...
@@ -486,7 +493,7 @@ get_timetravel(PG_FUNCTION_ARGS)
...
@@ -486,7 +493,7 @@ get_timetravel(PG_FUNCTION_ARGS)
Name
relname
=
PG_GETARG_NAME
(
0
);
Name
relname
=
PG_GETARG_NAME
(
0
);
TTOffList
*
pp
;
TTOffList
*
pp
;
for
(
pp
=
TTOff
.
next
;
pp
;
pp
=
pp
->
next
)
for
(
pp
=
TTOff
;
pp
;
pp
=
pp
->
next
)
{
{
if
(
namestrcmp
(
relname
,
pp
->
name
)
==
0
)
if
(
namestrcmp
(
relname
,
pp
->
name
)
==
0
)
PG_RETURN_INT32
(
0
);
PG_RETURN_INT32
(
0
);
...
@@ -499,7 +506,7 @@ findTTStatus(char *name)
...
@@ -499,7 +506,7 @@ findTTStatus(char *name)
{
{
TTOffList
*
pp
;
TTOffList
*
pp
;
for
(
pp
=
TTOff
.
next
;
pp
;
pp
=
pp
->
next
)
for
(
pp
=
TTOff
;
pp
;
pp
=
pp
->
next
)
if
(
pg_strcasecmp
(
name
,
pp
->
name
)
==
0
)
if
(
pg_strcasecmp
(
name
,
pp
->
name
)
==
0
)
return
0
;
return
0
;
return
1
;
return
1
;
...
...
src/backend/access/heap/syncscan.c
View file @
2e211211
...
@@ -103,10 +103,11 @@ typedef struct ss_scan_locations_t
...
@@ -103,10 +103,11 @@ typedef struct ss_scan_locations_t
{
{
ss_lru_item_t
*
head
;
ss_lru_item_t
*
head
;
ss_lru_item_t
*
tail
;
ss_lru_item_t
*
tail
;
ss_lru_item_t
items
[
1
];
/* SYNC_SCAN_NELEM items */
ss_lru_item_t
items
[
FLEXIBLE_ARRAY_MEMBER
];
/* SYNC_SCAN_NELEM items */
}
ss_scan_locations_t
;
}
ss_scan_locations_t
;
#define SizeOfScanLocations(N) offsetof(ss_scan_locations_t, items[N])
#define SizeOfScanLocations(N) \
(offsetof(ss_scan_locations_t, items) + (N) * sizeof(ss_lru_item_t))
/* Pointer to struct in shared memory */
/* Pointer to struct in shared memory */
static
ss_scan_locations_t
*
scan_locations
;
static
ss_scan_locations_t
*
scan_locations
;
...
...
src/backend/commands/async.c
View file @
2e211211
...
@@ -237,8 +237,8 @@ typedef struct AsyncQueueControl
...
@@ -237,8 +237,8 @@ typedef struct AsyncQueueControl
QueuePosition
tail
;
/* the global tail is equivalent to the tail
QueuePosition
tail
;
/* the global tail is equivalent to the tail
* of the "slowest" backend */
* of the "slowest" backend */
TimestampTz
lastQueueFillWarn
;
/* time of last queue-full msg */
TimestampTz
lastQueueFillWarn
;
/* time of last queue-full msg */
QueueBackendStatus
backend
[
1
];
/* actually of length MaxBackends+1 */
QueueBackendStatus
backend
[
FLEXIBLE_ARRAY_MEMBER
];
/*
DO NOT ADD FURTHER STRUCT MEMBERS HERE
*/
/*
backend[0] is not used; used entries are from [1] to [MaxBackends]
*/
}
AsyncQueueControl
;
}
AsyncQueueControl
;
static
AsyncQueueControl
*
asyncQueueControl
;
static
AsyncQueueControl
*
asyncQueueControl
;
...
@@ -303,7 +303,7 @@ typedef enum
...
@@ -303,7 +303,7 @@ typedef enum
typedef
struct
typedef
struct
{
{
ListenActionKind
action
;
ListenActionKind
action
;
char
channel
[
1
];
/* actually, as long as needed
*/
char
channel
[
FLEXIBLE_ARRAY_MEMBER
];
/* nul-terminated string
*/
}
ListenAction
;
}
ListenAction
;
static
List
*
pendingActions
=
NIL
;
/* list of ListenAction */
static
List
*
pendingActions
=
NIL
;
/* list of ListenAction */
...
@@ -417,8 +417,8 @@ AsyncShmemSize(void)
...
@@ -417,8 +417,8 @@ AsyncShmemSize(void)
Size
size
;
Size
size
;
/* This had better match AsyncShmemInit */
/* This had better match AsyncShmemInit */
size
=
mul_size
(
MaxBackends
,
sizeof
(
QueueBackendStatus
));
size
=
mul_size
(
MaxBackends
+
1
,
sizeof
(
QueueBackendStatus
));
size
=
add_size
(
size
,
sizeof
(
AsyncQueueControl
));
size
=
add_size
(
size
,
offsetof
(
AsyncQueueControl
,
backend
));
size
=
add_size
(
size
,
SimpleLruShmemSize
(
NUM_ASYNC_BUFFERS
,
0
));
size
=
add_size
(
size
,
SimpleLruShmemSize
(
NUM_ASYNC_BUFFERS
,
0
));
...
@@ -438,12 +438,11 @@ AsyncShmemInit(void)
...
@@ -438,12 +438,11 @@ AsyncShmemInit(void)
/*
/*
* Create or attach to the AsyncQueueControl structure.
* Create or attach to the AsyncQueueControl structure.
*
*
* The used entries in the backend[] array run from 1 to MaxBackends.
* The used entries in the backend[] array run from 1 to MaxBackends; the
* sizeof(AsyncQueueControl) already includes space for the unused zero'th
* zero'th entry is unused but must be allocated.
* entry, but we need to add on space for the used entries.
*/
*/
size
=
mul_size
(
MaxBackends
,
sizeof
(
QueueBackendStatus
));
size
=
mul_size
(
MaxBackends
+
1
,
sizeof
(
QueueBackendStatus
));
size
=
add_size
(
size
,
sizeof
(
AsyncQueueControl
));
size
=
add_size
(
size
,
offsetof
(
AsyncQueueControl
,
backend
));
asyncQueueControl
=
(
AsyncQueueControl
*
)
asyncQueueControl
=
(
AsyncQueueControl
*
)
ShmemInitStruct
(
"Async Queue Control"
,
size
,
&
found
);
ShmemInitStruct
(
"Async Queue Control"
,
size
,
&
found
);
...
@@ -605,7 +604,8 @@ queue_listen(ListenActionKind action, const char *channel)
...
@@ -605,7 +604,8 @@ queue_listen(ListenActionKind action, const char *channel)
oldcontext
=
MemoryContextSwitchTo
(
CurTransactionContext
);
oldcontext
=
MemoryContextSwitchTo
(
CurTransactionContext
);
/* space for terminating null is included in sizeof(ListenAction) */
/* space for terminating null is included in sizeof(ListenAction) */
actrec
=
(
ListenAction
*
)
palloc
(
sizeof
(
ListenAction
)
+
strlen
(
channel
));
actrec
=
(
ListenAction
*
)
palloc
(
offsetof
(
ListenAction
,
channel
)
+
strlen
(
channel
)
+
1
);
actrec
->
action
=
action
;
actrec
->
action
=
action
;
strcpy
(
actrec
->
channel
,
channel
);
strcpy
(
actrec
->
channel
,
channel
);
...
...
src/backend/libpq/auth.c
View file @
2e211211
...
@@ -2172,7 +2172,7 @@ typedef struct
...
@@ -2172,7 +2172,7 @@ typedef struct
{
{
uint8
attribute
;
uint8
attribute
;
uint8
length
;
uint8
length
;
uint8
data
[
1
];
uint8
data
[
FLEXIBLE_ARRAY_MEMBER
];
}
radius_attribute
;
}
radius_attribute
;
typedef
struct
typedef
struct
...
@@ -2220,7 +2220,6 @@ radius_add_attribute(radius_packet *packet, uint8 type, const unsigned char *dat
...
@@ -2220,7 +2220,6 @@ radius_add_attribute(radius_packet *packet, uint8 type, const unsigned char *dat
"Adding attribute code %d with length %d to radius packet would create oversize packet, ignoring"
,
"Adding attribute code %d with length %d to radius packet would create oversize packet, ignoring"
,
type
,
len
);
type
,
len
);
return
;
return
;
}
}
attr
=
(
radius_attribute
*
)
((
unsigned
char
*
)
packet
+
packet
->
length
);
attr
=
(
radius_attribute
*
)
((
unsigned
char
*
)
packet
+
packet
->
length
);
...
...
src/backend/storage/buffer/freelist.c
View file @
2e211211
...
@@ -93,7 +93,7 @@ typedef struct BufferAccessStrategyData
...
@@ -93,7 +93,7 @@ typedef struct BufferAccessStrategyData
* simplicity this is palloc'd together with the fixed fields of the
* simplicity this is palloc'd together with the fixed fields of the
* struct.
* struct.
*/
*/
Buffer
buffers
[
1
];
/* VARIABLE SIZE ARRAY */
Buffer
buffers
[
FLEXIBLE_ARRAY_MEMBER
];
}
BufferAccessStrategyData
;
}
BufferAccessStrategyData
;
...
...
src/backend/storage/ipc/sinvaladt.c
View file @
2e211211
...
@@ -184,12 +184,9 @@ typedef struct SISeg
...
@@ -184,12 +184,9 @@ typedef struct SISeg
SharedInvalidationMessage
buffer
[
MAXNUMMESSAGES
];
SharedInvalidationMessage
buffer
[
MAXNUMMESSAGES
];
/*
/*
* Per-backend state info.
* Per-backend invalidation state info (has MaxBackends entries).
*
* We declare procState as 1 entry because C wants a fixed-size array, but
* actually it is maxBackends entries long.
*/
*/
ProcState
procState
[
1
];
/* reflects the invalidation state */
ProcState
procState
[
FLEXIBLE_ARRAY_MEMBER
];
}
SISeg
;
}
SISeg
;
static
SISeg
*
shmInvalBuffer
;
/* pointer to the shared inval buffer */
static
SISeg
*
shmInvalBuffer
;
/* pointer to the shared inval buffer */
...
@@ -221,16 +218,12 @@ SInvalShmemSize(void)
...
@@ -221,16 +218,12 @@ SInvalShmemSize(void)
void
void
CreateSharedInvalidationState
(
void
)
CreateSharedInvalidationState
(
void
)
{
{
Size
size
;
int
i
;
int
i
;
bool
found
;
bool
found
;
/* Allocate space in shared memory */
/* Allocate space in shared memory */
size
=
offsetof
(
SISeg
,
procState
);
size
=
add_size
(
size
,
mul_size
(
sizeof
(
ProcState
),
MaxBackends
));
shmInvalBuffer
=
(
SISeg
*
)
shmInvalBuffer
=
(
SISeg
*
)
ShmemInitStruct
(
"shmInvalBuffer"
,
size
,
&
found
);
ShmemInitStruct
(
"shmInvalBuffer"
,
SInvalShmemSize
()
,
&
found
);
if
(
found
)
if
(
found
)
return
;
return
;
...
...
src/backend/utils/adt/numeric.c
View file @
2e211211
...
@@ -123,14 +123,14 @@ typedef int16 NumericDigit;
...
@@ -123,14 +123,14 @@ typedef int16 NumericDigit;
struct
NumericShort
struct
NumericShort
{
{
uint16
n_header
;
/* Sign + display scale + weight */
uint16
n_header
;
/* Sign + display scale + weight */
NumericDigit
n_data
[
1
];
/* Digits */
NumericDigit
n_data
[
FLEXIBLE_ARRAY_MEMBER
];
/* Digits */
};
};
struct
NumericLong
struct
NumericLong
{
{
uint16
n_sign_dscale
;
/* Sign + display scale */
uint16
n_sign_dscale
;
/* Sign + display scale */
int16
n_weight
;
/* Weight of 1st digit */
int16
n_weight
;
/* Weight of 1st digit */
NumericDigit
n_data
[
1
];
/* Digits */
NumericDigit
n_data
[
FLEXIBLE_ARRAY_MEMBER
];
/* Digits */
};
};
union
NumericChoice
union
NumericChoice
...
...
src/backend/utils/adt/tsgistidx.c
View file @
2e211211
...
@@ -50,7 +50,7 @@ typedef struct
...
@@ -50,7 +50,7 @@ typedef struct
{
{
int32
vl_len_
;
/* varlena header (do not touch directly!) */
int32
vl_len_
;
/* varlena header (do not touch directly!) */
int32
flag
;
int32
flag
;
char
data
[
1
];
char
data
[
FLEXIBLE_ARRAY_MEMBER
];
}
SignTSVector
;
}
SignTSVector
;
#define ARRKEY 0x01
#define ARRKEY 0x01
...
...
src/backend/utils/adt/tsvector_op.c
View file @
2e211211
...
@@ -44,7 +44,7 @@ typedef struct StatEntry
...
@@ -44,7 +44,7 @@ typedef struct StatEntry
struct
StatEntry
*
left
;
struct
StatEntry
*
left
;
struct
StatEntry
*
right
;
struct
StatEntry
*
right
;
uint32
lenlexeme
;
uint32
lenlexeme
;
char
lexeme
[
1
];
char
lexeme
[
FLEXIBLE_ARRAY_MEMBER
];
}
StatEntry
;
}
StatEntry
;
#define STATENTRYHDRSZ (offsetof(StatEntry, lexeme))
#define STATENTRYHDRSZ (offsetof(StatEntry, lexeme))
...
...
src/backend/utils/adt/txid.c
View file @
2e211211
...
@@ -64,7 +64,8 @@ typedef struct
...
@@ -64,7 +64,8 @@ typedef struct
uint32
nxip
;
/* number of txids in xip array */
uint32
nxip
;
/* number of txids in xip array */
txid
xmin
;
txid
xmin
;
txid
xmax
;
txid
xmax
;
txid
xip
[
1
];
/* in-progress txids, xmin <= xip[i] < xmax */
/* in-progress txids, xmin <= xip[i] < xmax: */
txid
xip
[
FLEXIBLE_ARRAY_MEMBER
];
}
TxidSnapshot
;
}
TxidSnapshot
;
#define TXID_SNAPSHOT_SIZE(nxip) \
#define TXID_SNAPSHOT_SIZE(nxip) \
...
...
src/backend/utils/fmgr/dfmgr.c
View file @
2e211211
...
@@ -51,12 +51,7 @@ typedef struct df_files
...
@@ -51,12 +51,7 @@ typedef struct df_files
ino_t
inode
;
/* Inode number of file */
ino_t
inode
;
/* Inode number of file */
#endif
#endif
void
*
handle
;
/* a handle for pg_dl* functions */
void
*
handle
;
/* a handle for pg_dl* functions */
char
filename
[
1
];
/* Full pathname of file */
char
filename
[
FLEXIBLE_ARRAY_MEMBER
];
/* Full pathname of file */
/*
* we allocate the block big enough for actual length of pathname.
* filename[] must be last item in struct!
*/
}
DynamicFileList
;
}
DynamicFileList
;
static
DynamicFileList
*
file_list
=
NULL
;
static
DynamicFileList
*
file_list
=
NULL
;
...
@@ -217,13 +212,13 @@ internal_load_library(const char *libname)
...
@@ -217,13 +212,13 @@ internal_load_library(const char *libname)
* File not loaded yet.
* File not loaded yet.
*/
*/
file_scanner
=
(
DynamicFileList
*
)
file_scanner
=
(
DynamicFileList
*
)
malloc
(
sizeof
(
DynamicFileList
)
+
strlen
(
libname
)
);
malloc
(
offsetof
(
DynamicFileList
,
filename
)
+
strlen
(
libname
)
+
1
);
if
(
file_scanner
==
NULL
)
if
(
file_scanner
==
NULL
)
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_OUT_OF_MEMORY
),
(
errcode
(
ERRCODE_OUT_OF_MEMORY
),
errmsg
(
"out of memory"
)));
errmsg
(
"out of memory"
)));
MemSet
(
file_scanner
,
0
,
sizeof
(
DynamicFileList
));
MemSet
(
file_scanner
,
0
,
offsetof
(
DynamicFileList
,
filename
));
strcpy
(
file_scanner
->
filename
,
libname
);
strcpy
(
file_scanner
->
filename
,
libname
);
file_scanner
->
device
=
stat_buf
.
st_dev
;
file_scanner
->
device
=
stat_buf
.
st_dev
;
#ifndef WIN32
#ifndef WIN32
...
...
src/backend/utils/sort/logtape.c
View file @
2e211211
...
@@ -166,12 +166,9 @@ struct LogicalTapeSet
...
@@ -166,12 +166,9 @@ struct LogicalTapeSet
int
nFreeBlocks
;
/* # of currently free blocks */
int
nFreeBlocks
;
/* # of currently free blocks */
int
freeBlocksLen
;
/* current allocated length of freeBlocks[] */
int
freeBlocksLen
;
/* current allocated length of freeBlocks[] */
/*
/* The array of logical tapes. */
* tapes[] is declared size 1 since C wants a fixed size, but actually it
* is of length nTapes.
*/
int
nTapes
;
/* # of logical tapes in set */
int
nTapes
;
/* # of logical tapes in set */
LogicalTape
tapes
[
1
];
/* must be last in struct!
*/
LogicalTape
tapes
[
FLEXIBLE_ARRAY_MEMBER
];
/* has nTapes nentries
*/
};
};
static
void
ltsWriteBlock
(
LogicalTapeSet
*
lts
,
long
blocknum
,
void
*
buffer
);
static
void
ltsWriteBlock
(
LogicalTapeSet
*
lts
,
long
blocknum
,
void
*
buffer
);
...
@@ -519,12 +516,11 @@ LogicalTapeSetCreate(int ntapes)
...
@@ -519,12 +516,11 @@ LogicalTapeSetCreate(int ntapes)
int
i
;
int
i
;
/*
/*
* Create top-level struct including per-tape LogicalTape structs. First
* Create top-level struct including per-tape LogicalTape structs.
* LogicalTape struct is already counted in sizeof(LogicalTapeSet).
*/
*/
Assert
(
ntapes
>
0
);
Assert
(
ntapes
>
0
);
lts
=
(
LogicalTapeSet
*
)
palloc
(
sizeof
(
LogicalTapeSet
)
+
lts
=
(
LogicalTapeSet
*
)
palloc
(
offsetof
(
LogicalTapeSet
,
tapes
)
+
(
ntapes
-
1
)
*
sizeof
(
LogicalTape
));
ntapes
*
sizeof
(
LogicalTape
));
lts
->
pfile
=
BufFileCreateTemp
(
false
);
lts
->
pfile
=
BufFileCreateTemp
(
false
);
lts
->
nFileBlocks
=
0L
;
lts
->
nFileBlocks
=
0L
;
lts
->
forgetFreeSpace
=
false
;
lts
->
forgetFreeSpace
=
false
;
...
...
src/interfaces/ecpg/ecpglib/extern.h
View file @
2e211211
...
@@ -33,7 +33,7 @@ enum ARRAY_TYPE
...
@@ -33,7 +33,7 @@ enum ARRAY_TYPE
struct
ECPGgeneric_varchar
struct
ECPGgeneric_varchar
{
{
int
len
;
int
len
;
char
arr
[
1
];
char
arr
[
FLEXIBLE_ARRAY_MEMBER
];
};
};
/*
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment