home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / uucp / uupoll068.lha / misc / uupoll067.lha / src / cus.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-16  |  1.2 KB  |  38 lines

  1. #ifndef CUS_H
  2. #define CUS_H
  3.  
  4. /*
  5.                   cus.h -- CleanUpSequence support header
  6.  
  7.       This peace of header code is designed to cleanup safty at error
  8.     detection situations.  If you detect an error (mostly a wrong
  9.     returncode from a function) you shouldn't call 'exit(0)' or 'return'
  10.     only because of your still active stuff.  Or to quote CATS:
  11.  
  12.       "[...] Always clean up after yourself.  [...] Anything that was
  13.     opened must be closed, anything allocated must be deallocated.  It is
  14.     generally correct to do closes and deallocations in the reverse order
  15.     of the opens and allocations.  [...]"
  16.  
  17.               -- 'Amiga ROM Kernel Reference Manual: Libraries & Devices'
  18.  
  19.           ___  _______
  20.           /__)(_  /_       Genesis     : Sat Oct 12 22:48:22 1991
  21.          / \____)(___      Last Change : Fri Jan 31 17:48:19 1992
  22.         /                  Class       : ANSI C
  23.  
  24.       Copyright (c) Ralf S. Engelschall, All Rights Reserved.
  25.                                                                             */
  26.  
  27.  
  28. #define ZERO 0
  29.  
  30. #define STMT(stuff) do { stuff } while (ZERO)
  31.  
  32. #define CU(returncode) STMT( rc = returncode; goto CUS; )
  33. #define EE(returncode) STMT( rc = returncode; goto EE; )    /* obsolete */
  34. #define CU2() STMT( goto CUS; )        /* for special situations */
  35.  
  36. #endif /* CUS_H */
  37.  
  38.