Commit 2a18a792e3674b24f2d6312c039571c64f75dacd

Vicent Marti 2010-12-22T22:43:39

Properly export all external symbols in Win32 Some external functions were not being exported because they were using the 'extern' keyword instead of the generic GIT_EXTERN() macro. Signed-off-by: Vicent Marti <tanoku@gmail.com>

diff --git a/src/delta-apply.h b/src/delta-apply.h
index 642442d..fc5d8cd 100644
--- a/src/delta-apply.h
+++ b/src/delta-apply.h
@@ -15,7 +15,7 @@
  * - GIT_SUCCESS on a successful delta unpack.
  * - GIT_ERROR if the delta is corrupt or doesn't match the base.
  */
-extern int git__delta_apply(
+GIT_EXTERN(int) git__delta_apply(
 	git_rawobj *out,
 	const unsigned char *base,
 	size_t base_len,
diff --git a/src/dir.h b/src/dir.h
index c01c3fa..bb77d35 100644
--- a/src/dir.h
+++ b/src/dir.h
@@ -22,10 +22,10 @@ typedef struct {
 	int first;
 } git__DIR;
 
-extern git__DIR *git__opendir(const char *);
-extern struct git__dirent *git__readdir(git__DIR *);
-extern void git__rewinddir(git__DIR *);
-extern int git__closedir(git__DIR *);
+GIT_EXTERN(git__DIR *) git__opendir(const char *);
+GIT_EXTERN(struct git__dirent *) git__readdir(git__DIR *);
+GIT_EXTERN(void) git__rewinddir(git__DIR *);
+GIT_EXTERN(int) git__closedir(git__DIR *);
 
 # ifndef GIT__WIN32_NO_WRAP_DIR
 #  define dirent git__dirent
diff --git a/src/fileops.h b/src/fileops.h
index 6656cdf..b90dedd 100644
--- a/src/fileops.h
+++ b/src/fileops.h
@@ -27,9 +27,9 @@ GIT_INLINE(int) git__mkdir(const char *path, int GIT_UNUSED(mode))
 	return mkdir(path);
 }
 
-extern int git__unlink(const char *path);
-extern int git__mkstemp(char *template);
-extern int git__fsync(int fd);
+GIT_EXTERN(int) git__unlink(const char *path);
+GIT_EXTERN(int) git__mkstemp(char *template);
+GIT_EXTERN(int) git__fsync(int fd);
 
 # ifndef GIT__WIN32_NO_HIDE_FILEOPS
 #  define unlink(p) git__unlink(p)
@@ -54,21 +54,21 @@ typedef struct {  /* file io buffer  */
 	size_t len;  /* data length  */
 } gitfo_buf;
 
-extern int gitfo_exists(const char *path);
-extern int gitfo_open(const char *path, int flags);
-extern int gitfo_creat(const char *path, int mode);
-extern int gitfo_isdir(const char *path);
-extern int gitfo_mkdir_recurs(const char *path, int mode);
+GIT_EXTERN(int) gitfo_exists(const char *path);
+GIT_EXTERN(int) gitfo_open(const char *path, int flags);
+GIT_EXTERN(int) gitfo_creat(const char *path, int mode);
+GIT_EXTERN(int) gitfo_isdir(const char *path);
+GIT_EXTERN(int) gitfo_mkdir_recurs(const char *path, int mode);
 #define gitfo_close(fd) close(fd)
 
-extern int gitfo_read(git_file fd, void *buf, size_t cnt);
-extern int gitfo_write(git_file fd, void *buf, size_t cnt);
+GIT_EXTERN(int) gitfo_read(git_file fd, void *buf, size_t cnt);
+GIT_EXTERN(int) gitfo_write(git_file fd, void *buf, size_t cnt);
 #define gitfo_lseek(f,n,w) lseek(f, n, w)
-extern off_t gitfo_size(git_file fd);
+GIT_EXTERN(off_t) gitfo_size(git_file fd);
 
-extern int gitfo_read_file(gitfo_buf *obj, const char *path);
-extern void gitfo_free_buf(gitfo_buf *obj);
-extern int gitfo_move_file(char *from, char *to);
+GIT_EXTERN(int) gitfo_read_file(gitfo_buf *obj, const char *path);
+GIT_EXTERN(void) gitfo_free_buf(gitfo_buf *obj);
+GIT_EXTERN(int) gitfo_move_file(char *from, char *to);
 
 #define gitfo_stat(p,b) stat(p, b)
 #define gitfo_fstat(f,b) fstat(f, b)
@@ -97,7 +97,7 @@ extern int gitfo_move_file(char *from, char *to);
  * - GIT_SUCCESS on success;
  * - GIT_EOSERR on an unspecified OS related error.
  */
-extern int gitfo_map_ro(
+GIT_EXTERN(int) gitfo_map_ro(
 	git_map *out,
 	git_file fd,
 	off_t begin,
@@ -107,7 +107,7 @@ extern int gitfo_map_ro(
  * Release the memory associated with a previous memory mapping.
  * @param map the mapping description previously configured.
  */
-extern void gitfo_free_map(git_map *map);
+GIT_EXTERN(void) gitfo_free_map(git_map *map);
 
 /**
  * Walk each directory entry, except '.' and '..', calling fn(state).
@@ -120,15 +120,15 @@ extern void gitfo_free_map(git_map *map);
  *		may modify the pathbuf, but only by appending new text.
  * @param state to pass to fn as the first arg.
  */
-extern int gitfo_dirent(
+GIT_EXTERN(int) gitfo_dirent(
 	char *pathbuf,
 	size_t pathmax,
 	int (*fn)(void *, char *),
 	void *state);
 
-extern gitfo_cache *gitfo_enable_caching(git_file fd, size_t cache_size);
-extern int gitfo_write_cached(gitfo_cache *ioc, void *buf, size_t len);
-extern int gitfo_flush_cached(gitfo_cache *ioc);
-extern int gitfo_close_cached(gitfo_cache *ioc);
+GIT_EXTERN(gitfo_cache *) gitfo_enable_caching(git_file fd, size_t cache_size);
+GIT_EXTERN(int) gitfo_write_cached(gitfo_cache *ioc, void *buf, size_t len);
+GIT_EXTERN(int) gitfo_flush_cached(gitfo_cache *ioc);
+GIT_EXTERN(int) gitfo_close_cached(gitfo_cache *ioc);
 
 #endif /* INCLUDE_fileops_h__ */
diff --git a/src/map.h b/src/map.h
index 3188ffd..2388bb3 100644
--- a/src/map.h
+++ b/src/map.h
@@ -25,7 +25,7 @@ typedef struct {  /* memory mapped buffer   */
 #endif
 } git_map;
 
-extern int git__mmap(git_map *out, size_t len, int prot, int flags, int fd, off_t offset);
-extern int git__munmap(git_map *map);
+GIT_EXTERN(int) git__mmap(git_map *out, size_t len, int prot, int flags, int fd, off_t offset);
+GIT_EXTERN(int) git__munmap(git_map *map);
 
 #endif /* INCLUDE_map_h__ */
diff --git a/src/thread-utils.h b/src/thread-utils.h
index 0395b97..864ecb7 100644
--- a/src/thread-utils.h
+++ b/src/thread-utils.h
@@ -84,6 +84,6 @@ typedef struct { int counter; } git_refcnt;
 
 #endif
 
-extern int git_online_cpus(void);
+GIT_EXTERN(int) git_online_cpus(void);
 
 #endif /* INCLUDE_thread_utils_h__ */
diff --git a/src/util.h b/src/util.h
index 5f64725..05f5a34 100644
--- a/src/util.h
+++ b/src/util.h
@@ -3,9 +3,9 @@
 
 #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
 
-extern void *git__malloc(size_t);
-extern void *git__calloc(size_t, size_t);
-extern char *git__strdup(const char *);
+GIT_EXTERN(void *) git__malloc(size_t);
+GIT_EXTERN(void *) git__calloc(size_t, size_t);
+GIT_EXTERN(char *) git__strdup(const char *);
 
 #ifndef GIT__NO_HIDE_MALLOC
 # define GIT__FORBID_MALLOC do_not_use_malloc_directly
@@ -26,15 +26,15 @@ extern char *git__strdup(const char *);
 # define strdup(a)          GIT__FORBID_MALLOC
 #endif
 
-extern int git__fmt(char *, size_t, const char *, ...)
+GIT_EXTERN(int) git__fmt(char *, size_t, const char *, ...)
 	GIT_FORMAT_PRINTF(3, 4);
-extern int git__prefixcmp(const char *str, const char *prefix);
-extern int git__suffixcmp(const char *str, const char *suffix);
+GIT_EXTERN(int) git__prefixcmp(const char *str, const char *prefix);
+GIT_EXTERN(int) git__suffixcmp(const char *str, const char *suffix);
 
-extern int git__dirname(char *dir, size_t n, char *path);
-extern int git__basename(char *base, size_t n, char *path);
+GIT_EXTERN(int) git__dirname(char *dir, size_t n, char *path);
+GIT_EXTERN(int) git__basename(char *base, size_t n, char *path);
 
-extern void git__hexdump(const char *buffer, size_t n);
+GIT_EXTERN(void) git__hexdump(const char *buffer, size_t n);
 
 /** @return true if p fits into the range of a size_t */
 GIT_INLINE(int) git__is_sizet(off_t p)