ReactOS  0.4.13-dev-52-g0efcfec
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 
26 struct chmcErr
27 {
28  int code;
30 };
31 
32 static struct chmcErr chmc_err = {
33  CHMC_NOERR,
34  '\0',
35 };
36 
37 void chmcerr_clean(void) {
38  chmc_err.code = CHMC_NOERR;
39  chmc_err.msg[0] = '\0';
40 }
41 
42 int chmcerr_code(void) {
43  return chmc_err.code;
44 }
45 
46 const char *chmcerr_message( void ) {
47  return chmc_err.msg;
48 }
49 
50 void 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 }
#define vsnprintf
Definition: tif_win32.c:406
const char * chmcerr_message(void)
Definition: err.c:46
int code
Definition: err.c:28
void chmcerr_set(int code, const char *fmt,...)
Definition: err.c:50
#define assert(x)
Definition: debug.h:53
#define CHMC_ERRMAXLEN
Definition: err.h:35
int chmcerr_code(void)
Definition: err.c:42
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
void chmcerr_clean(void)
Definition: err.c:37
char msg[CHMC_ERRMAXLEN+1]
Definition: err.c:29
GLenum GLsizei len
Definition: glext.h:6722
int code
Definition: i386-dis.c:3591
#define CHMC_NOERR
Definition: err.h:39
#define va_start(ap, A)
Definition: acmsvcex.h:91
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
static struct chmcErr chmc_err
Definition: err.c:32
Definition: dsound.c:943
Definition: err.c:26