summaryrefslogtreecommitdiff
path: root/include/git2/sys/config.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/sys/config.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/sys/config.h')
-rw-r--r--include/git2/sys/config.h26
1 files changed, 13 insertions, 13 deletions
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}