~ubuntu-branches/debian/wheezy/netatalk/wheezy

« back to all changes in this revision

Viewing changes to include/atalk/errchk.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2011-06-05 21:04:21 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20110605210421-19gag2srevj0ocxh
Tags: 2.2~beta4-1
* New upstream release.
  + Fixes "Internal Error" after ad_open on sparc.
    Closes: bug#606005. Thanks to Alfredo Sola.
* Adjust references to unofficial packages in README.Debian.
* Use dversionmangle (not uversionmangle) in watch file. Fix add
  leading dash (-) to upstream version in mangling.
* Update patches:
  + Drop patches 107 and 294 (Zeroconf support): Implemented
    (differently) upstream now.
  + Drop patches 109 and 112 (avoid broken XFS linkage) obsolete.
  + Drop patch 200 (hostname resolving): adopted upstream.
  + Refresh patch 205.
* Rewrite copyright file using draft 174 of DEP-5 format.
* Build-depend on and recommend unversioned (i.e. default) BerkeleyDB
  packages.
  Closes: bug#621413. Thanks to Ondřej Surý.
  Simplify suggestions on older versioned BerkeleyDB packages.
* Stop installing some documentation dropped upstream, and let CDBS
  automagically handle some of the remains.
* Update control file:
  + Bump policy compliance to standards-version 3.9.2.
  + Shorten Vcs-* URLs.
* Add patches 115 and (for automade file) 214 to avoid installing
  unneeded /default dir.
  Closes: bug#628119. Thanks to Russell Muetzelfeldt and Luk Claes.
* Don't ship .la files. Closes: bug#621849. Thanks to Andreas Metzler
  and Luk Claes.
* Stop renaming afile and achfile, dropped upstream.
* Explicitly enable DDP (AppleTalk), now disabled by default.
* Enable Zeroconf, should be stable now.
* Simplify package relations:
  + Drop (build-)dependency fallback unneeded even for oldstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
   Copyright (c) 2010 Frank Lahm <franklahm@gmail.com>
 
3
 
 
4
   This program is free software; you can redistribute it and/or modify
 
5
   it under the terms of the GNU General Public License as published by
 
6
   the Free Software Foundation; either version 2 of the License, or
 
7
   (at your option) any later version.
 
8
 
 
9
   This program is distributed in the hope that it will be useful,
 
10
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
   GNU General Public License for more details.
 
13
 */
 
14
 
 
15
#ifndef ERRCHECK_H
 
16
#define ERRCHECK_H
 
17
 
 
18
#define EC_INIT int ret = 0
 
19
#define EC_STATUS(a) ret = (a)
 
20
#define EC_FAIL ret = -1; goto cleanup
 
21
#define EC_CLEANUP cleanup
 
22
#define EC_EXIT return ret
 
23
 
 
24
/* 
 
25
 * Check out doc/DEVELOPER for more infos.
 
26
 *
 
27
 * We have these macros:
 
28
 * EC_ZERO, EC_ZERO_LOG, EC_ZERO_LOGSTR, EC_ZERO_LOG_ERR, EC_ZERO_CUSTOM
 
29
 * EC_NEG1, EC_NEG1_LOG, EC_NEG1_LOGSTR, EC_NEG1_LOG_ERR, EC_NEG1_CUSTOM
 
30
 * EC_NULL, EC_NULL_LOG, EC_NULL_LOGSTR, EC_NULL_LOG_ERR, EC_NULL_CUSTOM
 
31
 *
 
32
 * A boileplate function template is:
 
33
 
 
34
   int func(void)
 
35
   {
 
36
       EC_INIT;
 
37
 
 
38
       ...your code here...
 
39
 
 
40
       EC_STATUS(0);
 
41
 
 
42
   EC_CLEANUP:
 
43
       EC_EXIT;
 
44
   }
 
45
 */
 
46
 
 
47
/* check for return val 0 which is ok, every other is an error, prints errno */
 
48
#define EC_ZERO_LOG(a)                                                  \
 
