File tree 4 files changed +22
-3
lines changed
4 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ TESTS = init_test tables points euler circle line ellipse poly path box in
32
32
contains_ops contains_ops_compat bounding_box_gist gnomo healpix \
33
33
moc mocautocast epochprop
34
34
35
+ PG_CFLAGS += -DPGSPHERE_VERSION=$(PGSPHERE_VERSION )
36
+ PG_CPPFLAGS += -DPGSPHERE_VERSION=$(PGSPHERE_VERSION )
37
+
35
38
ifndef CXXFLAGS
36
39
# no support for CXXFLAGS in PGXS before v11
37
40
CXXFLAGS = -Wall -Wpointer-arith -Wendif-labels \
Original file line number Diff line number Diff line change 3
3
-- does not depend on contents of pg_sphere.sql.
4
4
--
5
5
CREATE EXTENSION pg_sphere;
6
+ select pg_sphere_version();
7
+ pg_sphere_version
8
+ -------------------
9
+ 1.2.1
10
+ (1 row)
11
+
Original file line number Diff line number Diff line change 3
3
-- does not depend on contents of pg_sphere.sql.
4
4
--
5
5
CREATE EXTENSION pg_sphere;
6
+
7
+ select pg_sphere_version();
Original file line number Diff line number Diff line change 1
1
#include "types.h"
2
2
3
+ #if !defined(PGSPHERE_VERSION )
4
+ #error "PGSPHERE_VERSION macro is not set"
5
+ #endif
6
+
7
+ #define PGSPHERE_STRINGIFY_INTERNAL (x ) #x
8
+ #define PGSPHERE_STRINGIFY (x ) PGSPHERE_STRINGIFY_INTERNAL(x)
9
+
3
10
/* Output functions */
4
11
5
12
@@ -527,7 +534,8 @@ spherebox_out(PG_FUNCTION_ARGS)
527
534
Datum
528
535
pg_sphere_version (PG_FUNCTION_ARGS )
529
536
{
530
- char * buffer = (char * ) palloc (20 );
531
- sprintf (buffer , "1.1.5" );
532
- PG_RETURN_CSTRING (buffer );
537
+ const char * s = PGSPHERE_STRINGIFY (PGSPHERE_VERSION );
538
+ char * p = (char * )palloc (strlen (s ) + 1 );
539
+ strcpy (p , s );
540
+ PG_RETURN_CSTRING (p );
533
541
}
You can’t perform that action at this time.
0 commit comments