X-Git-Url: http://winboard.nl/cgi-bin?p=polyglot.git;a=blobdiff_plain;f=util.h;h=2b0886cc0c98e3d4902e519c2554808417e6a38e;hp=cf197fe9d63d4fca0a83dcfe8ce592d800879d52;hb=a0f731f21d6aa26dbf7246039a1c66c2ade0533f;hpb=baab92d048b9ba06dada3a17ec51d9e9340d4730 diff --git a/util.h b/util.h index cf197fe..2b0886c 100644 --- a/util.h +++ b/util.h @@ -65,6 +65,25 @@ #define snprintf _snprintf #endif +#define FormatBufferSize 4096 + +#define CONSTRUCT_ARG_STRING(format,buf) \ + { \ + va_list arg_list; \ + int written; \ + va_start(arg_list,format); \ + written=vsnprintf(buf, \ + sizeof(buf), \ + format, \ + arg_list); \ + va_end(arg_list); \ + buf[sizeof(buf)]='\0'; \ + if(written>=sizeof(buf) || written<0){ \ + my_fatal("write_buffer overflow: file \"%s\", line %d\n", \ + __FILE__,__LINE__); \ + } \ + } \ + // types typedef signed char sint8; @@ -92,6 +111,7 @@ typedef struct { bool running; } my_timer_t; + // functions extern void util_init (); @@ -135,9 +155,6 @@ extern double my_timer_elapsed_real (const my_timer_t * timer); extern char * my_error(); -extern char * my_getcwd (char *buf, size_t size); -extern int my_chdir (const char *path); - #endif // !defined UTIL_H // end of util.h