Re: remove the unneeded header file math.h in binaryheap.c - Mailing list pgsql-hackers

From zengman
Subject Re: remove the unneeded header file math.h in binaryheap.c
Date
Msg-id tencent_2110AD724E3CC2802848274B@qq.com
Whole thread Raw
In response to Re: remove the unneeded header file math.h in binaryheap.c  (Álvaro Herrera <alvherre@kurilemu.de>)
List pgsql-hackers
Hi,

> > > I removed the <math.h> include from two files `dt_common.c` and
> > > `timestamp.c`, and the code compiles successfully in my environment.
> > > Would you consider adding this to the patch?
> 
> I would rather not touch ecpg.  (I skipped those files purposefully.)

Ok, then let's leave this part untouched. But I still sorted out the timeline of changes related to <math.h> in these
twofiles:
 
```
dt_common.c
cb8b1299a353: Added <math.h> to support the JROUND macro (which relies on the rint() function and requires the function
prototypefrom <math.h>)
 
313ed1ed9498: Removed usage of the JROUND macro (replaced with *fsec = time - *sec;), so the rint() function is no
longerneeded
 

timestamp.c
2e6f97560a8: <math.h> was included when the file was created to support the JROUND macro
313ed1ed9498: Renamed JROUND to TSROUND and added usage of the ceil() function
b9d092c962e: Removed all floating-point timestamp related code (including TSROUND and ceil())
```
Feel free to use this if needed later.

> Just because removing a platform include file works in some environment is
> *NOT* sufficient to remove platform include files. There are a lot of
> variations between platforms about when some include files are implicitly
> included via other include files. Just removing them because it works on one
> platform ends up with more niche operating systems failing to build, which we
> may only figure out months or even years down the road.
>
> At the very least you need to figure out why the includes where added and why
> that reason is not present anymore.

You're right - sorry for the oversight.


Thank you all for your guidance.

--
Regards,
Man Zeng
www.openhalo.org

pgsql-hackers by date:

Previous
From: "yangyz"
Date:
Subject: fix a spelling mistake
Next
From: Jacob Champion
Date:
Subject: Re: Custom oauth validator options