~ubuntu-core-dev/module-init-tools/ubuntu

« back to all changes in this revision

Viewing changes to logging.h

  • Committer: Scott James Remnant
  • Date: 2009-07-16 15:24:17 UTC
  • mfrom: (152.1.38)
  • Revision ID: scott@netsplit.com-20090716152417-7ak1sklxb59cs4fz
MergeĀ 3.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
/* Do we want to silently drop all warnings? */
8
8
extern int quiet;
9
9
 
10
 
/* Number of times warn() has been called */
11
 
extern int warned;
12
 
 
13
10
/* Do we want informative messages as well as errors? */
14
11
extern int verbose;
15
12
 
18
15
extern void warn(const char *fmt, ...);
19
16
extern void info(const char *fmt, ...);
20
17
 
 
18
typedef void (*errfn_t)(const char *fmt, ...);
 
19
 
21
20
static inline void grammar(const char *cmd,
22
21
                           const char *filename, unsigned int line)
23
22
{
27
26
 
28
27
#define NOFAIL(ptr)  do_nofail((ptr), __FILE__, __LINE__, #ptr)
29
28
 
30
 
#define nofail_asprintf(ptr, ...) \
31
 
        { if (asprintf((ptr), __VA_ARGS__) < 0) do_nofail(NULL, __FILE__, __LINE__, #ptr); }
 
29
#define nofail_asprintf(ptr, ...)                               \
 
30
        do { if (asprintf((ptr), __VA_ARGS__) < 0)              \
 
31
                do_nofail(NULL, __FILE__, __LINE__, #ptr);      \
 
32
        } while(0)
32
33
 
33
34
static inline void *do_nofail(void *ptr, const char *file, int line, const char *expr)
34
35
{