/*
- * Sherlock Library -- Poor Man's Profiler
+ * UCW Library -- Poor Man's Profiler
*
* (c) 2001 Martin Mares <mj@ucw.cz>
+ *
+ * This software may be freely distributed and used according to the terms
+ * of the GNU Lesser General Public License.
*/
/*
* prof_start(&cnt);
* ...
* prof_stop(&cnt);
- * printf("%s\n", PROF_STRING(&cnt));
+ * printf("%s\n", PROF_STR(cnt));
*/
/* PROFILE_TOD: gettimeofday() profiler */
static inline void prof_start(prof_t *c) { prof_switch(NULL, c); }
static inline void prof_stop(prof_t *c) { prof_switch(c, NULL); }
#endif
-#define PROF_STR(c) ({ static byte _x[PROF_STR_SIZE]; prof_format(_x, &(C)); _x })
+#define PROF_STR(C) ({ static char _x[PROF_STR_SIZE]; prof_format(_x, &(C)); _x; })
#else
static inline void prof_start(prof_t *c UNUSED) { }
static inline void prof_stop(prof_t *c UNUSED) { }
static inline void prof_switch(prof_t *c UNUSED, prof_t *d UNUSED) { }
-static inline void prof_format(char *b, prof_t *c UNUSED) { strcpy(b, "?"); }
+static inline void prof_format(char *b, prof_t *c UNUSED) { b[0]='?'; b[1]=0; }
#define PROF_STR_SIZE 2
+#define PROF_STR(C) "?"
#endif