but ran into problems with function name collisions. Damn the C's flat
namespace!
Renamed our log to log_msg, but keep the original name as a macro
expanding to the new one. Also renamed log2 (which is currently not used
anywhere) to fls (find last set, akin to ffs).
Introduced lib/math.h which is a wrapper around <math.h> handling
name collisions by clever macro tricks.
/*
* Sherlock Library -- Miscellaneous Functions
*
/*
* Sherlock Library -- Miscellaneous Functions
*
- * (c) 1997--2001 Martin Mares <mj@ucw.cz>
+ * (c) 1997--2003 Martin Mares <mj@ucw.cz>
*
* This software may be freely distributed and used according to the terms
* of the GNU Lesser General Public License.
*
* This software may be freely distributed and used according to the terms
* of the GNU Lesser General Public License.
#define L_ERROR_R 'e'
#define L_FATAL '!' /* die() */
#define L_ERROR_R 'e'
#define L_FATAL '!' /* die() */
-void log(unsigned int cat, const char *msg, ...) __attribute__((format(printf,2,3)));
+void log_msg(unsigned int cat, const char *msg, ...) __attribute__((format(printf,2,3)));
+#define log log_msg
void die(byte *, ...) NONRET;
void log_init(byte *);
void log_file(byte *);
void die(byte *, ...) NONRET;
void log_init(byte *);
void log_file(byte *);
-log(unsigned int cat, const char *msg, ...)
+log_msg(unsigned int cat, const char *msg, ...)
--- /dev/null
+/*
+ * Sherlock Library -- Stub for including math.h, avoiding name collisions
+ *
+ * (c) 2003 Martin Mares <mj@ucw.cz>
+ *
+ * This software may be freely distributed and used according to the terms
+ * of the GNU Lesser General Public License.
+ */
+
+#undef log
+#define log libm_log
+#define exception math_exception
+#include <math.h>
+#undef log
+#define log log_msg
+#undef exception