X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fovsdb-error.h;h=89b0c19b2966c9ec47302623dc6c09915a5b1000;hb=1dd5b71d14b5c5360f97071041ec1bdd1f8d2445;hp=2bff3ae563f66b440ef22dfd1ab6d4b3a95831f4;hpb=d198c4beee03741670d046baf0179ac5583305bb;p=sliver-openvswitch.git diff --git a/lib/ovsdb-error.h b/lib/ovsdb-error.h index 2bff3ae56..89b0c19b2 100644 --- a/lib/ovsdb-error.h +++ b/lib/ovsdb-error.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2009, 2010 Nicira Networks +/* Copyright (c) 2009, 2010, 2011 Nicira Networks * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,11 +35,25 @@ struct ovsdb_error *ovsdb_wrap_error(struct ovsdb_error *error, const char *details, ...) PRINTF_FORMAT(2, 3); -struct ovsdb_error *ovsdb_internal_error(const char *file, int line, +struct ovsdb_error *ovsdb_internal_error(struct ovsdb_error *error, + const char *file, int line, const char *details, ...) - PRINTF_FORMAT(3, 4) + PRINTF_FORMAT(4, 5) WARN_UNUSED_RESULT; -#define OVSDB_BUG(MSG) ovsdb_internal_error(__FILE__, __LINE__, "%s", MSG) + +/* Returns a pointer to an ovsdb_error that represents an internal error for + * the current file name and line number with MSG as the associated message. + * The caller is responsible for freeing the internal error. */ +#define OVSDB_BUG(MSG) \ + ovsdb_internal_error(NULL, __FILE__, __LINE__, "%s", MSG) + +/* Returns a pointer to an ovsdb_error that represents an internal error for + * the current file name and line number, with MSG as the associated message. + * If ERROR is nonnull then the internal error is wrapped around ERROR. Takes + * ownership of ERROR. The caller is responsible for freeing the returned + * error. */ +#define OVSDB_WRAP_BUG(MSG, ERROR) \ + ovsdb_internal_error(ERROR, __FILE__, __LINE__, "%s", MSG) void ovsdb_error_destroy(struct ovsdb_error *); struct ovsdb_error *ovsdb_error_clone(const struct ovsdb_error *)