28 Commits

Author SHA1 Message Date
Rose
c9fe6ca304 Introduce PTR_SUB
This is more intuitive than adding a negative number.
2024-11-19 21:33:30 -08:00
Holger Hoffstätte
e55b190f4a Fix warning about missing bomb(..) prototype
Clang rightfully complains about invoking bomb(..) without a proper prototype:
  lib/pool_alloc.c:171:16: warning: passing arguments to a function without a prototype
  is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
                (*pool->bomb)(bomb_msg, __FILE__, __LINE__);
                             ^
1 warning generated.

Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com>
2024-11-19 21:28:39 -08:00
Wayne Davison
8c3de35b0b Put 0 in parens to silence an Xcode warning. 2021-01-31 09:28:34 -08:00
Wayne Davison
f47e5a7732 Mention file & line on OOM and overflow errors.
Also simplify output of src file paths in errors & warnings when
built in a alternate build dir.
2020-07-12 23:25:21 -07:00
Wayne Davison
bc7402aa3a Avoid warning about leaked mem (didn't affect rsync's pool use). 2019-01-15 10:46:29 -08:00
Wayne Davison
9411292489 Fixed a bunch of "warn_unused_result" compiler warnings. 2008-11-09 18:56:21 -08:00
Wayne Davison
0566dc54b1 Use PTR_ADD for the new instances of void-pointer arithmetic. 2008-07-21 23:12:02 -07:00
Wayne Davison
fb01d1fb07 Changed the POOL_QALIGN flag to POOL_NO_QALIGN, reversing the setting
(making pools aligned by default).  Added the missing code to make the
documented behavior of pool_free() with a NULL addr work.  Updated the
pool_alloc.3 manpage.
2008-07-19 09:20:56 -07:00
Wayne Davison
51ce67d599 Improved the alignment code and changed POOL_APPEND to POOL_PREPEND. 2008-07-18 20:57:52 -07:00
Wayne Davison
65a22a5ff7 In pool_free_old(), one code path was not clearing a "next" pointer,
so the code could try to free an extent twice in certain circumstances.
2007-08-21 05:04:02 +00:00
Wayne Davison
a0f70237f5 Fix pool_create() to honor the POOL_INTERN flag.
(Thanks to Brion Vibber.)
2007-08-21 04:54:30 +00:00
Wayne Davison
8b498b9f1a Decided against the last change. 2007-06-06 15:43:34 +00:00
Wayne Davison
c04af69701 Allow a NULL address to be passed to pool_free_old() to indicate that
it should free all old mem and reset to an empty state.
2007-06-06 15:38:31 +00:00
Wayne Davison
676e604135 Added pool_free_old() and pool_boundary() functions to add a way to
free all wholly affected extents older than a particular point in time.
2007-05-29 04:19:41 +00:00
Wayne Davison
3fac8ca8d1 Tweaked a variable and a label to make them less confusing. 2007-05-29 02:47:23 +00:00
Wayne Davison
e3d27df444 - Fixed a bug where a pool_free() on the most-recently allocated pool
item was trying to make that memory available to the pool, but it
  failed to adjust the right variable.
- Fixed a bug in pool_free() where the return of the entire live
  extent back to unallocated status did not obey POOL_CLEAR.
- Use the new() and new_array() functions instead of malloc().
- Changed the sqew variable to skew.
- Some other minor formatting tweaks.
2007-05-29 00:52:08 +00:00
Wayne Davison
4a19c3b254 Added "const" to appropriate char pointers. 2006-11-19 00:23:21 +00:00
Wayne Davison
c9bce0b8f8 Changed strcpy() calls into strlcpy() calls, just to be extra safe. 2006-10-13 23:17:33 +00:00
Wayne Davison
8ea17b5098 Twiddled some brace positions and removed a superfluous ';' in a macro. 2005-11-14 21:24:30 +00:00
Wayne Davison
707415d4fc Use int64 instead of uint64. 2005-01-20 22:37:38 +00:00
Wayne Davison
04575bcab5 Missed one void-pointer-arithmetic case. 2004-04-09 20:17:01 +00:00
Wayne Davison
71b291d71b AIX's cc was complaining about the void* arithmetic. 2004-04-09 19:53:50 +00:00
Wayne Davison
4d4df3cd2b Another attempt at measuring the minimum alignment for a system. 2004-02-10 23:35:12 +00:00
Wayne Davison
61d35e1844 Trying a different MINALIGN because of core dumps on the sparc-64
build-farm machines.
2004-02-10 22:28:36 +00:00
J.W. Schultz
15f85b1f63 Revert pool_alloc's use of bomb if pool == NULL. 2004-02-10 21:11:24 +00:00
Wayne Davison
aa0b9ca174 If we call pool_alloc() on a NULL pool, bomb out with an error. 2004-02-10 17:52:31 +00:00
Wayne Davison
be20dc3448 Changed a while loop to a for loop. 2004-02-10 17:34:05 +00:00
J.W. Schultz
7efdcf3218 Added allocation pool code. 2004-02-10 03:26:41 +00:00