summaryrefslogtreecommitdiff
path: root/include/git2/sys
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2019-01-09 18:25:10 +0000
committerEdward Thomson <ethomson@edwardthomson.com>2019-01-17 21:17:32 +0000
commit22d2062d954dcb88fa3dc65281d3f3d88ae87d68 (patch)
tree22852e22d6c571be8ccc1cdaece3d926360fc191 /include/git2/sys
parent57b753a0dc0db2d89341300470653e8a4d066c0b (diff)
downloadlibgit2-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')
-rw-r--r--include/git2/sys/alloc.h18
-rw-r--r--include/git2/sys/commit.h2
-rw-r--r--include/git2/sys/config.h26
-rw-r--r--include/git2/sys/filter.h12
-rw-r--r--include/git2/sys/merge.h6
-rw-r--r--include/git2/sys/odb_backend.h26
-rw-r--r--include/git2/sys/refdb_backend.h38
-rw-r--r--include/git2/sys/stream.h20
-rw-r--r--include/git2/sys/transport.h38
9 files changed, 93 insertions, 93 deletions
diff --git a/include/git2/sys/alloc.h b/include/git2/sys/alloc.h
index 4bc5323e2..642740dab 100644
--- a/include/git2/sys/alloc.h
+++ b/include/git2/sys/alloc.h
@@ -22,54 +22,54 @@ GIT_BEGIN_DECL
*/
typedef struct {
/* Allocate `n` bytes of memory */
- void *(*gmalloc)(size_t n, const char *file, int line);
+ void * GIT_CALLBACK(gmalloc)(size_t n, const char *file, int line);
/*
* Allocate memory for an array of `nelem` elements, where each element
* has a size of `elsize`. Returned memory shall be initialized to
* all-zeroes
*/
- void *(*gcalloc)(size_t nelem, size_t elsize, const char *file, int line);
+ void * GIT_CALLBACK(gcalloc)(size_t nelem, size_t elsize, const char *file, int line);
/* Allocate memory for the string `str` and duplicate its contents. */
- char *(*gstrdup)(const char *str, const char *file, int line);
+ char * GIT_CALLBACK(gstrdup)(const char *str, const char *file, int line);
/*
* Equivalent to the `gstrdup` function, but only duplicating at most
* `n + 1` bytes
*/
- char *(*gstrndup)(const char *str, size_t n, const char *file, int line);
+ char * GIT_CALLBACK(gstrndup)(const char *str, size_t n, const char *file, int line);
/*
* Equivalent to `gstrndup`, but will always duplicate exactly `n` bytes
* of `str`. Thus, out of bounds reads at `str` may happen.
*/
- char *(*gsubstrdup)(const char *str, size_t n, const char *file, int line);
+ char * GIT_CALLBACK(gsubstrdup)(const char *str, size_t n, const char *file, int line);
/*
* This function shall deallocate the old object `ptr` and return a
* pointer to a new object that has the size specified by `size`. In
* case `ptr` is `NULL`, a new array shall be allocated.
*/
- void *(*grealloc)(void *ptr, size_t size, const char *file, int line);
+ void * GIT_CALLBACK(grealloc)(void *ptr, size_t size, const char *file, int line);
/*
* This function shall be equivalent to `grealloc`, but allocating
* `neleme * elsize` bytes.
*/
- void *(*greallocarray)(void *ptr, size_t nelem, size_t elsize, const char *file, int line);
+ void * GIT_CALLBACK(greallocarray)(void *ptr, size_t nelem, size_t elsize, const char *file, int line);
/*
* This function shall allocate a new array of `nelem` elements, where
* each element has a size of `elsize` bytes.
*/
- void *(*gmallocarray)(size_t nelem, size_t elsize, const char *file, int line);
+ void * GIT_CALLBACK(gmallocarray)(size_t nelem, size_t elsize, const char *file, int line);
/*
* This function shall free the memory pointed to by `ptr`. In case
* `ptr` is `NULL`, this shall be a no-op.
*/
- void (*gfree)(void *ptr);
+ void GIT_CALLBACK(gfree)(void *ptr);
} git_allocator;
/**
diff --git a/include/git2/sys/commit.h b/include/git2/sys/commit.h
index 627d3ae2e..ba671061f 100644
--- a/include/git2/sys/commit.h
+++ b/include/git2/sys/commit.h
@@ -50,7 +50,7 @@ GIT_EXTERN(int) git_commit_create_from_ids(
* along with the user supplied payload. This should return a git_oid of
* the next parent or NULL if all parents have been provided.
*/
-typedef const git_oid *(*git_commit_parent_callback)(size_t idx, void *payload);
+typedef const git_oid * GIT_CALLBACK(git_commit_parent_callback)(size_t idx, void *payload);
/**
* Create a new commit in the repository with an callback to supply parents.
diff --git a/include/git2/sys/config.h b/include/git2/sys/config.h
index ed203226f..0a9005e35 100644
--- a/include/git2/sys/config.h
+++ b/include/git2/sys/config.h
@@ -39,12 +39,12 @@ struct git_config_iterator {
* Return the current entry and advance the iterator. The
* memory belongs to the library.
*/
- int (*next)(git_config_entry **entry, git_config_iterator *iter);
+ int GIT_CALLBACK(next)(git_config_entry **entry, git_config_iterator *iter);
/**
* Free the iterator
*/
- void (*free)(git_config_iterator *iter);
+ void GIT_CALLBACK(free)(git_config_iterator *iter);
};
/**
@@ -58,15 +58,15 @@ struct git_config_backend {
struct git_config *cfg;
/* Open means open the file/database and parse if necessary */
- int (*open)(struct git_config_backend *, git_config_level_t level, const git_repository *repo);
- int (*get)(struct git_config_backend *, const char *key, git_config_entry **entry);
- int (*set)(struct git_config_backend *, const char *key, const char *value);
- int (*set_multivar)(git_config_backend *cfg, const char *name, const char *regexp, const char *value);
- int (*del)(struct git_config_backend *, const char *key);
- int (*del_multivar)(struct git_config_backend *, const char *key, const char *regexp);
- int (*iterator)(git_config_iterator **, struct git_config_backend *);
+ int GIT_CALLBACK(open)(struct git_config_backend *, git_config_level_t level, const git_repository *repo);
+ int GIT_CALLBACK(get)(struct git_config_backend *, const char *key, git_config_entry **entry);
+ int GIT_CALLBACK(set)(struct git_config_backend *, const char *key, const char *value);
+ int GIT_CALLBACK(set_multivar)(git_config_backend *cfg, const char *name, const char *regexp, const char *value);
+ int GIT_CALLBACK(del)(struct git_config_backend *, const char *key);
+ int GIT_CALLBACK(del_multivar)(struct git_config_backend *, const char *key, const char *regexp);
+ int GIT_CALLBACK(iterator)(git_config_iterator **, struct git_config_backend *);
/** Produce a read-only version of this backend */
- int (*snapshot)(struct git_config_backend **, struct git_config_backend *);
+ int GIT_CALLBACK(snapshot)(struct git_config_backend **, struct git_config_backend *);
/**
* Lock this backend.
*
@@ -74,14 +74,14 @@ struct git_config_backend {
* backend. Any updates must not be visible to any other
* readers.
*/
- int (*lock)(struct git_config_backend *);
+ int GIT_CALLBACK(lock)(struct git_config_backend *);
/**
* Unlock the data store backing this backend. If success is
* true, the changes should be committed, otherwise rolled
* back.
*/
- int (*unlock)(struct git_config_backend *, int success);
- void (*free)(struct git_config_backend *);
+ int GIT_CALLBACK(unlock)(struct git_config_backend *, int success);
+ void GIT_CALLBACK(free)(struct git_config_backend *);
};
#define GIT_CONFIG_BACKEND_VERSION 1
#define GIT_CONFIG_BACKEND_INIT {GIT_CONFIG_BACKEND_VERSION}
diff --git a/include/git2/sys/filter.h b/include/git2/sys/filter.h
index 6d575d4fd..e43fde55c 100644
--- a/include/git2/sys/filter.h
+++ b/include/git2/sys/filter.h
@@ -138,7 +138,7 @@ GIT_EXTERN(uint32_t) git_filter_source_flags(const git_filter_source *src);
* initialization operations (in case libgit2 is being used in a way that
* doesn't need the filter).
*/
-typedef int (*git_filter_init_fn)(git_filter *self);
+typedef int GIT_CALLBACK(git_filter_init_fn)(git_filter *self);
/**
* Shutdown callback on filter
@@ -150,7 +150,7 @@ typedef int (*git_filter_init_fn)(git_filter *self);
*
* Typically this function will free the `git_filter` object itself.
*/
-typedef void (*git_filter_shutdown_fn)(git_filter *self);
+typedef void GIT_CALLBACK(git_filter_shutdown_fn)(git_filter *self);
/**
* Callback to decide if a given source needs this filter
@@ -172,7 +172,7 @@ typedef void (*git_filter_shutdown_fn)(git_filter *self);
* callback can use it. If a filter allocates and assigns a value to the
* `payload`, it will need a `cleanup` callback to free the payload.
*/
-typedef int (*git_filter_check_fn)(
+typedef int GIT_CALLBACK(git_filter_check_fn)(
git_filter *self,
void **payload, /* points to NULL ptr on entry, may be set */
const git_filter_source *src,
@@ -190,14 +190,14 @@ typedef int (*git_filter_check_fn)(
* The `payload` value will refer to any payload that was set by the
* `check` callback. It may be read from or written to as needed.
*/
-typedef int (*git_filter_apply_fn)(
+typedef int GIT_CALLBACK(git_filter_apply_fn)(
git_filter *self,
void **payload, /* may be read and/or set */
git_buf *to,
const git_buf *from,
const git_filter_source *src);
-typedef int (*git_filter_stream_fn)(
+typedef int GIT_CALLBACK(git_filter_stream_fn)(
git_writestream **out,
git_filter *self,
void **payload,
@@ -212,7 +212,7 @@ typedef int (*git_filter_stream_fn)(
* allocated a `payload` to keep per-source filter state, use this
* callback to free that payload and release resources as required.
*/
-typedef void (*git_filter_cleanup_fn)(
+typedef void GIT_CALLBACK(git_filter_cleanup_fn)(
git_filter *self,
void *payload);
diff --git a/include/git2/sys/merge.h b/include/git2/sys/merge.h
index f07997d2e..bd0a8a4b7 100644
--- a/include/git2/sys/merge.h
+++ b/include/git2/sys/merge.h
@@ -73,7 +73,7 @@ GIT_EXTERN(const git_merge_file_options *) git_merge_driver_source_file_options(
* initialization operations (in case libgit2 is being used in a way that
* doesn't need the merge driver).
*/
-typedef int (*git_merge_driver_init_fn)(git_merge_driver *self);
+typedef int GIT_CALLBACK(git_merge_driver_init_fn)(git_merge_driver *self);
/**
* Shutdown callback on merge driver
@@ -85,7 +85,7 @@ typedef int (*git_merge_driver_init_fn)(git_merge_driver *self);
*
* Typically this function will free the `git_merge_driver` object itself.
*/
-typedef void (*git_merge_driver_shutdown_fn)(git_merge_driver *self);
+typedef void GIT_CALLBACK(git_merge_driver_shutdown_fn)(git_merge_driver *self);
/**
* Callback to perform the merge.
@@ -105,7 +105,7 @@ typedef void (*git_merge_driver_shutdown_fn)(git_merge_driver *self);
*
* The `src` contains the data about the file to be merged.
*/
-typedef int (*git_merge_driver_apply_fn)(
+typedef int GIT_CALLBACK(git_merge_driver_apply_fn)(
git_merge_driver *self,
const char **path_out,
uint32_t *mode_out,
diff --git a/include/git2/sys/odb_backend.h b/include/git2/sys/odb_backend.h
index 75341e8ab..1a747570d 100644
--- a/include/git2/sys/odb_backend.h
+++ b/include/git2/sys/odb_backend.h
@@ -32,37 +32,37 @@ struct git_odb_backend {
* will be freed later. The buffer should be allocated using
* the function git_odb_backend_malloc to ensure that it can
* be safely freed later. */
- int (* read)(
+ int GIT_CALLBACK(read)(
void **, size_t *, git_object_t *, git_odb_backend *, const git_oid *);
/* To find a unique object given a prefix of its oid. The oid given
* must be so that the remaining (GIT_OID_HEXSZ - len)*4 bits are 0s.
*/
- int (* read_prefix)(
+ int GIT_CALLBACK(read_prefix)(
git_oid *, void **, size_t *, git_object_t *,
git_odb_backend *, const git_oid *, size_t);
- int (* read_header)(
+ int GIT_CALLBACK(read_header)(
size_t *, git_object_t *, git_odb_backend *, const git_oid *);
/**
* Write an object into the backend. The id of the object has
* already been calculated and is passed in.
*/
- int (* write)(
+ int GIT_CALLBACK(write)(
git_odb_backend *, const git_oid *, const void *, size_t, git_object_t);
- int (* writestream)(
+ int GIT_CALLBACK(writestream)(
git_odb_stream **, git_odb_backend *, git_off_t, git_object_t);
- int (* readstream)(
+ int GIT_CALLBACK(readstream)(
git_odb_stream **, size_t *, git_object_t *,
git_odb_backend *, const git_oid *);
- int (* exists)(
+ int GIT_CALLBACK(exists)(
git_odb_backend *, const git_oid *);
- int (* exists_prefix)(
+ int GIT_CALLBACK(exists_prefix)(
git_oid *, git_odb_backend *, const git_oid *, size_t);
/**
@@ -75,12 +75,12 @@ struct git_odb_backend {
* implementation to achieve this could be to internally invoke this
* endpoint on failed lookups (ie. `exists()`, `read()`, `read_header()`).
*/
- int (* refresh)(git_odb_backend *);
+ int GIT_CALLBACK(refresh)(git_odb_backend *);
- int (* foreach)(
+ int GIT_CALLBACK(foreach)(
git_odb_backend *, git_odb_foreach_cb cb, void *payload);
- int (* writepack)(
+ int GIT_CALLBACK(writepack)(
git_odb_writepack **, git_odb_backend *, git_odb *odb,
git_transfer_progress_cb progress_cb, void *progress_payload);
@@ -93,13 +93,13 @@ struct git_odb_backend {
* If callers implement this, they should return `0` if the object
* exists and was freshened, and non-zero otherwise.
*/
- int (* freshen)(git_odb_backend *, const git_oid *);
+ int GIT_CALLBACK(freshen)(git_odb_backend *, const git_oid *);
/**
* Frees any resources held by the odb (including the `git_odb_backend`
* itself). An odb backend implementation must provide this function.
*/
- void (* free)(git_odb_backend *);
+ void GIT_CALLBACK(free)(git_odb_backend *);
};
#define GIT_ODB_BACKEND_VERSION 1
diff --git a/include/git2/sys/refdb_backend.h b/include/git2/sys/refdb_backend.h
index 5129ad84a..2ed6efd5a 100644
--- a/include/git2/sys/refdb_backend.h
+++ b/include/git2/sys/refdb_backend.h
@@ -38,21 +38,21 @@ struct git_reference_iterator {
/**
* Return the current reference and advance the iterator.
*/
- int (*next)(
+ int GIT_CALLBACK(next)(
git_reference **ref,
git_reference_iterator *iter);
/**
* Return the name of the current reference and advance the iterator
*/
- int (*next_name)(
+ int GIT_CALLBACK(next_name)(
const char **ref_name,
git_reference_iterator *iter);
/**
* Free the iterator
*/
- void (*free)(
+ void GIT_CALLBACK(free)(
git_reference_iterator *iter);
};
@@ -64,7 +64,7 @@ struct git_refdb_backend {
* Queries the refdb backend to determine if the given ref_name
* exists. A refdb implementation must provide this function.
*/
- int (*exists)(
+ int GIT_CALLBACK(exists)(
int *exists,
git_refdb_backend *backend,
const char *ref_name);
@@ -73,7 +73,7 @@ struct git_refdb_backend {
* Queries the refdb backend for a given reference. A refdb
* implementation must provide this function.
*/
- int (*lookup)(
+ int GIT_CALLBACK(lookup)(
git_reference **out,
git_refdb_backend *backend,
const char *ref_name);
@@ -83,7 +83,7 @@ struct git_refdb_backend {
*
* A refdb implementation must provide this function.
*/
- int (*iterator)(
+ int GIT_CALLBACK(iterator)(
git_reference_iterator **iter,
struct git_refdb_backend *backend,
const char *glob);
@@ -92,12 +92,12 @@ struct git_refdb_backend {
* Writes the given reference to the refdb. A refdb implementation
* must provide this function.
*/
- int (*write)(git_refdb_backend *backend,
+ int GIT_CALLBACK(write)(git_refdb_backend *backend,
const git_reference *ref, int force,
const git_signature *who, const char *message,
const git_oid *old, const char *old_target);
- int (*rename)(
+ int GIT_CALLBACK(rename)(
git_reference **out, git_refdb_backend *backend,
const char *old_name, const char *new_name, int force,
const git_signature *who, const char *message);
@@ -107,7 +107,7 @@ struct git_refdb_backend {
* from the refdb. A refdb implementation must provide this
* function.
*/
- int (*del)(git_refdb_backend *backend, const char *ref_name, const git_oid *old_id, const char *old_target);
+ int GIT_CALLBACK(del)(git_refdb_backend *backend, const char *ref_name, const git_oid *old_id, const char *old_target);
/**
* Suggests that the given refdb compress or optimize its references.
@@ -116,56 +116,56 @@ struct git_refdb_backend {
* implementation may provide this function; if it is not provided,
* nothing will be done.
*/
- int (*compress)(git_refdb_backend *backend);
+ int GIT_CALLBACK(compress)(git_refdb_backend *backend);
/**
* Query whether a particular reference has a log (may be empty)
*/
- int (*has_log)(git_refdb_backend *backend, const char *refname);
+ int GIT_CALLBACK(has_log)(git_refdb_backend *backend, const char *refname);
/**
* Make sure a particular reference will have a reflog which
* will be appended to on writes.
*/
- int (*ensure_log)(git_refdb_backend *backend, const char *refname);
+ int GIT_CALLBACK(ensure_log)(git_refdb_backend *backend, const char *refname);
/**
* Frees any resources held by the refdb (including the `git_refdb_backend`
* itself). A refdb backend implementation must provide this function.
*/
- void (*free)(git_refdb_backend *backend);
+ void GIT_CALLBACK(free)(git_refdb_backend *backend);
/**
* Read the reflog for the given reference name.
*/
- int (*reflog_read)(git_reflog **out, git_refdb_backend *backend, const char *name);
+ int GIT_CALLBACK(reflog_read)(git_reflog **out, git_refdb_backend *backend, const char *name);
/**
* Write a reflog to disk.
*/
- int (*reflog_write)(git_refdb_backend *backend, git_reflog *reflog);
+ int GIT_CALLBACK(reflog_write)(git_refdb_backend *backend, git_reflog *reflog);
/**
* Rename a reflog
*/
- int (*reflog_rename)(git_refdb_backend *_backend, const char *old_name, const char *new_name);
+ int GIT_CALLBACK(reflog_rename)(git_refdb_backend *_backend, const char *old_name, const char *new_name);
/**
* Remove a reflog.
*/
- int (*reflog_delete)(git_refdb_backend *backend, const char *name);
+ int GIT_CALLBACK(reflog_delete)(git_refdb_backend *backend, const char *name);
/**
* Lock a reference. The opaque parameter will be passed to the unlock function
*/
- int (*lock)(void **payload_out, git_refdb_backend *backend, const char *refname);
+ int GIT_CALLBACK(lock)(void **payload_out, git_refdb_backend *backend, const char *refname);
/**
* Unlock a reference. Only one of target or symbolic_target
* will be set. success indicates whether to update the
* reference or discard the lock (if it's false)
*/
- int (*unlock)(git_refdb_backend *backend, void *payload, int success, int update_reflog,
+ int GIT_CALLBACK(unlock)(git_refdb_backend *backend, void *payload, int success, int update_reflog,
const git_reference *ref, const git_signature *sig, const char *message);
};
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
diff --git a/include/git2/sys/transport.h b/include/git2/sys/transport.h
index aac6f9f36..92cb32b17 100644
--- a/include/git2/sys/transport.h
+++ b/include/git2/sys/transport.h
@@ -35,7 +35,7 @@ typedef enum {
struct git_transport {
unsigned int version;
/* Set progress and error callbacks */
- int (*set_callbacks)(
+ int GIT_CALLBACK(set_callbacks)(
git_transport *transport,
git_transport_message_cb progress_cb,
git_transport_message_cb error_cb,
@@ -43,13 +43,13 @@ struct git_transport {
void *payload);
/* Set custom headers for HTTP requests */
- int (*set_custom_headers)(
+ int GIT_CALLBACK(set_custom_headers)(
git_transport *transport,
const git_strarray *custom_headers);
/* Connect the transport to the remote repository, using the given
* direction. */
- int (*connect)(
+ int GIT_CALLBACK(connect)(
git_transport *transport,
const char *url,
git_cred_acquire_cb cred_acquire_cb,
@@ -61,18 +61,18 @@ struct git_transport {
/* This function may be called after a successful call to
* connect(). The array returned is owned by the transport and
* is guaranteed until the next call of a transport function. */
- int (*ls)(
+ int GIT_CALLBACK(ls)(
const git_remote_head ***out,
size_t *size,
git_transport *transport);
/* Executes the push whose context is in the git_push object. */
- int(*push)(git_transport *transport, git_push *push, const git_remote_callbacks *callbacks);
+ int GIT_CALLBACK(push)(git_transport *transport, git_push *push, const git_remote_callbacks *callbacks);
/* This function may be called after a successful call to connect(), when
* the direction is FETCH. The function performs a negotiation to calculate
* the wants list for the fetch. */
- int (*negotiate_fetch)(
+ int GIT_CALLBACK(negotiate_fetch)(
git_transport *transport,
git_repository *repo,
const git_remote_head * const *refs,
@@ -81,7 +81,7 @@ struct git_transport {
/* This function may be called after a successful call to negotiate_fetch(),
* when the direction is FETCH. This function retrieves the pack file for
* the fetch from the remote end. */
- int (*download_pack)(
+ int GIT_CALLBACK(download_pack)(
git_transport *transport,
git_repository *repo,
git_transfer_progress *stats,
@@ -89,20 +89,20 @@ struct git_transport {
void *progress_payload);
/* Checks to see if the transport is connected */
- int (*is_connected)(git_transport *transport);
+ int GIT_CALLBACK(is_connected)(git_transport *transport);
/* Reads the flags value previously passed into connect() */
- int (*read_flags)(git_transport *transport, int *flags);
+ int GIT_CALLBACK(read_flags)(git_transport *transport, int *flags);
/* Cancels any outstanding transport operation */
- void (*cancel)(git_transport *transport);
+ void GIT_CALLBACK(cancel)(git_transport *transport);
/* This function is the reverse of connect() -- it terminates the
* connection to the remote end. */
- int (*close)(git_transport *transport);
+ int GIT_CALLBACK(close)(git_transport *transport);
/* Frees/destructs the git_transport object. */
- void (*free)(git_transport *transport);
+ void GIT_CALLBACK(free)(git_transport *transport);
};
#define GIT_TRANSPORT_VERSION 1
@@ -292,25 +292,25 @@ struct git_smart_subtransport_stream {
/* The owning subtransport */
git_smart_subtransport *subtransport;
- int (*read)(
+ int GIT_CALLBACK(read)(
git_smart_subtransport_stream *stream,
char *buffer,
size_t buf_size,
size_t *bytes_read);
- int (*write)(
+ int GIT_CALLBACK(write)(
git_smart_subtransport_stream *stream,
const char *buffer,
size_t len);
- void (*free)(
+ void GIT_CALLBACK(free)(
git_smart_subtransport_stream *stream);
};
/* An implementation of a subtransport which carries data for the
* smart transport */
struct git_smart_subtransport {
- int (* action)(
+ int GIT_CALLBACK(action)(
git_smart_subtransport_stream **out,
git_smart_subtransport *transport,
const char *url,
@@ -322,13 +322,13 @@ struct git_smart_subtransport {
*
* 1. UPLOADPACK_LS -> UPLOADPACK
* 2. RECEIVEPACK_LS -> RECEIVEPACK */
- int (*close)(git_smart_subtransport *transport);
+ int GIT_CALLBACK(close)(git_smart_subtransport *transport);
- void (*free)(git_smart_subtransport *transport);
+ void GIT_CALLBACK(free)(git_smart_subtransport *transport);
};
/* A function which creates a new subtransport for the smart transport */
-typedef int (*git_smart_subtransport_cb)(
+typedef int GIT_CALLBACK(git_smart_subtransport_cb)(
git_smart_subtransport **out,
git_transport* owner,
void* param);