diff options
author | N.N. <matju@users.sourceforge.net> | 2009-05-14 01:04:31 +0000 |
---|---|---|
committer | N.N. <matju@users.sourceforge.net> | 2009-05-14 01:04:31 +0000 |
commit | 4a947922aefc90d6b08fa83165cbede3d18feb66 (patch) | |
tree | 183105b1fd4dab32449d1261073594f9e389beee /desiredata/src | |
parent | e4666a5d21f728b4c5e77e6b24351ec3f6e04270 (diff) |
make gcc globally shut up about (v)asprintf return values, yet make the return values usable if we want to.
svn path=/trunk/; revision=11335
Diffstat (limited to 'desiredata/src')
-rw-r--r-- | desiredata/src/desire.h | 6 | ||||
-rw-r--r-- | desiredata/src/kernel.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/desiredata/src/desire.h b/desiredata/src/desire.h index cbe28e4c..eb1ef989 100644 --- a/desiredata/src/desire.h +++ b/desiredata/src/desire.h @@ -360,4 +360,10 @@ EXTERN int pd_stackn; EXTERN int gstack_empty(); /* that's a completely different stack: see pd_pushsym,pd_popsym */ +class Error {}; +class VeryUnlikelyError : Error {}; +int throw_if_negative(int n) {if (n<0) throw VeryUnlikelyError(); else return n;} +#define asprintf(ARGS...) throw_if_negative( asprintf(ARGS)) +#define vasprintf(ARGS...) throw_if_negative(vasprintf(ARGS)) + #endif /* __DESIRE_H */ diff --git a/desiredata/src/kernel.c b/desiredata/src/kernel.c index c5fd2b68..25577f41 100644 --- a/desiredata/src/kernel.c +++ b/desiredata/src/kernel.c @@ -36,12 +36,6 @@ #define a_gpointer a_w.w_gpointer #define a_index a_w.w_index -class Error {}; -class VeryUnlikelyError : Error {}; - -#define asprintf(ARGS...) do {if ( asprintf(ARGS)<0) throw VeryUnlikelyError();} while(0) -#define vasprintf(ARGS...) do {if (vasprintf(ARGS)<0) throw VeryUnlikelyError();} while(0) - using namespace std; /* T.Grill - bit alignment for signal vectors (must be a multiple of 8!) */ |