chiark
/
gitweb
/
~mdw
/
disorder
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
22f6160
)
tighten up liveness behavior
author
Richard Kettlewell
<rjk@greenend.org.uk>
Thu, 29 Nov 2007 19:35:07 +0000
(19:35 +0000)
committer
Richard Kettlewell
<rjk@greenend.org.uk>
Thu, 29 Nov 2007 19:35:07 +0000
(19:35 +0000)
lib/selection.c
patch
|
blob
|
blame
|
history
diff --git
a/lib/selection.c
b/lib/selection.c
index c69e83d2310ed1b48fb6e68fbb2db9416f70e035..58ff5d1fa37bca9c8785a7334c4eca9fe303acb7 100644
(file)
--- a/
lib/selection.c
+++ b/
lib/selection.c
@@
-44,9
+44,11
@@
hash *selection_new(void) {
* are not marked as live.
*/
void selection_set(hash *h, const char *key, int selected) {
* are not marked as live.
*/
void selection_set(hash *h, const char *key, int selected) {
- if(selected)
- hash_add(h, key, xmalloc_noptr(sizeof (int)), HASH_INSERT_OR_REPLACE);
- else
+ if(selected) {
+ int *const liveness = xmalloc_noptr(sizeof (int));
+ *liveness = 0;
+ hash_add(h, key, liveness, HASH_INSERT_OR_REPLACE);
+ } else
hash_remove(h, key);
}
hash_remove(h, key);
}
@@
-96,7
+98,7
@@
static int selection_cleanup_callback(const char *key,
/** @brief Delete all non-live keys from a selection
* @param h Hash representing selection
*
/** @brief Delete all non-live keys from a selection
* @param h Hash representing selection
*
- *
See selection_live()
.
+ *
After cleanup, no keys are marked as live
.
*/
void selection_cleanup(hash *h) {
hash_foreach(h, selection_cleanup_callback, h);
*/
void selection_cleanup(hash *h) {
hash_foreach(h, selection_cleanup_callback, h);