X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fbabeltrace2%2Ffunc-status.h;h=0f1829af8e7e17fcba6d1c1755ad0665371498dd;hb=50e763f66f1e2016995f65c590bdbbae17b9b4ed;hp=60b68628f977b75e295e946912991b11d1584dd2;hpb=d24d56638469189904fb6ddbb3c725817b3e9417;p=babeltrace.git diff --git a/include/babeltrace2/func-status.h b/include/babeltrace2/func-status.h index 60b68628..0f1829af 100644 --- a/include/babeltrace2/func-status.h +++ b/include/babeltrace2/func-status.h @@ -1,16 +1,10 @@ /* - * No include guards here: this header is included by a public header to - * get the `__BT_FUNC_STATUS_*` definitions locally, and then - * is included at the end of the - * header to undefine all those definitions. - * - * If we forget to include at the end - * of a public header, we want to get the "redefined" compiler warning - * to catch it. + * No include guards here: it is safe to include this file multiple + * times. */ /* - * Copyright (c) 2019 Philippe Proulx + * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -31,19 +25,8 @@ * SOFTWARE. */ -/* - * This is just extra protection, in case the user tries to include - * in user code: this is a redminder that - * this header is reserved for internal use. - * - * The correct way for a public header to include this is: - * - * #define __BT_FUNC_STATUS_ENABLE - * #include - * #undef __BT_FUNC_STATUS_ENABLE - */ -#ifndef __BT_FUNC_STATUS_ENABLE -# error Do NOT include in user code. +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." #endif /* @@ -54,37 +37,52 @@ */ /* Value is too large for the given data type */ -#define __BT_FUNC_STATUS_OVERFLOW -75 - -/* Invalid query parameters */ -#define __BT_FUNC_STATUS_INVALID_PARAMS -24 +#ifndef __BT_FUNC_STATUS_OVERFLOW_ERROR +# define __BT_FUNC_STATUS_OVERFLOW_ERROR -75 +#endif -/* Invalid query object */ -#define __BT_FUNC_STATUS_INVALID_OBJECT -23 /* Memory allocation error */ -#define __BT_FUNC_STATUS_MEMORY_ERROR -12 - -/* Plugin loading error */ -#define __BT_FUNC_STATUS_LOADING_ERROR -2 +#ifndef __BT_FUNC_STATUS_MEMORY_ERROR +# define __BT_FUNC_STATUS_MEMORY_ERROR -12 +#endif /* General error */ -#define __BT_FUNC_STATUS_ERROR -1 +#ifndef __BT_FUNC_STATUS_ERROR +# define __BT_FUNC_STATUS_ERROR -1 +#endif /* Saul Goodman */ -#define __BT_FUNC_STATUS_OK 0 +#ifndef __BT_FUNC_STATUS_OK +# define __BT_FUNC_STATUS_OK 0 +#endif /* End of iteration/consumption */ -#define __BT_FUNC_STATUS_END 1 +#ifndef __BT_FUNC_STATUS_END +# define __BT_FUNC_STATUS_END 1 +#endif /* Something can't be found */ -#define __BT_FUNC_STATUS_NOT_FOUND 2 +#ifndef __BT_FUNC_STATUS_NOT_FOUND +# define __BT_FUNC_STATUS_NOT_FOUND 2 +#endif -/* Try operation again later */ -#define __BT_FUNC_STATUS_AGAIN 11 +/* Object is interrupted */ +#ifndef __BT_FUNC_STATUS_INTERRUPTED +# define __BT_FUNC_STATUS_INTERRUPTED 4 +#endif -/* Unsupported operation */ -#define __BT_FUNC_STATUS_UNSUPPORTED 95 +/* No match found */ +#ifndef __BT_FUNC_STATUS_NO_MATCH +# define __BT_FUNC_STATUS_NO_MATCH 6 +#endif -/* Object is canceled */ -#define __BT_FUNC_STATUS_CANCELED 125 +/* Try operation again later */ +#ifndef __BT_FUNC_STATUS_AGAIN +# define __BT_FUNC_STATUS_AGAIN 11 +#endif + +/* Unknown query object */ +#ifndef __BT_FUNC_STATUS_UNKNOWN_OBJECT +# define __BT_FUNC_STATUS_UNKNOWN_OBJECT 42 +#endif