Mercurial > dropbear
comparison libtomcrypt/src/headers/tomcrypt_argchk.h @ 399:a707e6148060
merge of '5fdf69ca60d1683cdd9f4c2595134bed26394834'
and '6b61c50f4cf888bea302ac8fcf5dbb573b443251'
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 03 Feb 2007 08:20:34 +0000 |
parents | 0cbe8f6dbf9e |
children | 38d2f6b2d1b8 |
comparison
equal
deleted
inserted
replaced
394:17d097fc111c | 399:a707e6148060 |
---|---|
1 /* Defines the LTC_ARGCHK macro used within the library */ | |
2 /* ARGTYPE is defined in mycrypt_cfg.h */ | |
3 #if ARGTYPE == 0 | |
4 | |
5 #include <signal.h> | |
6 | |
7 /* this is the default LibTomCrypt macro */ | |
8 void crypt_argchk(char *v, char *s, int d); | |
9 #define LTC_ARGCHK(x) if (!(x)) { crypt_argchk(#x, __FILE__, __LINE__); } | |
10 #define LTC_ARGCHKVD(x) LTC_ARGCHK(x) | |
11 | |
12 #elif ARGTYPE == 1 | |
13 | |
14 /* fatal type of error */ | |
15 #define LTC_ARGCHK(x) assert((x)) | |
16 #define LTC_ARGCHKVD(x) LTC_ARGCHK(x) | |
17 | |
18 #elif ARGTYPE == 2 | |
19 | |
20 #define LTC_ARGCHK(x) if (!(x)) { fprintf(stderr, "\nwarning: ARGCHK failed at %s:%d\n", __FILE__, __LINE__); } | |
21 #define LTC_ARGCHKVD(x) LTC_ARGCHK(x) | |
22 | |
23 #elif ARGTYPE == 3 | |
24 | |
25 #define LTC_ARGCHK(x) | |
26 #define LTC_ARGCHKVD(x) LTC_ARGCHK(x) | |
27 | |
28 #elif ARGTYPE == 4 | |
29 | |
30 #define LTC_ARGCHK(x) if (!(x)) return CRYPT_INVALID_ARG; | |
31 #define LTC_ARGCHKVD(x) if (!(x)) return; | |
32 | |
33 #endif | |
34 | |
35 | |
36 /* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_argchk.h,v $ */ | |
37 /* $Revision: 1.5 $ */ | |
38 /* $Date: 2006/08/27 20:50:21 $ */ |