~nova-coresec/ubuntu/maverick/libvirt/nova-ppa

« back to all changes in this revision

Viewing changes to src/internal.h

  • Committer: Bazaar Package Importer
  • Author(s): Guido Günther
  • Date: 2010-05-09 14:25:00 UTC
  • mto: (1.2.5 upstream) (3.4.15 squeeze)
  • mto: This revision was merged to the branch mainline in revision 92.
  • Revision ID: james.westby@ubuntu.com-20100509142500-1aracjxxmac2zx33
Import upstream version 0.8.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
# include <limits.h>
10
10
# include <verify.h>
11
11
 
 
12
# if STATIC_ANALYSIS
 
13
#  undef NDEBUG /* Don't let a prior NDEBUG definition cause trouble.  */
 
14
#  include <assert.h>
 
15
#  define sa_assert(expr) assert (expr)
 
16
# else
 
17
#  define sa_assert(expr) /* empty */
 
18
# endif
 
19
 
12
20
# ifdef HAVE_SYS_SYSLIMITS_H
13
21
#  include <sys/syslimits.h>
14
22
# endif
191
199
    fprintf(stderr, "Unimplemented block at %s:%d\n",                   \
192
200
            __FILE__, __LINE__);
193
201
 
 
202
/**
 
203
 * virCheckFlags:
 
204
 * @supported: an OR'ed set of supported flags
 
205
 * @retval: return value in case unsupported flags were passed
 
206
 *
 
207
 * To avoid memory leaks this macro has to be used before any non-trivial
 
208
 * code which could possibly allocate some memory.
 
209
 *
 
210
 * Returns nothing. Exits the caller function if unsupported flags were
 
211
 * passed to it.
 
212
 */
 
213
# define virCheckFlags(supported, retval)                               \
 
214
    do {                                                                \
 
215
        if ((flags & ~(supported))) {                                   \
 
216
            virReportErrorHelper(NULL,                                  \
 
217
                                 VIR_FROM_THIS,                         \
 
218
                                 VIR_ERR_INVALID_ARG,                   \
 
219
                                 __FILE__,                              \
 
220
                                 __FUNCTION__,                          \
 
221
                                 __LINE__,                              \
 
222
                                 _("%s: unsupported flags (0x%x)"),     \
 
223
                                 __FUNCTION__, flags & ~(supported));   \
 
224
            return retval;                                              \
 
225
        }                                                               \
 
226
    } while (0)
 
227
 
194
228
#endif                          /* __VIR_INTERNAL_H__ */