Bill Currie
488ccdc512
[glsl] Be more null-safe for free/destroy functions
2023-03-06 18:21:13 +09:00
Bill Currie
9193a92a81
[util] Make Hash_DelContext null-safe
2023-03-05 18:31:30 +09:00
Bill Currie
be9e6893e5
[util] Free up hash links
...
Finally, hash links can be freed when the hash context is no longer
relevant. The context is created automatically when needed, and the
owner can delete the context when its done with the relevant hash
tables.
2023-03-04 02:07:31 +09:00
Bill Currie
9146860f70
[util] Add size limited find and hash functions
...
Hash_nFind and Hash_nString work like Hash_Find and Hash_String, but
take a maximum string length (like strncmp etc).
2023-03-03 18:50:47 +09:00
Bill Currie
b7b6d4ad12
[hash] Clean up some duplicate code
...
Hash_Add and Hash_AddElement differed by only one line: the hash
calculation.
2022-05-12 18:52:36 +09:00
Bill Currie
f91167d74a
[hash] Use uintptr_t for all hashes
...
This fixes the inconsistent hash types and removes all references to
"long", making for better portability.
2022-05-12 18:52:36 +09:00
Bill Currie
978d0306c0
[hash] Rename the publicly visible hashlink_t to hashctx_t
...
I think my biggest problem with the hashlink freelist parameter was how
much implementation it exposed in just the name.
2022-05-12 18:02:01 +09:00
Bill Currie
8bd626a3e4
[hash] Add a couple of data-oriented functions
...
Hash_Select returns a list of elements that match a given criterion
(select callback returning non-0).
Hash_ForEach simply calls a function for every element.
2022-04-25 00:18:22 +09:00
Bill Currie
4cef9792f4
[util] Make hash-tables semi-thread-safe
...
They take a pointer to a free-list used for hashlinks so the hashlink
pools can be per-thread. However, hash tables that are not updated are
always thread-safe, so this affects only updates. progs_t has been set
up such that it is easy for multiple progs within one thread can share
hashlinks.
2020-03-25 15:43:16 +09:00
Bill Currie
6eb6b6c0ba
Change pointer_t to unsigned and clean up the mess.
...
It doesn't make sense to have negative pointers. The size of the commit is
from enabling gcc's -Wtype-limits warning and cleaning up that mess too.
2012-12-21 21:53:13 +09:00
Bill Currie
ec42bde527
Make hash tables more const correct.
...
And clean up the resulting mess :/
2012-10-27 11:44:31 +09:00
Bill Currie
23a38738fc
Massive whitespace cleanup.
...
Lots of trailing whitespace and otherwise blank lines.
2012-05-22 08:23:22 +09:00
Bill Currie
bc1b483525
Nuke the rcsid stuff.
...
It's pretty useless in git.
2012-04-22 10:56:32 +09:00
Bill Currie
cc5140e3a1
Move min/max/bound and field_offset into better locations.
...
min/max bound into mathlib.h (they /are/ math functions, after all) and
field_offset into qtypes.h.
2011-12-24 10:04:33 +09:00
Bill Currie
ff132bb536
64bit windows patch from phrosty
2007-04-04 07:48:14 +00:00
Bill Currie
99c0954b47
the big dso visibility patch :). Sure, we have to have unique names for static builds, but with controlled visibitly we should get faster program loads (although this isn't C++, so it's not as bad) and complex plugins are cleaner.
2007-03-10 12:00:59 +00:00
Bill Currie
3fb03fc2be
hah, should have been using __attribute__((used)) all that time (rather
...
than __attribute__((unused))). fixes the missing console in -x11
2005-08-04 15:27:09 +00:00
Bill Currie
893d3ec290
hash.[ch]:
...
add Hash_NumElements to get the number of elements in the hash table
qfplist.[ch]:
add PL_A_NumObjects and PL_D_NumKeys, to get the number of objects or
number of keys in the array or dictionary, respectively
2004-02-07 07:47:23 +00:00
Jeff Teunissen
91fdd90674
one-line whitespace, didn't look too hard at the rest though. :)
2004-01-06 11:05:34 +00:00
Bill Currie
462d726d14
better memory management for hash tables
2004-01-06 08:40:21 +00:00
Bill Currie
eb099ae0d3
make qf gcc 3.3 clean
2003-04-17 00:01:48 +00:00
Bill Currie
fd5695eb03
hash.[ch]:
...
add Hash_Free to ease freeing of hash table entries.
quakefs.c:
beginnings of proper variable subtitution in qfs. not yet working but
it compiles.
2003-01-27 18:16:15 +00:00
Bill Currie
761a7546dd
re-arrange things so __attribute__ and __builtin_expect are properly
...
autoconfiscated so rcsid will continue to work with gcc 3.3
2003-01-15 15:31:36 +00:00
Bill Currie
b345f510fa
provide Hash_Buffer so buffers can be hashed
2002-10-20 03:30:22 +00:00
Bill Currie
9134e05aec
return lists of multiple matching elements
2002-05-30 21:56:57 +00:00
Bill Currie
630aa80dc4
various cleanups including TODOs and FIXMEs and rewrite va to use a dynamic
...
buffer.
2002-01-12 04:34:53 +00:00
Bill Currie
cc66577f1c
fixes for building on alpha (linux)
2001-11-16 01:09:17 +00:00
Bill Currie
e4fd746f71
this adds some stats to hash tables and a command to get at them for commands
...
and aliases
2001-11-10 01:13:29 +00:00
Bill Currie
6bbb9a75a3
remove an unneeded check
2001-10-26 03:12:31 +00:00
Ragnvald Maartmann-Moe IV
9c6955f406
Fix missing include.
2001-10-02 23:53:07 +00:00
Bill Currie
40d0490b7c
add Hash_GetList to get a list of elements in the hash table (unsorted)
2001-10-02 23:17:25 +00:00
Bill Currie
b1f4a778f9
the rcsid commit from hell }:>
2001-09-28 06:26:31 +00:00
Bill Currie
9ee3450265
extend the hash api to more easily support general cases
2001-08-16 02:51:53 +00:00
Bill Currie
6cda415f06
slight api change: Hash_Del now returns a pointer to the element deleted, or
...
null if the element was not found, rather than 0 and -1 respectively.
2001-07-06 17:43:47 +00:00
Bill Currie
3a94567913
Make Hash_FlushTable loop safe and correct the copyright notices
2001-06-19 02:01:18 +00:00
Bill Currie
f4969d5d67
add some docs for the hash table api and move the include of stdlib.h to
...
hash.c (no longer needed in hash.h).
2001-06-11 19:37:25 +00:00
Bill Currie
75fbb80b96
make the hash table types opaque
2001-06-11 19:17:40 +00:00
Bill Currie
22f465dabe
use field_offset to hide the nastyness
2001-06-06 16:10:28 +00:00
Bill Currie
e339e82c01
hash.h is now const correct as is a lot of qfcc
2001-06-04 04:52:14 +00:00
Bill Currie
323015b11a
include/QF header cleanup. including config.h (or any file from include) is
...
a nono because headers in include/QF get installed, but include don't and thus
would break quakeforge-dev.
2001-05-31 05:33:13 +00:00
Bill Currie
f78b973978
move the api headers into include/QF and clean up (most of) the resulting mess.
...
target specific files that I don't build won't compile yet. just put QF/
infront of the offending headers.
Also move ver_check into libqfutils
2001-03-27 20:33:07 +00:00
Bill Currie
4489319298
first step towards garbage collected dynamic strings in qc. All strings
...
external to the progs file are now malloced and then freed at progs reload.
All that needs to be implementd for gc to work is the scanner and deallocator.
2001-03-06 04:22:33 +00:00
Bill Currie
c4616346a1
dx_hack_hash stolen from Daniel Phillips <phillips@innominate.de> in the lkml.
...
This might or might not give hash tables a better spread. We'll see :)
2001-03-05 16:19:10 +00:00
Bill Currie
f40b361fb3
hash.[ch]:
...
slight api change: the getkey and free functions now take a user data
parameter (which is an aditional parameter to Hash_New.
cmd.c, cvar.c, quakefs.c:
clean up the resulting errors.
pr_edict.c:
use hash tables for lookups of function, global and field definitions.
should speed things up a bit, ESPECIALLY when type checking is enabled.
2001-03-05 05:11:26 +00:00
Bill Currie
95f6db7775
start merging stuff into libs/util and fix the concequences in nq. nq doesn't
...
build yet though (keys.c, *screen.c and *view.c) due to console fun.
2001-02-21 19:35:06 +00:00