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
86d78021
Commit
86d78021
authored
Aug 21, 2004
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Whack btree_gist code around until it has some small hope of building
on non-gcc compilers.
parent
bf9d9bd2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
41 deletions
+41
-41
contrib/btree_gist/btree_text.c
contrib/btree_gist/btree_text.c
+8
-4
contrib/btree_gist/btree_utils_num.c
contrib/btree_gist/btree_utils_num.c
+9
-12
contrib/btree_gist/btree_utils_var.c
contrib/btree_gist/btree_utils_var.c
+24
-25
No files found.
contrib/btree_gist/btree_text.c
View file @
86d78021
...
...
@@ -65,13 +65,15 @@ static bytea *
gbt_text_xfrm
(
bytea
*
leaf
)
{
bytea
*
out
=
leaf
;
int32
ilen
=
VARSIZE
(
leaf
)
-
VARHDRSZ
;
int32
olen
;
char
sin
[
ilen
+
1
];
char
*
sou
=
NULL
;
memcpy
(
(
void
*
)
&
sin
[
0
],
(
void
*
)
VARDATA
(
leaf
)
,
ilen
);
char
*
sin
;
char
*
sou
;
sin
=
palloc
(
ilen
+
1
);
memcpy
(
sin
,
(
void
*
)
VARDATA
(
leaf
)
,
ilen
);
sin
[
ilen
]
=
'\0'
;
olen
=
strxfrm
(
NULL
,
&
sin
[
0
],
0
)
+
1
;
sou
=
palloc
(
olen
);
olen
=
strxfrm
(
sou
,
&
sin
[
0
]
,
olen
);
...
...
@@ -80,7 +82,9 @@ gbt_text_xfrm ( bytea * leaf )
out
->
vl_len
=
olen
+
1
;
memcpy
(
(
void
*
)
VARDATA
(
out
),
sou
,
olen
-
VARHDRSZ
);
((
char
*
)
out
)[
olen
]
=
'\0'
;
pfree
(
sou
);
pfree
(
sin
);
return
out
;
}
...
...
contrib/btree_gist/btree_utils_num.c
View file @
86d78021
...
...
@@ -200,19 +200,16 @@ gbt_num_consistent(
}
GIST_SPLITVEC
*
gbt_num_picksplit
(
const
GistEntryVector
*
entryvec
,
GIST_SPLITVEC
*
v
,
const
gbtree_ninfo
*
tinfo
)
gbt_num_picksplit
(
const
GistEntryVector
*
entryvec
,
GIST_SPLITVEC
*
v
,
const
gbtree_ninfo
*
tinfo
)
{
OffsetNumber
i
,
maxoff
=
entryvec
->
n
-
1
;
Nsrt
*
arr
;
int
nbytes
;
OffsetNumber
i
,
maxoff
=
entryvec
->
n
-
1
;
Nsrt
arr
[
maxoff
+
1
]
;
int
nbytes
;
arr
=
(
Nsrt
*
)
palloc
((
maxoff
+
1
)
*
sizeof
(
Nsrt
));
nbytes
=
(
maxoff
+
2
)
*
sizeof
(
OffsetNumber
);
v
->
spl_left
=
(
OffsetNumber
*
)
palloc
(
nbytes
);
v
->
spl_right
=
(
OffsetNumber
*
)
palloc
(
nbytes
);
...
...
@@ -248,7 +245,7 @@ gbt_num_picksplit( const GistEntryVector *entryvec, GIST_SPLITVEC *v, const gbtr
}
}
return
v
;
pfree
(
arr
)
;
return
v
;
}
contrib/btree_gist/btree_utils_var.c
View file @
86d78021
...
...
@@ -416,36 +416,35 @@ gbt_var_penalty ( float * res , const GISTENTRY * o , const GISTENTRY * n, const
}
static
int32
gbt_vsrt_cmp
(
const
Vsrt
*
a
,
const
Vsrt
*
b
,
const
gbtree_vinfo
*
tinfo
)
{
GBT_VARKEY_R
ar
=
gbt_var_key_readable
(
a
->
t
);
GBT_VARKEY_R
br
=
gbt_var_key_readable
(
b
->
t
);
return
(
*
tinfo
->
f_cmp
)
(
ar
.
lower
,
br
.
lower
);
}
/*
* Fortunately, this sort comparsion routine needn't be reentrant...
*/
static
const
gbtree_vinfo
*
gbt_vsrt_cmp_tinfo
;
static
int
gbt_vsrt_cmp
(
const
void
*
a
,
const
void
*
b
)
{
GBT_VARKEY_R
ar
=
gbt_var_key_readable
(
((
const
Vsrt
*
)
a
)
->
t
);
GBT_VARKEY_R
br
=
gbt_var_key_readable
(
((
const
Vsrt
*
)
b
)
->
t
);
return
(
*
gbt_vsrt_cmp_tinfo
->
f_cmp
)
(
ar
.
lower
,
br
.
lower
);
}
extern
GIST_SPLITVEC
*
gbt_var_picksplit
(
const
GistEntryVector
*
entryvec
,
GIST_SPLITVEC
*
v
,
const
gbtree_vinfo
*
tinfo
)
{
OffsetNumber
i
,
maxoff
=
entryvec
->
n
-
1
;
Vsrt
arr
[
maxoff
+
1
]
;
OffsetNumber
i
,
maxoff
=
entryvec
->
n
-
1
;
Vsrt
*
arr
;
int
pfrcntr
=
0
,
svcntr
=
0
,
nbytes
;
char
*
tst
,
*
cur
;
char
**
pfr
=
NULL
;
GBT_VARKEY
**
sv
=
NULL
;
static
int
cmp
(
const
void
*
a
,
const
void
*
b
){
return
gbt_vsrt_cmp
((
Vsrt
*
)
a
,
(
Vsrt
*
)
b
,
tinfo
);
}
arr
=
(
Vsrt
*
)
palloc
((
maxoff
+
1
)
*
sizeof
(
Vsrt
));
nbytes
=
(
maxoff
+
2
)
*
sizeof
(
OffsetNumber
);
v
->
spl_left
=
(
OffsetNumber
*
)
palloc
(
nbytes
);
v
->
spl_right
=
(
OffsetNumber
*
)
palloc
(
nbytes
);
...
...
@@ -482,8 +481,11 @@ gbt_var_picksplit( const GistEntryVector *entryvec, GIST_SPLITVEC *v, const gbtr
}
/* sort */
qsort
(
(
void
*
)
&
arr
[
FirstOffsetNumber
],
maxoff
-
FirstOffsetNumber
+
1
,
sizeof
(
Vsrt
),
cmp
);
gbt_vsrt_cmp_tinfo
=
tinfo
;
qsort
((
void
*
)
&
arr
[
FirstOffsetNumber
],
maxoff
-
FirstOffsetNumber
+
1
,
sizeof
(
Vsrt
),
gbt_vsrt_cmp
);
/* We do simply create two parts */
...
...
@@ -545,18 +547,15 @@ gbt_var_picksplit( const GistEntryVector *entryvec, GIST_SPLITVEC *v, const gbtr
}
return
v
;
pfree
(
arr
)
;
return
v
;
}
/*
** The GiST consistent method
*/
* The GiST consistent method
*/
extern
bool
gbt_var_consistent
(
GBT_VARKEY_R
*
key
,
...
...
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