From 05d736ea0c4b9b517d3a733dd6ff5f3aacc04e50 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 4 Jan 2016 21:22:03 +0100 Subject: remove unused macros MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/macros.h | 37 +------------------------------------ src/parse_10deg.c | 1 + 2 files changed, 2 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/macros.h b/src/macros.h index c0aeabb..6e5f8ed 100644 --- a/src/macros.h +++ b/src/macros.h @@ -14,44 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include -#include #include -#include - -#define try(...) do { if (!(__VA_ARGS__)) goto fail; } while (0) -#define t(...) do { if (__VA_ARGS__) goto fail; } while (0) -#define CLEANUP(...) do { int cleanup__ = errno; __VA_ARGS__; errno = cleanup__; } while (0) - -#define xstrdup(outp, ...) \ -do { \ - const char *xstrdup__ = (__VA_ARGS__); \ - if (xstrdup__) \ - try (*(outp) = strdup(xstrdup__)); \ - else \ - *(outp) = NULL; \ -} while (0) - +#define t(...) do { if (__VA_ARGS__) goto fail; } while (0) #define xpread(fd, buf, len, off) t (pread(fd, buf, len, off) < (ssize_t)(len)) -#define xpwrite(fd, buf, len, off) t (pwrite(fd, buf, len, off) < (ssize_t)(len)) -#define xread(fd, buf, len) t (read(fd, buf, len) < (ssize_t)(len)) #define xwrite(fd, buf, len) t (write(fd, buf, len) < (ssize_t)(len)) - -#define xcalloc(outp, num) try (*(outp) = calloc(num, sizeof(**(outp)))) -#define xmalloc(outp, num) try (*(outp) = malloc((num) * sizeof(**(outp)))) -#define xrealloc(outp, num) \ -do { \ - size_t n__ = (num); \ - void *new__ = realloc(*(outp), n__ * sizeof(**(outp))); \ - t (n__ && !new__); \ - *(outp) = new__; \ -} while (0) - -#define SHRINK(outp, num) \ -do { \ - void *new__ = realloc(*(outp), (num) * sizeof(**(outp))); \ - if (new__) *(outp) = new__; \ -} while (0) - diff --git a/src/parse_10deg.c b/src/parse_10deg.c index 621e55e..f1e2c81 100644 --- a/src/parse_10deg.c +++ b/src/parse_10deg.c @@ -16,6 +16,7 @@ */ #include "libred.h" #include "macros.h" +#include #include #include -- cgit v1.2.3-70-g09d2