49
    do {                                                                \
 
50
        if ((a) != 0) {                                                 \
 
51
            LOG(log_error, logtype_default, "%s failed: %s", #a, strerror(errno)); \
 
52
            ret = -1;                                                   \
 
53
            goto cleanup;                                               \
 
54
        }                                                               \
 
55
    } while (0)
 
56
 
 
57
#define EC_ZERO_LOGSTR(a, b, ...)                                       \
 
58
    do {                                                                \
 
59
        if ((a) != 0) {                                                 \
 
60
            LOG(log_error, logtype_default, b, __VA_ARGS__);            \
 
61
            ret = -1;                                                   \
 
62
            goto cleanup;                                               \
 
63
        }                                                               \
 
64
    } while (0)
 
65
 
 
66
#define EC_ZERO_LOG_ERR(a, b)                                           \
 
67
    do {                                                                \
 
68
        if ((a) != 0) {                                                 \
 
69
            LOG(log_error, logtype_default, "%s failed: %s", #a, strerror(errno)); \
 
70
            ret = (b);                                                  \
 
71
            goto cleanup;                                               \
 
72
        }                                                               \
 
73
    } while (0)
 
74
 
 
75
#define EC_ZERO(a)                              \
 
76
    do {                                        \
 
77
        if ((a) != 0) {                         \
 
78
            ret = -1;                           \
 
79
            goto cleanup;                       \
 
80
        }                                       \
 
81
    } while (0)
 
82
 
 
83
#define EC_ZERO_ERR(a,b )                       \
 
84
    do {                                        \
 
85
        if ((a) != 0) {                         \
 
86
            ret = b;                            \
 
87
            goto cleanup;                       \
 
88
        }                                       \
 
89
    } while (0)
 
90
 
 
91
/* check for return val 0 which is ok, every other is an error, prints errno */
 
92
#define EC_NEG1_LOG(a)                                                  \
 
93
    do {                                                                \
 
94
        if ((a) == -1) {                                                \
 
95
            LOG(log_error, logtype_default, "%s failed: %s", #a, strerror(errno)); \
 
96
            ret = -1;                                                   \
 
97
            goto cleanup;                                               \
 
98
        }                                                               \
 
99
    } while (0)
 
100
 
 
101
#define EC_NEG1_LOGSTR(a, b, ...)                               \
 
102
    do {                                                        \
 
103
        if ((a) == -1) {                                        \
 
104
            LOG(log_error, logtype_default, b, __VA_ARGS__);    \
 
105
            ret = -1;                                           \
 
106
            goto cleanup;                                       \
 
107
        }                                                       \
 
108
    } while (0)
 
109
 
 
110
#define EC_NEG1_LOG_ERR(a, b)                                           \
 
111
    do {                                                                \
 
112
        if ((a) == -1) {                                                \
 
113
            LOG(log_error, logtype_default, "%s failed: %s", #a, strerror(errno)); \
 
114
            ret = b;                                                    \
 
115
            goto cleanup;                                               \
 
116
        }                                                               \
 
117
    } while (0)
 
118
 
 
119
#define EC_NEG1(a)                              \
 
120
    do {                                        \
 
121
        if ((a) == -1) {                        \
 
122
            ret = -1;                           \
 
123
            goto cleanup;                       \
 
124
        }                                       \
 
125
    } while (0)
 
126
 
 
127
/* check for return val != NULL, prints errno */
 
128
#define EC_NULL_LOG(a)                                                  \
 
129
    do {                                                                \
 
130
        if ((a) == NULL) {                                              \
 
131
            LOG(log_error, logtype_default, "%s failed: %s", #a, strerror(errno)); \
 
132
            ret = -1;                                                   \
 
133
            goto cleanup;                                               \
 
134
        }                                                               \
 
135
    } while (0)
 
136
 
 
137
#define EC_NULL_LOGSTR(a, b, ...)                                       \
 
138
    do {                                                                \
 
139
        if ((a) == NULL) {                                              \
 
140
            LOG(log_error, logtype_default, b , __VA_ARGS__);           \
 
141
            ret = -1;                                                   \
 
142
            goto cleanup;                                               \
 
143
        } \
 
144
    } while (0)
 
145
 
 
146
#define EC_NULL_LOG_ERR(a, b)                                           \
 
147
    do {                                                                \
 
148
        if ((a) == NULL) {                                              \
 
149
            LOG(log_error, logtype_default, "%s failed: %s", #a, strerror(errno)); \
 
150
            ret = b;                                                    \
 
151
            goto cleanup;                                               \
 
152
        }                                                               \
 
153
    } while (0)
 
154
 
 
155
#define EC_NULL(a)                              \
 
156
    do {                                        \
 
157
        if ((a) == NULL) {                      \
 
158
            ret = -1;                           \
 
159
            goto cleanup;                       \
 
160
        }                                       \
 
161
    } while (0)
 
162
 
 
163
#endif /* ERRCHECK_H */