My Project
ssht_error.h
Go to the documentation of this file.
1 // SSHT package to perform spin spherical harmonic transforms
2 // Copyright (C) 2011 Jason McEwen
3 // See LICENSE.txt for license details
4 
5 
12 #ifndef SSHT_ERROR
13 #define SSHT_ERROR
14 
15 
16 #include <stdio.h>
17 
18 
19 #define SSHT_ERROR_GENERIC(comment) \
20  printf("ERROR: %s.\n", comment); \
21  printf("ERROR: %s <%s> %s %s %s %d.\n", \
22  "Occurred in function", \
23  __func__, \
24  "of file", __FILE__, \
25  "on line", __LINE__); \
26  exit(1);
27 
28 #define SSHT_ERROR_MEM_ALLOC_CHECK(pointer) \
29  if(pointer == NULL) { \
30  SSHT_ERROR_GENERIC("Memory allocation failed") \
31  }
32 
33 
34 #endif