Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit05ace73

Browse files
committed
Change the float4-returning functions in contrib/seg to fmgr v1 calling
conventions.I also changed seg_in and seg_out, which was probably unnecessary, butit can't harm.
1 parent41de1d1 commit05ace73

File tree

1 file changed

+34
-23
lines changed

1 file changed

+34
-23
lines changed

‎contrib/seg/seg.c

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,17 @@ extern int seg_yydebug;
3333
/*
3434
** Input/Output routines
3535
*/
36-
SEG*seg_in(char*str);
37-
char*seg_out(SEG*seg);
38-
float4seg_lower(SEG*seg);
39-
float4seg_upper(SEG*seg);
40-
float4seg_center(SEG*seg);
36+
PG_FUNCTION_INFO_V1(seg_in);
37+
PG_FUNCTION_INFO_V1(seg_out);
38+
PG_FUNCTION_INFO_V1(seg_lower);
39+
PG_FUNCTION_INFO_V1(seg_upper);
40+
PG_FUNCTION_INFO_V1(seg_center);
41+
42+
Datumseg_in(PG_FUNCTION_ARGS);
43+
Datumseg_out(PG_FUNCTION_ARGS);
44+
Datumseg_lower(PG_FUNCTION_ARGS);
45+
Datumseg_upper(PG_FUNCTION_ARGS);
46+
Datumseg_center(PG_FUNCTION_ARGS);
4147

4248
/*
4349
** GiST support methods
@@ -98,9 +104,10 @@ intsignificant_digits(char *s);
98104
* Input/Output functions
99105
*****************************************************************************/
100106

101-
SEG*
102-
seg_in(char*str)
107+
Datum
108+
seg_in(PG_FUNCTION_ARGS)
103109
{
110+
char*str=PG_GETARG_CSTRING(0);
104111
SEG*result=palloc(sizeof(SEG));
105112

106113
seg_scanner_init(str);
@@ -110,18 +117,16 @@ seg_in(char *str)
110117

111118
seg_scanner_finish();
112119

113-
return(result);
120+
PG_RETURN_POINTER(result);
114121
}
115122

116-
char*
117-
seg_out(SEG*seg)
123+
Datum
124+
seg_out(PG_FUNCTION_ARGS)
118125
{
126+
SEG*seg= (SEG*)PG_GETARG_POINTER(0);
119127
char*result;
120128
char*p;
121129

122-
if (seg==NULL)
123-
return (NULL);
124-
125130
p=result= (char*)palloc(40);
126131

127132
if (seg->l_ext=='>'||seg->l_ext=='<'||seg->l_ext=='~')
@@ -153,25 +158,31 @@ seg_out(SEG * seg)
153158
}
154159
}
155160

156-
return(result);
161+
PG_RETURN_CSTRING(result);
157162
}
158163

159-
float4
160-
seg_center(SEG*seg)
164+
Datum
165+
seg_center(PG_FUNCTION_ARGS)
161166
{
162-
return ((float)seg->lower+ (float)seg->upper) /2.0;
167+
SEG*seg= (SEG*)PG_GETARG_POINTER(0);
168+
169+
PG_RETURN_FLOAT4(((float)seg->lower+ (float)seg->upper) /2.0);
163170
}
164171

165-
float4
166-
seg_lower(SEG*seg)
172+
Datum
173+
seg_lower(PG_FUNCTION_ARGS)
167174
{
168-
returnseg->lower;
175+
SEG*seg= (SEG*)PG_GETARG_POINTER(0);
176+
177+
PG_RETURN_FLOAT4(seg->lower);
169178
}
170179

171-
float4
172-
seg_upper(SEG*seg)
180+
Datum
181+
seg_upper(PG_FUNCTION_ARGS)
173182
{
174-
returnseg->upper;
183+
SEG*seg= (SEG*)PG_GETARG_POINTER(0);
184+
185+
PG_RETURN_FLOAT4(seg->upper);
175186
}
176187

177188

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp