summaryrefslogtreecommitdiffstats
path: root/crypto/tmdiff.h
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2003-10-29 04:40:13 +0000
committerGeoff Thorpe <geoff@openssl.org>2003-10-29 04:40:13 +0000
commit0991f0703478fd0fc704b6c59ffbb675b92899c1 (patch)
tree9f01246c6a7cd7283019165a35e09c4318dd6564 /crypto/tmdiff.h
parent2aaec9cced89edfdc8375b38a130fa1c35a98025 (diff)
For whatever reason (compiler or header bugs), at least one commonly-used
linux system (namely mine) chokes on our definitions and uses of the "HZ" symbol in crypto/tmdiff.[ch] and apps/speed.c as a "bad function cast" (when in fact there is no function casting involved at all). In both cases, it is easily worked around by not defining a cast into the macro and jiggling the expressions slightly. In addition - this highlights some cruft in openssl that needs sorting out. The tmdiff.h header is exported as part of the openssl API despite the fact that it is ugly as the driven sludge and not used anywhere in the library, applications, or utilities. More weird still, almost identical code exists in apps/speed.c though it looks to be slightly tweaked - so either tmdiff should be updated and used by speed.c, or it should be dumped because it's obviously not useful enough. Rather than removing it for now, I've changed the API for tmdiff to at least make sense. This involves taking the object type (MS_TM) from the implementation and using it in the header rather than using "char *" in the API and casting mercilessly in the code (ugh). If someone doesn't like "MS_TM" and the "ms_time_***" naming, by all means change it. This should be a harmless improvement, because the existing API is clearly not very useful (eg. we reimplement it rather than using it in our own utils). However, someone still needs to take a hack at consolidating speed.c and tmdiff.[ch] somehow.
Diffstat (limited to 'crypto/tmdiff.h')
-rw-r--r--crypto/tmdiff.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/crypto/tmdiff.h b/crypto/tmdiff.h
index 41a8a1e0e0..af5c41c649 100644
--- a/crypto/tmdiff.h
+++ b/crypto/tmdiff.h
@@ -59,6 +59,16 @@
/* Header for dynamic hash table routines
* Author - Eric Young
*/
+/* ... erm yeah, "dynamic hash tables" you say?
+ *
+ * And what would dynamic hash tables have to do with any of this code *now*?
+ * AFAICS, this code is only referenced by crypto/bn/exp.c which is an unused
+ * file that I doubt compiles any more. speed.c is the only thing that could
+ * use this (and it has nothing to do with hash tables), yet it instead has its
+ * own duplication of all this stuff and looks, if anything, more complete. See
+ * the corresponding note in apps/speed.c.
+ * The Bemused - Geoff
+ */
#ifndef HEADER_TMDIFF_H
#define HEADER_TMDIFF_H
@@ -67,11 +77,13 @@
extern "C" {
#endif
-char *ms_time_new(void );
-void ms_time_free(char *a);
-void ms_time_get(char *a);
-double ms_time_diff(char *start,char *end);
-int ms_time_cmp(char *ap,char *bp);
+typedef struct ms_tm MS_TM;
+
+MS_TM *ms_time_new(void );
+void ms_time_free(MS_TM *a);
+void ms_time_get(MS_TM *a);
+double ms_time_diff(MS_TM *start, MS_TM *end);
+int ms_time_cmp(const MS_TM *ap, const MS_TM *bp);
#ifdef __cplusplus
}