atexit(context_destroy_context);
}
}
-struct rrd_context *rrd_get_context(
+rrd_context_t *rrd_get_context(
void)
{
- struct rrd_context *ctx;
+ rrd_context_t *ctx;
context_init_context();
const char *rrd_strerror(
int err)
{
- struct rrd_context *ctx;
+ rrd_context_t *ctx;
context_init_context();
ctx = rrd_get_context();
EnterCriticalSection(&CriticalSection);
- strncpy(ctx->lib_errstr, strerror(err), ctx->errlen);
- ctx->lib_errstr[ctx->errlen] = '\0';
+ strncpy(ctx->lib_errstr, strerror(err), sizeof(ctx->lib_errstr));
+ ctx->lib_errstr[sizeof(ctx->lib_errstr) - 1] = '\0';
LeaveCriticalSection(&CriticalSection);
return ctx->lib_errstr;