Re: remove the unneeded header file math.h in binaryheap.c
zengman <zengman@halodbtech.com>
From: zengman <zengman@halodbtech.com>
To: Álvaro Herrera <alvherre@kurilemu.de>, andres <andres@anarazel.de>
Cc: pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-01-16T01:24:22Z
Lists: 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 two files: ``` dt_common.c cb8b1299a353: Added <math.h> to support the JROUND macro (which relies on the rint() function and requires the function prototype from <math.h>) 313ed1ed9498: Removed usage of the JROUND macro (replaced with *fsec = time - *sec;), so the rint() function is no longer needed 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
Commits
-
Remove #include <math.h> where not needed
- 35e3fae738e6 19 (unreleased) landed
-
Remove unnecessary uses of Abs()
- f14aad5169ba 16.0 cited
-
Basic binary heap implementation.
- 7a2fe9bd0371 9.3.0 cited