summaryrefslogtreecommitdiff
path: root/include/git2/odb_backend.h
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/odb_backend.h
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/odb_backend.h')
-rw-r--r--include/git2/odb_backend.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/include/git2/odb_backend.h b/include/git2/odb_backend.h
index 9199538ce..614d0d431 100644
--- a/include/git2/odb_backend.h
+++ b/include/git2/odb_backend.h
@@ -92,12 +92,12 @@ struct git_odb_stream {
/**
* Write at most `len` bytes into `buffer` and advance the stream.
*/
- int (*read)(git_odb_stream *stream, char *buffer, size_t len);
+ int GIT_CALLBACK(read)(git_odb_stream *stream, char *buffer, size_t len);
/**
* Write `len` bytes from `buffer` into the stream.
*/
- int (*write)(git_odb_stream *stream, const char *buffer, size_t len);
+ int GIT_CALLBACK(write)(git_odb_stream *stream, const char *buffer, size_t len);
/**
* Store the contents of the stream as an object with the id
@@ -109,7 +109,7 @@ struct git_odb_stream {
* - the final number of received bytes differs from the size declared
* with `git_odb_open_wstream()`
*/
- int (*finalize_write)(git_odb_stream *stream, const git_oid *oid);
+ int GIT_CALLBACK(finalize_write)(git_odb_stream *stream, const git_oid *oid);
/**
* Free the stream's memory.
@@ -117,16 +117,16 @@ struct git_odb_stream {
* This method might be called without a call to `finalize_write` if
* an error occurs or if the object is already present in the ODB.
*/
- void (*free)(git_odb_stream *stream);
+ void GIT_CALLBACK(free)(git_odb_stream *stream);
};
/** A stream to write a pack file to the ODB */
struct git_odb_writepack {
git_odb_backend *backend;
- int (*append)(git_odb_writepack *writepack, const void *data, size_t size, git_transfer_progress *stats);
- int (*commit)(git_odb_writepack *writepack, git_transfer_progress *stats);
- void (*free)(git_odb_writepack *writepack);
+ int GIT_CALLBACK(append)(git_odb_writepack *writepack, const void *data, size_t size, git_transfer_progress *stats);
+ int GIT_CALLBACK(commit)(git_odb_writepack *writepack, git_transfer_progress *stats);
+ void GIT_CALLBACK(free)(git_odb_writepack *writepack);
};
GIT_END_DECL