src/lib/error.h
author Tero Marttila <terom@fixme.fi>
Mon, 25 Jan 2010 01:41:25 +0200
changeset 56 d5e3089906da
parent 18 f92a24ab046e
permissions -rw-r--r--
major refactoring of pt_cache, split off all PNG processing into pt_png
#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