Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

modifying hash tables during scanhashtable



-----BEGIN PGP SIGNED MESSAGE-----

This patch makes it possible to add, replace or remove hashtable elements
during a scan of the hashtable.  This removes the need for temporary
linked lists in a couple of places.

The original code had separate scan loops for each of the four cases
of which sets of flags are specified.  I combined these into one more
maintainable loop (or rather three, as there were originally three of
these sets of four), on the grounds that the few additional bit-twiddling
operations in common cases are insignificant compared to the significant
number of memory accesses in the loop.  (Oh yes, I reduced the number
of those as well for sorted scans.)

I also corrected the comments around scanhashtable(), concerning the
meaning of flags1.  They indicated that *all* these flags had to be
set, but the actual behaviour was to accept *any* of them being set.
The only caller that actually used more than one bit set in flags1 is
bin_typeset(), which actually wants this behaviour.

The header changes are not visible outside hashtable.c.

 -zefram

begin 644 scanht_patch.gz
M'XL("/,O/S,"`W-C86YH=%]P871C:`#E&VMSVL;V,_D52SN3"A`8`3;&-)E)
M&K?)C)-V8G<ZT]Y,KI`6I`8D*@D[3NO_?L\Y^]`*),"U\^@MDV"A79T][Y=V
MF\TF.T^\@\!-@\R=S'G'JSFCT?"@ZQST1JS;/^D=GCC]FM/I=1^TV^V*R?V#
MOD.3AR>#WH-F\8._66]D]X>,?C+&Q-<!?#^HLZ]]/@TCSEZ\>OO\R?GSBR=/
MSTYAY.LP\N8KG[.O/J1!)_@*)S-VT-SQ.:!)[`<>\23TV'/`E5T@LFRZBKPL
MC*.4R4D[(2'!@/BPQ^"JO8FXPO!;+XZFX:P3/(:[-#`%FMBOY\^)HK?/3I_^
M_`/>9Y)43:<8>OOR].73T]?G[#\P"3]`P$N^F/`D9?&4I5FR\C*FV<Y6*??9
M-$X`W&0UFX71C`89C2)Y&A"2+ZB/^/O,9G,WS<8U`#\/HW<`9!ZF&2[ASN<%
M$/G'`.8%;L*:-"-R%WQ<0T"`'*X/',C<,,)+'$.86<`-F":@G^"1C-`ZS]PL
M94O\'4;3F%!;QO"+)RR+M<CPFB9)6"D]!G(`GO)YRI%A]2*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