diff options
-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!) */ |