diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2019-01-09 18:25:10 +0000 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2019-01-17 21:17:32 +0000 |
| commit | 22d2062d954dcb88fa3dc65281d3f3d88ae87d68 (patch) | |
| tree | 22852e22d6c571be8ccc1cdaece3d926360fc191 /include/git2/sys/stream.h | |
| parent | 57b753a0dc0db2d89341300470653e8a4d066c0b (diff) | |
| download | libgit2-22d2062d954dcb88fa3dc65281d3f3d88ae87d68.tar.gz | |
Introduce GIT_CALLBACK macro to enforce cdecl
Since we now always build the library with cdecl calling conventions,
our callbacks should be decorated as such so that users will not be able
to provide callbacks defined with other calling conventions.
The `GIT_CALLBACK` macro will inject the `__cdecl` attribute as
appropriate.
Diffstat (limited to 'include/git2/sys/stream.h')
| -rw-r--r-- | include/git2/sys/stream.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/include/git2/sys/stream.h b/include/git2/sys/stream.h index 938793124..255c93e2b 100644 --- a/include/git2/sys/stream.h +++ b/include/git2/sys/stream.h @@ -31,13 +31,13 @@ typedef struct git_stream { int encrypted; int proxy_support; - int (*connect)(struct git_stream *); - int (*certificate)(git_cert **, struct git_stream *); - int (*set_proxy)(struct git_stream *, const git_proxy_options *proxy_opts); - ssize_t (*read)(struct git_stream *, void *, size_t); - ssize_t (*write)(struct git_stream *, const char *, size_t, int); - int (*close)(struct git_stream *); - void (*free)(struct git_stream *); + int GIT_CALLBACK(connect)(struct git_stream *); + int GIT_CALLBACK(certificate)(git_cert **, struct git_stream *); + int GIT_CALLBACK(set_proxy)(struct git_stream *, const git_proxy_options *proxy_opts); + ssize_t GIT_CALLBACK(read)(struct git_stream *, void *, size_t); + ssize_t GIT_CALLBACK(write)(struct git_stream *, const char *, size_t, int); + int GIT_CALLBACK(close)(struct git_stream *); + void GIT_CALLBACK(free)(struct git_stream *); } git_stream; typedef struct { @@ -54,7 +54,7 @@ typedef struct { * service name * @return 0 or an error code */ - int (*init)(git_stream **out, const char *host, const char *port); + int GIT_CALLBACK(init)(git_stream **out, const char *host, const char *port); /** * Called to create a new connection on top of the given stream. If @@ -68,7 +68,7 @@ typedef struct { * for certificate validation * @return 0 or an error code */ - int (*wrap)(git_stream **out, git_stream *in, const char *host); + int GIT_CALLBACK(wrap)(git_stream **out, git_stream *in, const char *host); } git_stream_registration; /** @@ -111,7 +111,7 @@ GIT_EXTERN(int) git_stream_register( * @deprecated Provide a git_stream_registration to git_stream_register * @see git_stream_registration */ -typedef int (*git_stream_cb)(git_stream **out, const char *host, const char *port); +typedef int GIT_CALLBACK(git_stream_cb)(git_stream **out, const char *host, const char *port); /** * Register a TLS stream constructor for the library to use. This stream |
