X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fprofile.h;h=3704b449e6294e4d0599f0529c5cd44f1a620f74;hb=5a78c3505ae7fa76a061e26676450049ec5946d5;hp=426b3a30512fdeba73d56071e3568e114cb994ee;hpb=3a14e6ecdc65a439df3291a37ca7965cd150211a;p=libucw.git diff --git a/lib/profile.h b/lib/profile.h index 426b3a30..3704b449 100644 --- a/lib/profile.h +++ b/lib/profile.h @@ -1,7 +1,10 @@ /* - * Sherlock Library -- Poor Man's Profiler + * UCW Library -- Poor Man's Profiler * * (c) 2001 Martin Mares + * + * This software may be freely distributed and used according to the terms + * of the GNU Lesser General Public License. */ /* @@ -14,7 +17,7 @@ * prof_start(&cnt); * ... * prof_stop(&cnt); - * printf("%s\n", PROF_STRING(&cnt)); + * printf("%s\n", PROF_STR(cnt)); */ /* PROFILE_TOD: gettimeofday() profiler */ @@ -120,7 +123,7 @@ typedef struct prof_ktsc prof_t; 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 @@ -130,7 +133,8 @@ static inline void prof_init(prof_t *c UNUSED) { } 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