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
ccd415c6
Commit
ccd415c6
authored
Mar 25, 2001
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix unportable assumptions about alignment of local char[n] variables.
parent
571dbe46
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
53 deletions
+82
-53
src/backend/access/heap/heapam.c
src/backend/access/heap/heapam.c
+58
-29
src/backend/commands/vacuum.c
src/backend/commands/vacuum.c
+9
-9
src/backend/storage/large_object/inv_api.c
src/backend/storage/large_object/inv_api.c
+10
-7
src/backend/utils/mb/wstrncmp.c
src/backend/utils/mb/wstrncmp.c
+5
-8
No files found.
src/backend/access/heap/heapam.c
View file @
ccd415c6
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.11
2 2001/03/22 06:16:07 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.11
3 2001/03/25 23:23:58 tgl
Exp $
*
*
*
*
* INTERFACE ROUTINES
* INTERFACE ROUTINES
...
@@ -2126,10 +2126,19 @@ static XLogRecPtr
...
@@ -2126,10 +2126,19 @@ static XLogRecPtr
log_heap_update
(
Relation
reln
,
Buffer
oldbuf
,
ItemPointerData
from
,
log_heap_update
(
Relation
reln
,
Buffer
oldbuf
,
ItemPointerData
from
,
Buffer
newbuf
,
HeapTuple
newtup
,
bool
move
)
Buffer
newbuf
,
HeapTuple
newtup
,
bool
move
)
{
{
char
tbuf
[
MAXALIGN
(
sizeof
(
xl_heap_header
))
+
2
*
sizeof
(
TransactionId
)];
/*
xl_heap_update
xlrec
;
* Note: xlhdr is declared to have adequate size and correct alignment
xl_heap_header
*
xlhdr
=
(
xl_heap_header
*
)
tbuf
;
* for an xl_heap_header. However the two tids, if present at all,
* will be packed in with no wasted space after the xl_heap_header;
* they aren't necessarily aligned as implied by this struct declaration.
*/
struct
{
xl_heap_header
hdr
;
TransactionId
tid1
;
TransactionId
tid2
;
}
xlhdr
;
int
hsize
=
SizeOfHeapHeader
;
int
hsize
=
SizeOfHeapHeader
;
xl_heap_update
xlrec
;
XLogRecPtr
recptr
;
XLogRecPtr
recptr
;
XLogRecData
rdata
[
4
];
XLogRecData
rdata
[
4
];
Page
page
=
BufferGetPage
(
newbuf
);
Page
page
=
BufferGetPage
(
newbuf
);
...
@@ -2148,10 +2157,10 @@ log_heap_update(Relation reln, Buffer oldbuf, ItemPointerData from,
...
@@ -2148,10 +2157,10 @@ log_heap_update(Relation reln, Buffer oldbuf, ItemPointerData from,
rdata
[
1
].
len
=
0
;
rdata
[
1
].
len
=
0
;
rdata
[
1
].
next
=
&
(
rdata
[
2
]);
rdata
[
1
].
next
=
&
(
rdata
[
2
]);
xlhdr
->
t_oid
=
newtup
->
t_data
->
t_oid
;
xlhdr
.
hdr
.
t_oid
=
newtup
->
t_data
->
t_oid
;
xlhdr
->
t_natts
=
newtup
->
t_data
->
t_natts
;
xlhdr
.
hdr
.
t_natts
=
newtup
->
t_data
->
t_natts
;
xlhdr
->
t_hoff
=
newtup
->
t_data
->
t_hoff
;
xlhdr
.
hdr
.
t_hoff
=
newtup
->
t_data
->
t_hoff
;
xlhdr
->
mask
=
newtup
->
t_data
->
t_infomask
;
xlhdr
.
hdr
.
mask
=
newtup
->
t_data
->
t_infomask
;
if
(
move
)
/* remember xmin & xmax */
if
(
move
)
/* remember xmin & xmax */
{
{
TransactionId
xmax
;
TransactionId
xmax
;
...
@@ -2161,13 +2170,13 @@ log_heap_update(Relation reln, Buffer oldbuf, ItemPointerData from,
...
@@ -2161,13 +2170,13 @@ log_heap_update(Relation reln, Buffer oldbuf, ItemPointerData from,
xmax
=
InvalidTransactionId
;
xmax
=
InvalidTransactionId
;
else
else
xmax
=
newtup
->
t_data
->
t_xmax
;
xmax
=
newtup
->
t_data
->
t_xmax
;
memcpy
(
tbuf
+
hsize
,
&
xmax
,
sizeof
(
TransactionId
));
memcpy
(
(
char
*
)
&
xlhdr
+
hsize
,
&
xmax
,
sizeof
(
TransactionId
));
memcpy
(
tbuf
+
hsize
+
sizeof
(
TransactionId
),
memcpy
(
(
char
*
)
&
xlhdr
+
hsize
+
sizeof
(
TransactionId
),
&
(
newtup
->
t_data
->
t_xmin
),
sizeof
(
TransactionId
));
&
(
newtup
->
t_data
->
t_xmin
),
sizeof
(
TransactionId
));
hsize
+=
(
2
*
sizeof
(
TransactionId
)
);
hsize
+=
2
*
sizeof
(
TransactionId
);
}
}
rdata
[
2
].
buffer
=
newbuf
;
rdata
[
2
].
buffer
=
newbuf
;
rdata
[
2
].
data
=
(
char
*
)
xlhdr
;
rdata
[
2
].
data
=
(
char
*
)
&
xlhdr
;
rdata
[
2
].
len
=
hsize
;
rdata
[
2
].
len
=
hsize
;
rdata
[
2
].
next
=
&
(
rdata
[
3
]);
rdata
[
2
].
next
=
&
(
rdata
[
3
]);
...
@@ -2228,13 +2237,16 @@ heap_xlog_clean(bool redo, XLogRecPtr lsn, XLogRecord *record)
...
@@ -2228,13 +2237,16 @@ heap_xlog_clean(bool redo, XLogRecPtr lsn, XLogRecord *record)
if
(
record
->
xl_len
>
SizeOfHeapClean
)
if
(
record
->
xl_len
>
SizeOfHeapClean
)
{
{
char
unbuf
[
BLCKSZ
];
OffsetNumber
unbuf
[
BLCKSZ
/
sizeof
(
OffsetNumber
)
];
OffsetNumber
*
unused
=
(
OffsetNumber
*
)
unbuf
;
OffsetNumber
*
unused
=
unbuf
;
char
*
unend
;
char
*
unend
;
ItemId
lp
;
ItemId
lp
;
memcpy
(
unbuf
,
(
char
*
)
xlrec
+
SizeOfHeapClean
,
record
->
xl_len
-
SizeOfHeapClean
);
Assert
((
record
->
xl_len
-
SizeOfHeapClean
)
<=
BLCKSZ
);
unend
=
unbuf
+
(
record
->
xl_len
-
SizeOfHeapClean
);
memcpy
((
char
*
)
unbuf
,
(
char
*
)
xlrec
+
SizeOfHeapClean
,
record
->
xl_len
-
SizeOfHeapClean
);
unend
=
(
char
*
)
unbuf
+
(
record
->
xl_len
-
SizeOfHeapClean
);
while
((
char
*
)
unused
<
unend
)
while
((
char
*
)
unused
<
unend
)
{
{
...
@@ -2318,7 +2330,6 @@ heap_xlog_insert(bool redo, XLogRecPtr lsn, XLogRecord *record)
...
@@ -2318,7 +2330,6 @@ heap_xlog_insert(bool redo, XLogRecPtr lsn, XLogRecord *record)
Buffer
buffer
;
Buffer
buffer
;
Page
page
;
Page
page
;
OffsetNumber
offnum
;
OffsetNumber
offnum
;
HeapTupleHeader
htup
;
if
(
redo
&&
(
record
->
xl_info
&
XLR_BKP_BLOCK_1
))
if
(
redo
&&
(
record
->
xl_info
&
XLR_BKP_BLOCK_1
))
return
;
return
;
...
@@ -2338,7 +2349,11 @@ heap_xlog_insert(bool redo, XLogRecPtr lsn, XLogRecord *record)
...
@@ -2338,7 +2349,11 @@ heap_xlog_insert(bool redo, XLogRecPtr lsn, XLogRecord *record)
if
(
redo
)
if
(
redo
)
{
{
char
tbuf
[
MaxTupleSize
];
struct
{
HeapTupleHeaderData
hdr
;
char
data
[
MaxTupleSize
];
}
tbuf
;
HeapTupleHeader
htup
;
xl_heap_header
xlhdr
;
xl_heap_header
xlhdr
;
uint32
newlen
;
uint32
newlen
;
...
@@ -2359,11 +2374,15 @@ heap_xlog_insert(bool redo, XLogRecPtr lsn, XLogRecord *record)
...
@@ -2359,11 +2374,15 @@ heap_xlog_insert(bool redo, XLogRecPtr lsn, XLogRecord *record)
elog
(
STOP
,
"heap_insert_redo: invalid max offset number"
);
elog
(
STOP
,
"heap_insert_redo: invalid max offset number"
);
newlen
=
record
->
xl_len
-
SizeOfHeapInsert
-
SizeOfHeapHeader
;
newlen
=
record
->
xl_len
-
SizeOfHeapInsert
-
SizeOfHeapHeader
;
memcpy
((
char
*
)
&
xlhdr
,
(
char
*
)
xlrec
+
SizeOfHeapInsert
,
SizeOfHeapHeader
);
Assert
(
newlen
<=
MaxTupleSize
);
memcpy
(
tbuf
+
offsetof
(
HeapTupleHeaderData
,
t_bits
),
memcpy
((
char
*
)
&
xlhdr
,
(
char
*
)
xlrec
+
SizeOfHeapInsert
+
SizeOfHeapHeader
,
newlen
);
(
char
*
)
xlrec
+
SizeOfHeapInsert
,
SizeOfHeapHeader
);
memcpy
((
char
*
)
&
tbuf
+
offsetof
(
HeapTupleHeaderData
,
t_bits
),
(
char
*
)
xlrec
+
SizeOfHeapInsert
+
SizeOfHeapHeader
,
newlen
);
newlen
+=
offsetof
(
HeapTupleHeaderData
,
t_bits
);
newlen
+=
offsetof
(
HeapTupleHeaderData
,
t_bits
);
htup
=
(
HeapTupleHeader
)
tbuf
;
htup
=
&
tbuf
.
hdr
;
htup
->
t_oid
=
xlhdr
.
t_oid
;
htup
->
t_oid
=
xlhdr
.
t_oid
;
htup
->
t_natts
=
xlhdr
.
t_natts
;
htup
->
t_natts
=
xlhdr
.
t_natts
;
htup
->
t_hoff
=
xlhdr
.
t_hoff
;
htup
->
t_hoff
=
xlhdr
.
t_hoff
;
...
@@ -2496,7 +2515,10 @@ newsame:;
...
@@ -2496,7 +2515,10 @@ newsame:;
if
(
redo
)
if
(
redo
)
{
{
char
tbuf
[
MaxTupleSize
];
struct
{
HeapTupleHeaderData
hdr
;
char
data
[
MaxTupleSize
];
}
tbuf
;
xl_heap_header
xlhdr
;
xl_heap_header
xlhdr
;
int
hsize
;
int
hsize
;
uint32
newlen
;
uint32
newlen
;
...
@@ -2522,20 +2544,27 @@ newsame:;
...
@@ -2522,20 +2544,27 @@ newsame:;
hsize
+=
(
2
*
sizeof
(
TransactionId
));
hsize
+=
(
2
*
sizeof
(
TransactionId
));
newlen
=
record
->
xl_len
-
hsize
;
newlen
=
record
->
xl_len
-
hsize
;
memcpy
((
char
*
)
&
xlhdr
,
(
char
*
)
xlrec
+
SizeOfHeapUpdate
,
SizeOfHeapHeader
);
Assert
(
newlen
<=
MaxTupleSize
);
memcpy
(
tbuf
+
offsetof
(
HeapTupleHeaderData
,
t_bits
),
memcpy
((
char
*
)
&
xlhdr
,
(
char
*
)
xlrec
+
hsize
,
newlen
);
(
char
*
)
xlrec
+
SizeOfHeapUpdate
,
SizeOfHeapHeader
);
memcpy
((
char
*
)
&
tbuf
+
offsetof
(
HeapTupleHeaderData
,
t_bits
),
(
char
*
)
xlrec
+
hsize
,
newlen
);
newlen
+=
offsetof
(
HeapTupleHeaderData
,
t_bits
);
newlen
+=
offsetof
(
HeapTupleHeaderData
,
t_bits
);
htup
=
(
HeapTupleHeader
)
tbuf
;
htup
=
&
tbuf
.
hdr
;
htup
->
t_oid
=
xlhdr
.
t_oid
;
htup
->
t_oid
=
xlhdr
.
t_oid
;
htup
->
t_natts
=
xlhdr
.
t_natts
;
htup
->
t_natts
=
xlhdr
.
t_natts
;
htup
->
t_hoff
=
xlhdr
.
t_hoff
;
htup
->
t_hoff
=
xlhdr
.
t_hoff
;
if
(
move
)
if
(
move
)
{
{
hsize
=
SizeOfHeapUpdate
+
SizeOfHeapHeader
;
hsize
=
SizeOfHeapUpdate
+
SizeOfHeapHeader
;
memcpy
(
&
(
htup
->
t_xmax
),
(
char
*
)
xlrec
+
hsize
,
sizeof
(
TransactionId
));
memcpy
(
&
(
htup
->
t_xmax
),
(
char
*
)
xlrec
+
hsize
,
sizeof
(
TransactionId
));
memcpy
(
&
(
htup
->
t_xmin
),
memcpy
(
&
(
htup
->
t_xmin
),
(
char
*
)
xlrec
+
hsize
+
sizeof
(
TransactionId
),
sizeof
(
TransactionId
));
(
char
*
)
xlrec
+
hsize
+
sizeof
(
TransactionId
),
sizeof
(
TransactionId
));
TransactionIdStore
(
record
->
xl_xid
,
(
TransactionId
*
)
&
(
htup
->
t_cmin
));
TransactionIdStore
(
record
->
xl_xid
,
(
TransactionId
*
)
&
(
htup
->
t_cmin
));
htup
->
t_infomask
=
xlhdr
.
mask
;
htup
->
t_infomask
=
xlhdr
.
mask
;
htup
->
t_infomask
&=
~
(
HEAP_XMIN_COMMITTED
|
htup
->
t_infomask
&=
~
(
HEAP_XMIN_COMMITTED
|
...
...
src/backend/commands/vacuum.c
View file @
ccd415c6
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.18
8 2001/03/22 03:59:24 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.18
9 2001/03/25 23:23:58 tgl
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -303,10 +303,9 @@ getrels(NameData *VacRelP)
...
@@ -303,10 +303,9 @@ getrels(NameData *VacRelP)
found
=
true
;
found
=
true
;
d
=
heap_getattr
(
tuple
,
Anum_pg_class_relname
,
tupdesc
,
&
n
);
d
=
heap_getattr
(
tuple
,
Anum_pg_class_relname
,
tupdesc
,
&
n
);
rname
=
(
char
*
)
d
;
rname
=
(
char
*
)
DatumGetPointer
(
d
)
;
d
=
heap_getattr
(
tuple
,
Anum_pg_class_relkind
,
tupdesc
,
&
n
);
d
=
heap_getattr
(
tuple
,
Anum_pg_class_relkind
,
tupdesc
,
&
n
);
rkind
=
DatumGetChar
(
d
);
rkind
=
DatumGetChar
(
d
);
if
(
rkind
!=
RELKIND_RELATION
)
if
(
rkind
!=
RELKIND_RELATION
)
...
@@ -997,8 +996,8 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
...
@@ -997,8 +996,8 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
blkno
;
blkno
;
Page
page
,
Page
page
,
ToPage
=
NULL
;
ToPage
=
NULL
;
OffsetNumber
offnum
=
0
,
OffsetNumber
offnum
,
maxoff
=
0
,
maxoff
,
newoff
,
newoff
,
max_offset
;
max_offset
;
ItemId
itemid
,
ItemId
itemid
,
...
@@ -1913,14 +1912,15 @@ failed to add item with len = %lu to page %u (free space %lu, nusd %u, noff %u)"
...
@@ -1913,14 +1912,15 @@ failed to add item with len = %lu to page %u (free space %lu, nusd %u, noff %u)"
if
(
vacpage
->
blkno
==
(
BlockNumber
)
(
blkno
-
1
)
&&
if
(
vacpage
->
blkno
==
(
BlockNumber
)
(
blkno
-
1
)
&&
vacpage
->
offsets_free
>
0
)
vacpage
->
offsets_free
>
0
)
{
{
char
unbuf
[
BLCKSZ
];
OffsetNumber
unbuf
[
BLCKSZ
/
sizeof
(
OffsetNumber
)
];
OffsetNumber
*
unused
=
(
OffsetNumber
*
)
unbuf
;
OffsetNumber
*
unused
=
unbuf
;
int
uncnt
;
int
uncnt
;
buf
=
ReadBuffer
(
onerel
,
vacpage
->
blkno
);
buf
=
ReadBuffer
(
onerel
,
vacpage
->
blkno
);
LockBuffer
(
buf
,
BUFFER_LOCK_EXCLUSIVE
);
LockBuffer
(
buf
,
BUFFER_LOCK_EXCLUSIVE
);
page
=
BufferGetPage
(
buf
);
page
=
BufferGetPage
(
buf
);
num_tuples
=
0
;
num_tuples
=
0
;
maxoff
=
PageGetMaxOffsetNumber
(
page
);
for
(
offnum
=
FirstOffsetNumber
;
for
(
offnum
=
FirstOffsetNumber
;
offnum
<=
maxoff
;
offnum
<=
maxoff
;
offnum
=
OffsetNumberNext
(
offnum
))
offnum
=
OffsetNumberNext
(
offnum
))
...
@@ -2061,8 +2061,8 @@ vacuum_heap(VRelStats *vacrelstats, Relation onerel, VacPageList vacuum_pages)
...
@@ -2061,8 +2061,8 @@ vacuum_heap(VRelStats *vacrelstats, Relation onerel, VacPageList vacuum_pages)
static
void
static
void
vacuum_page
(
Relation
onerel
,
Buffer
buffer
,
VacPage
vacpage
)
vacuum_page
(
Relation
onerel
,
Buffer
buffer
,
VacPage
vacpage
)
{
{
char
unbuf
[
BLCKSZ
];
OffsetNumber
unbuf
[
BLCKSZ
/
sizeof
(
OffsetNumber
)
];
OffsetNumber
*
unused
=
(
OffsetNumber
*
)
unbuf
;
OffsetNumber
*
unused
=
unbuf
;
int
uncnt
;
int
uncnt
;
Page
page
=
BufferGetPage
(
buffer
);
Page
page
=
BufferGetPage
(
buffer
);
ItemId
itemid
;
ItemId
itemid
;
...
...
src/backend/storage/large_object/inv_api.c
View file @
ccd415c6
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.8
6 2001/03/22 03:59:45 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.8
7 2001/03/25 23:23:59 tgl
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -416,8 +416,11 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
...
@@ -416,8 +416,11 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
bool
neednextpage
;
bool
neednextpage
;
bytea
*
datafield
;
bytea
*
datafield
;
bool
pfreeit
;
bool
pfreeit
;
char
workbuf
[
LOBLKSIZE
+
VARHDRSZ
];
struct
{
char
*
workb
=
VARATT_DATA
(
workbuf
);
struct
varlena
hdr
;
char
data
[
LOBLKSIZE
];
}
workbuf
;
char
*
workb
=
VARATT_DATA
(
&
workbuf
.
hdr
);
HeapTuple
newtup
;
HeapTuple
newtup
;
Datum
values
[
Natts_pg_largeobject
];
Datum
values
[
Natts_pg_largeobject
];
char
nulls
[
Natts_pg_largeobject
];
char
nulls
[
Natts_pg_largeobject
];
...
@@ -526,7 +529,7 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
...
@@ -526,7 +529,7 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
off
+=
n
;
off
+=
n
;
/* compute valid length of new page */
/* compute valid length of new page */
len
=
(
len
>=
off
)
?
len
:
off
;
len
=
(
len
>=
off
)
?
len
:
off
;
VARATT_SIZEP
(
workbuf
)
=
len
+
VARHDRSZ
;
VARATT_SIZEP
(
&
workbuf
.
hdr
)
=
len
+
VARHDRSZ
;
/*
/*
* Form and insert updated tuple
* Form and insert updated tuple
...
@@ -534,7 +537,7 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
...
@@ -534,7 +537,7 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
memset
(
values
,
0
,
sizeof
(
values
));
memset
(
values
,
0
,
sizeof
(
values
));
memset
(
nulls
,
' '
,
sizeof
(
nulls
));
memset
(
nulls
,
' '
,
sizeof
(
nulls
));
memset
(
replace
,
' '
,
sizeof
(
replace
));
memset
(
replace
,
' '
,
sizeof
(
replace
));
values
[
Anum_pg_largeobject_data
-
1
]
=
PointerGetDatum
(
workbuf
);
values
[
Anum_pg_largeobject_data
-
1
]
=
PointerGetDatum
(
&
workbuf
);
replace
[
Anum_pg_largeobject_data
-
1
]
=
'r'
;
replace
[
Anum_pg_largeobject_data
-
1
]
=
'r'
;
newtup
=
heap_modifytuple
(
&
oldtuple
,
obj_desc
->
heap_r
,
newtup
=
heap_modifytuple
(
&
oldtuple
,
obj_desc
->
heap_r
,
values
,
nulls
,
replace
);
values
,
nulls
,
replace
);
...
@@ -575,7 +578,7 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
...
@@ -575,7 +578,7 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
obj_desc
->
offset
+=
n
;
obj_desc
->
offset
+=
n
;
/* compute valid length of new page */
/* compute valid length of new page */
len
=
off
+
n
;
len
=
off
+
n
;
VARATT_SIZEP
(
workbuf
)
=
len
+
VARHDRSZ
;
VARATT_SIZEP
(
&
workbuf
.
hdr
)
=
len
+
VARHDRSZ
;
/*
/*
* Form and insert updated tuple
* Form and insert updated tuple
...
@@ -584,7 +587,7 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
...
@@ -584,7 +587,7 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
memset
(
nulls
,
' '
,
sizeof
(
nulls
));
memset
(
nulls
,
' '
,
sizeof
(
nulls
));
values
[
Anum_pg_largeobject_loid
-
1
]
=
ObjectIdGetDatum
(
obj_desc
->
id
);
values
[
Anum_pg_largeobject_loid
-
1
]
=
ObjectIdGetDatum
(
obj_desc
->
id
);
values
[
Anum_pg_largeobject_pageno
-
1
]
=
Int32GetDatum
(
pageno
);
values
[
Anum_pg_largeobject_pageno
-
1
]
=
Int32GetDatum
(
pageno
);
values
[
Anum_pg_largeobject_data
-
1
]
=
PointerGetDatum
(
workbuf
);
values
[
Anum_pg_largeobject_data
-
1
]
=
PointerGetDatum
(
&
workbuf
);
newtup
=
heap_formtuple
(
obj_desc
->
heap_r
->
rd_att
,
values
,
nulls
);
newtup
=
heap_formtuple
(
obj_desc
->
heap_r
->
rd_att
,
values
,
nulls
);
heap_insert
(
obj_desc
->
heap_r
,
newtup
);
heap_insert
(
obj_desc
->
heap_r
,
newtup
);
if
(
write_indices
)
if
(
write_indices
)
...
...
src/backend/utils/mb/wstrncmp.c
View file @
ccd415c6
...
@@ -43,14 +43,12 @@ register const pg_wchar *s1,
...
@@ -43,14 +43,12 @@ register const pg_wchar *s1,
*
s2
;
*
s2
;
register
size_t
n
;
register
size_t
n
;
{
{
if
(
n
==
0
)
if
(
n
==
0
)
return
0
;
return
0
;
do
do
{
{
if
(
*
s1
!=
*
s2
++
)
if
(
*
s1
!=
*
s2
++
)
return
(
*
(
const
pg_wchar
*
)
s1
-
return
(
*
s1
-
*
(
s2
-
1
));
*
(
const
pg_wchar
*
)
(
s2
-
1
));
if
(
*
s1
++
==
0
)
if
(
*
s1
++
==
0
)
break
;
break
;
}
while
(
--
n
!=
0
);
}
while
(
--
n
!=
0
);
...
@@ -63,14 +61,12 @@ register const char *s1;
...
@@ -63,14 +61,12 @@ register const char *s1;
register
const
pg_wchar
*
s2
;
register
const
pg_wchar
*
s2
;
register
size_t
n
;
register
size_t
n
;
{
{
if
(
n
==
0
)
if
(
n
==
0
)
return
0
;
return
0
;
do
do
{
{
if
((
pg_wchar
)
*
s1
!=
*
s2
++
)
if
((
pg_wchar
)
((
unsigned
char
)
*
s1
)
!=
*
s2
++
)
return
(
*
(
const
pg_wchar
*
)
s1
-
return
((
pg_wchar
)
((
unsigned
char
)
*
s1
)
-
*
(
s2
-
1
));
*
(
const
pg_wchar
*
)
(
s2
-
1
));
if
(
*
s1
++
==
0
)
if
(
*
s1
++
==
0
)
break
;
break
;
}
while
(
--
n
!=
0
);
}
while
(
--
n
!=
0
);
...
@@ -83,6 +79,7 @@ const pg_wchar *str;
...
@@ -83,6 +79,7 @@ const pg_wchar *str;
{
{
register
const
pg_wchar
*
s
;
register
const
pg_wchar
*
s
;
for
(
s
=
str
;
*
s
;
++
s
);
for
(
s
=
str
;
*
s
;
++
s
)
;
return
(
s
-
str
);
return
(
s
-
str
);
}
}
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