earthdistance update for msvc

Started by Magnus Haganderabout 19 years ago3 messages
#1Magnus Hagander
mha@sollentuna.net
1 attachment(s)

A define is needed to expose the M_PI define from the system headers.

//Magnu <<earthdistance.diff>> s

Attachments:

earthdistance.diffapplication/octet-stream; name=earthdistance.diffDownload
Index: contrib\earthdistance/earthdistance.c
===================================================================
RCS file: c:/prog/cvsrepo/pgsql/pgsql/contrib/earthdistance/earthdistance.c,v
retrieving revision 1.11
diff -c -r1.11 earthdistance.c
*** contrib\earthdistance/earthdistance.c	30 May 2006 22:12:12 -0000	1.11
--- contrib\earthdistance/earthdistance.c	18 Oct 2006 21:29:25 -0000
***************
*** 2,7 ****
--- 2,10 ----
  
  #include "postgres.h"
  
+ #ifdef WIN32
+ #define _USE_MATH_DEFINES
+ #endif
  #include <math.h>
  
  #include "utils/geo_decls.h"	/* for Pt */
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Magnus Hagander (#1)
Re: earthdistance update for msvc

"Magnus Hagander" <mha@sollentuna.net> writes:

A define is needed to expose the M_PI define from the system headers.

It seems like the other places where we depend on M_PI, we instead have

#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif

Perhaps that's a better solution?

regards, tom lane

#3Magnus Hagander
mha@sollentuna.net
In reply to: Tom Lane (#2)
Re: earthdistance update for msvc

A define is needed to expose the M_PI define from the

system headers.

It seems like the other places where we depend on M_PI, we
instead have

#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif

Perhaps that's a better solution?

Oh. I actually did that for my quick-n-dirty fix and thought it would be
rejected so I researched the other one :-) either one is fine by me.

//Magnus