ReactOS 0.4.15-dev-7711-g5627da4
err.c
Go to the documentation of this file.
1/*
2
3 Copyright (C) 2010 Alex Andreotti <alex.andreotti@gmail.com>
4
5 This file is part of chmc.
6
7 chmc is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 chmc is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with chmc. If not, see <http://www.gnu.org/licenses/>.
19
20*/
21#include "err.h"
22
23#include <stdarg.h>
24#include <assert.h>
25
26struct chmcErr
27{
28 int code;
30};
31
32static struct chmcErr chmc_err = {
34 '\0',
35};
36
37void chmcerr_clean(void) {
38 chmc_err.code = CHMC_NOERR;
39 chmc_err.msg[0] = '\0';
40}
41
42int chmcerr_code(void) {
43 return chmc_err.code;
44}
45
46const char *chmcerr_message( void ) {
47 return chmc_err.msg;
48}
49
50void chmcerr_set(int code, const char *fmt, ...)
51{
52 int len;
53 va_list ap;
54
55 chmc_err.code = code;
56
57 va_start(ap, fmt);
58
60 if (len == CHMC_ERRMAXLEN)
61 chmc_err.msg[CHMC_ERRMAXLEN] = '\0';
62
64
65 va_end(ap);
66}
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define assert(x)
Definition: debug.h:53
GLenum GLsizei len
Definition: glext.h:6722
int chmcerr_code(void)
Definition: err.c:42
void chmcerr_set(int code, const char *fmt,...)
Definition: err.c:50
const char * chmcerr_message(void)
Definition: err.c:46
void chmcerr_clean(void)
Definition: err.c:37
static struct chmcErr chmc_err
Definition: err.c:32
#define CHMC_ERRMAXLEN
Definition: err.h:35
#define CHMC_NOERR
Definition: err.h:39
Definition: err.c:27
int code
Definition: err.c:28
char msg[CHMC_ERRMAXLEN+1]
Definition: err.c:29
Definition: inflate.c:139
Definition: dsound.c:943
#define vsnprintf
Definition: tif_win32.c:406
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36