summaryrefslogtreecommitdiff
path: root/lib/ccan/likely/likely.h
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-12-05 16:42:48 +1030
committerRusty Russell <rusty@rustcorp.com.au>2011-12-05 16:42:48 +1030
commit5917d979911b024714d2d3a7b64255bffa37ec60 (patch)
treee010d41c30e9fd777032110c63d6f4bbdcd9a229 /lib/ccan/likely/likely.h
parente1374049678842f5086f174d97ae916345686f87 (diff)
downloadsamba-5917d979911b024714d2d3a7b64255bffa37ec60.tar.gz
samba-5917d979911b024714d2d3a7b64255bffa37ec60.tar.bz2
samba-5917d979911b024714d2d3a7b64255bffa37ec60.zip
lib/ccan/likely: use htable_type
Also general cleanups: (1) Don't assume that strings are folded by the compiler. (2) Implement likely_stats_reset(). (3) Return non-const string from likely_stats(), as caller must free it. (4) Don't use struct info indirection (that was from when we used callbacks?) (5) Close memory leak in run-debug.c Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 0e5d0e30b30bb07b6605843e5ff224210d8083d8)
Diffstat (limited to 'lib/ccan/likely/likely.h')
-rw-r--r--lib/ccan/likely/likely.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/ccan/likely/likely.h b/lib/ccan/likely/likely.h
index 3a9c6d4640..8b72995dd4 100644
--- a/lib/ccan/likely/likely.h
+++ b/lib/ccan/likely/likely.h
@@ -109,6 +109,13 @@ long _likely_trace(bool cond, bool expect,
* #endif
* }
*/
-const char *likely_stats(unsigned int min_hits, unsigned int percent);
+char *likely_stats(unsigned int min_hits, unsigned int percent);
+
+/**
+ * likely_stats_reset - free up memory of likely()/unlikely() branches.
+ *
+ * This can also plug memory leaks.
+ */
+void likely_stats_reset(void);
#endif /* CCAN_LIKELY_DEBUG */
#endif /* CCAN_LIKELY_H */