From: Ralph Corderoy Date: Mon, 28 Aug 2017 18:47:23 +0000 (+0100) Subject: Add ENDNULL macro for gcc's `sentinel' function attribute. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/8b10463acb041e438ca60a760ea176fc5a1623f4?ds=inline Add ENDNULL macro for gcc's `sentinel' function attribute. Annotate a few prototypes with it. --- diff --git a/h/mh.h b/h/mh.h index bb06366b..2723a42a 100644 --- a/h/mh.h +++ b/h/mh.h @@ -47,6 +47,7 @@ typedef unsigned char boolean; /* not int so we can pack in a structure */ #define MALLOC __attribute__((malloc)) #define NONNULL(...) __attribute__((nonnull(__VA_ARGS__))) #define PURE __attribute__((pure)) +#define ENDNULL __attribute__((sentinel)) #define NMH_UNUSED(i) (void) i #else #define NORETURN @@ -56,6 +57,7 @@ typedef unsigned char boolean; /* not int so we can pack in a structure */ #define MALLOC #define NONNULL(...) #define PURE +#define ENDNULL #define NMH_UNUSED(i) i #endif diff --git a/h/prototypes.h b/h/prototypes.h index ab9e83d7..0c2d7bdb 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -44,7 +44,7 @@ char **brkstring (char *, char *, char *) NONNULL(1); int check_charset (char *, int); int client(char *, char *, char *, int, int); void closefds(int); -char *concat (const char *, ...); +char *concat (const char *, ...) ENDNULL; int context_del (char *); char *context_find (const char *) PURE; char *context_find_by_type (const char *, const char *, const char *); diff --git a/sbr/oauth.c b/sbr/oauth.c index 8e3d6b05..3a8d2918 100755 --- a/sbr/oauth.c +++ b/sbr/oauth.c @@ -125,8 +125,8 @@ struct curl_ctx { char res_body[RESPONSE_BODY_MAX]; }; -static boolean get_json_strings(const char *, size_t, FILE *, ...); -static boolean make_query_url(char *, size_t, CURL *, const char *, ...); +static boolean get_json_strings(const char *, size_t, FILE *, ...) ENDNULL; +static boolean make_query_url(char *, size_t, CURL *, const char *, ...) ENDNULL; static boolean post(struct curl_ctx *, const char *, const char *); int