summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2012-06-14 19:11:13 +0100
committerChris Young <chris@unsatisfactorysoftware.co.uk>2012-06-14 19:11:13 +0100
commita47cfd2211d4bceb6b1a9b0273b37693f452e50a (patch)
tree0e91136306726debe623239d07ac9c2f4fbe9e95 /src
parent17b45d801d6dd40566ec1b876b108eb033e6779a (diff)
parentd043013fea859f5eb6f677cad28319d093f1dbda (diff)
downloadlibgit2-a47cfd2211d4bceb6b1a9b0273b37693f452e50a.tar.gz
Merge branch 'development' into pull-req
Diffstat (limited to 'src')
-rwxr-xr-xsrc/amiga/map.c10
-rw-r--r--src/netops.c45
-rw-r--r--src/path.c13
-rw-r--r--src/pool.c2
-rw-r--r--src/posix.h10
-rw-r--r--src/ppc/sha1ppc.S.objbin4471 -> 0 bytes
6 files changed, 41 insertions, 39 deletions
diff --git a/src/amiga/map.c b/src/amiga/map.c
index d36bcbc9c..2fb065c8b 100755
--- a/src/amiga/map.c
+++ b/src/amiga/map.c
@@ -14,24 +14,22 @@
int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offset)
{
- int mprot = 0;
- int mflag = 0;
-
GIT_MMAP_VALIDATE(out, len, prot, flags);
out->data = NULL;
out->len = 0;
if ((prot & GIT_PROT_WRITE) && ((flags & GIT_MAP_TYPE) == GIT_MAP_SHARED)) {
- printf("Trying to map shared-writeable file!!!\n");
+ giterr_set(GITERR_OS, "Trying to map shared-writeable");
+ return -1;
}
- if(out->data = malloc(len)) {
+ if((out->data = malloc(len))) {
p_lseek(fd, offset, SEEK_SET);
p_read(fd, out->data, len);
}
- if (!out->data || out->data == MAP_FAILED) {
+ if (!out->data || (out->data == MAP_FAILED)) {
giterr_set(GITERR_OS, "Failed to mmap. Could not write data");
return -1;
}
diff --git a/src/netops.c b/src/netops.c
index 11295c5cd..98b5035ff 100644
--- a/src/netops.c
+++ b/src/netops.c
@@ -33,6 +33,16 @@
#include "buffer.h"
#include "transport.h"
+#ifdef NO_ADDRINFO
+struct addrinfo {
+ struct hostent *ai_hostent;
+ struct servent *ai_servent;
+ struct sockaddr_in ai_addr;
+ int ai_socktype;
+ long ai_port;
+};
+#endif
+
#ifdef GIT_WIN32
static void net_set_error(const char *str)
{
@@ -378,41 +388,38 @@ int gitno_connect(git_transport *t, const char *host, const char *port)
{
#ifndef NO_ADDRINFO
struct addrinfo *info = NULL, *p;
- struct addrinfo hints;
#else
int p;
- struct hostent *hent;
- struct servent *sent;
- struct sockaddr_in saddr;
- long port_num = 0;
#endif
+ struct addrinfo hints;
int ret;
GIT_SOCKET s = INVALID_SOCKET;
-#ifndef NO_ADDRINFO
+
memset(&hints, 0x0, sizeof(struct addrinfo));
- hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
+#ifndef NO_ADDRINFO
+ hints.ai_family = AF_UNSPEC;
if ((ret = getaddrinfo(host, port, &hints, &info)) < 0) {
giterr_set(GITERR_NET, "Failed to resolve address for %s: %s", host, gai_strerror(ret));
return -1;
}
#else
- hent = gethostbyname(host);
- sent = getservbyname(port, 0);
+ hints.ai_hostent = gethostbyname(host);
+ hints.ai_servent = getservbyname(port, 0);
- if(sent)
- port_num = sent->s_port;
+ if(hints.ai_servent)
+ hints.ai_port = hints.ai_servent->s_port;
else
- port_num = atol(port);
+ hints.ai_port = atol(port);
#endif
#ifndef NO_ADDRINFO
for (p = info; p != NULL; p = p->ai_next) {
s = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
#else
- for (p = 0; hent->h_addr_list[p] != NULL; p++) {
- s = socket(hent->h_addrtype, SOCK_STREAM, 0);
+ for (p = 0; hints.ai_hostent->h_addr_list[p] != NULL; p++) {
+ s = socket(hints.ai_hostent->h_addrtype, hints.ai_socktype, 0);
#endif
if (s == INVALID_SOCKET) {
net_set_error("error creating socket");
@@ -421,10 +428,10 @@ int gitno_connect(git_transport *t, const char *host, const char *port)
#ifndef NO_ADDRINFO
if (connect(s, p->ai_addr, (socklen_t)p->ai_addrlen) == 0)
#else
- memcpy(&saddr.sin_addr, hent->h_addr_list[p], hent->h_length);
- saddr.sin_family = hent->h_addrtype;
- saddr.sin_port = port_num;
- if (connect(s, (struct sockaddr *)&saddr, sizeof(struct sockaddr_in)) == 0)
+ memcpy(&hints.ai_addr.sin_addr, hints.ai_hostent->h_addr_list[p], hints.ai_hostent->h_length);
+ hints.ai_addr.sin_family = hints.ai_hostent->h_addrtype;
+ hints.ai_addr.sin_port = hints.ai_port;
+ if (connect(s, (struct sockaddr *)&hints.ai_addr, sizeof(struct sockaddr_in)) == 0)
#endif
break;
@@ -438,7 +445,7 @@ int gitno_connect(git_transport *t, const char *host, const char *port)
#ifndef NO_ADDRINFO
p == NULL) {
#else
- hent->h_addr_list[p] == NULL) {
+ hints.ai_hostent->h_addr_list[p] == NULL) {
#endif
giterr_set(GITERR_OS, "Failed to connect to %s", host);
return -1;
diff --git a/src/path.c b/src/path.c
index d48435bd8..1d85559a9 100644
--- a/src/path.c
+++ b/src/path.c
@@ -486,14 +486,9 @@ int git_path_cmp(
/* Taken from git.git */
GIT_INLINE(int) is_dot_or_dotdot(const char *name)
{
-#ifdef __amigaos4__
- /* This is irrelevant on AmigaOS */
- return 0;
-#else
return (name[0] == '.' &&
(name[1] == '\0' ||
(name[1] == '.' && name[2] == '\0')));
-#endif
}
int git_path_direach(
@@ -521,11 +516,7 @@ int git_path_direach(
de_buf = git__malloc(sizeof(struct dirent));
#endif
-#ifdef NO_READDIR_R
- while (de = readdir(dir)) {
-#else
- while (p_readdir_r(dir, de_buf, de) == 0 && de != NULL) {
-#endif
+ while (p_readdir_r(dir, de_buf, &de) == 0 && de != NULL) {
int result;
if (is_dot_or_dotdot(de->d_name))
@@ -583,7 +574,7 @@ int git_path_dirload(
path_len -= prefix_len;
need_slash = (path_len > 0 && path[path_len-1] != '/') ? 1 : 0;
- while ((error = p_readdir_r(dir, de_buf, de)) == 0 && de != NULL) {
+ while ((error = p_readdir_r(dir, de_buf, &de)) == 0 && de != NULL) {
char *entry_path;
size_t entry_len;
diff --git a/src/pool.c b/src/pool.c
index c5414b3b6..63bf09cee 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -276,7 +276,7 @@ uint32_t git_pool__system_page_size(void)
GetSystemInfo(&info);
size = (uint32_t)info.dwPageSize;
#elif defined(__amigaos4__)
- size = (uint32_t)1000000; // random value
+ size = (uint32_t)4096; /* 4K as there is no global value we can query */
#else
size = (uint32_t)sysconf(_SC_PAGE_SIZE);
#endif
diff --git a/src/posix.h b/src/posix.h
index 6b6c53db1..d423b7e07 100644
--- a/src/posix.h
+++ b/src/posix.h
@@ -84,9 +84,15 @@ extern int p_gettimeofday(struct timeval *tv, struct timezone *tz);
#endif
#ifndef NO_READDIR_R
-#define p_readdir_r(d,e,r) readdir_r(d,e,&r)
+#define p_readdir_r(d,e,r) readdir_r(d,e,r)
#else
-#define p_readdir_r(d,e,r) r = readdir(d)
+#include <dirent.h>
+GIT_INLINE(int) p_readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
+{
+ GIT_UNUSED(entry);
+ *result = readdir(dirp);
+ return 0;
+}
#endif
#endif
diff --git a/src/ppc/sha1ppc.S.obj b/src/ppc/sha1ppc.S.obj
deleted file mode 100644
index a7dad600f..000000000
--- a/src/ppc/sha1ppc.S.obj
+++ /dev/null
Binary files differ