Find attached the patch I promised to send to you. Please note that there
[rrdtool.git] / src / rrd_not_thread_safe.c
1 /*****************************************************************************
2  * RRDtool 1.1.x  Copyright Tobias Oetiker, 1997 - 2002
3  * This file:     Copyright 2003 Peter Stamfest <peter@stamfest.at> 
4  *                             & Tobias Oetiker
5  * Distributed under the GPL
6  *****************************************************************************
7  * rrd_not_thread_safe.c   Contains routines used when thread safety is not
8  *                         an issue
9  *****************************************************************************
10  * $Id$
11  *************************************************************************** */
12 #include "rrd.h"
13 #include "rrd_tool.h"
14 #define MAXLEN 4096
15 #define ERRBUFLEN 256
16 static char rrd_error[MAXLEN] = "\0";
17 static char rrd_liberror[ERRBUFLEN] = "\0";
18 /* The global context is very useful in the transition period to even
19    more thread-safe stuff, it can be used whereever we need a context
20    and do not need to worry about concurrency. */
21 static struct rrd_context global_ctx = {
22     sizeof(rrd_error),
23     sizeof(rrd_liberror),
24     rrd_error, 
25     rrd_liberror
26 };
27 #include <stdarg.h>
28
29 struct rrd_context *rrd_get_context() {
30     return &global_ctx;
31 }
32
33 const char *rrd_strerror(int err) {
34     return strerror(err);
35 }