src/lib/error.h
author Tero Marttila <terom@paivola.fi>
Mon, 15 Sep 2014 01:22:46 +0300
changeset 146 0f2a918eb90a
parent 18 f92a24ab046e
permissions -rw-r--r--
pngtile.application: introduce IMAGE_TYPES, and split off image file validation into get_image(), and rename lookup_path() to handle dirs as well
#ifndef PNGTILE_ERROR_H
#define PNGTILE_ERROR_H

/**
 * @file
 *
 * Obtuse error handling
 */
#include "pngtile.h"
#include <errno.h>

#define RETURN_ERROR(code) return -(code)
#define RETURN_ERROR_ERRNO(code, errn) do { errno = (errn); return -(code); } while (0)
#define JUMP_ERROR(err) do { goto error; } while (0)
#define JUMP_SET_ERROR(err, code) do { err = -(code); goto error; } while (0)
#define JUMP_SET_ERROR_ERRNO(err, code, errn) do { err = -(code); errno = (errn); goto error; } while (0)

#endif