summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c415162)
raw | patch | inline | side by side (parent: c415162)
author | Jonathan Nieder <jrnieder@gmail.com> | |
Sun, 21 Mar 2010 00:43:32 +0000 (19:43 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 21 Mar 2010 03:36:11 +0000 (20:36 -0700) |
The mempcpy() function was added in glibc 2.1. It is quite handy, so
add an implementation for cross-platform use.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
add an implementation for cross-platform use.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-compat-util.h | patch | blob | history |
diff --git a/git-compat-util.h b/git-compat-util.h
index a3c45373669cd8482c04d5815862ed36a153572d..9bed5a0b47b57d64c559faf09250166c77906ceb 100644 (file)
--- a/git-compat-util.h
+++ b/git-compat-util.h
#ifdef __GLIBC_PREREQ
#if __GLIBC_PREREQ(2, 1)
#define HAVE_STRCHRNUL
+#define HAVE_MEMPCPY
#endif
#endif
}
#endif
+#ifndef HAVE_MEMPCPY
+#define mempcpy gitmempcpy
+static inline void *gitmempcpy(void *dest, const void *src, size_t n)
+{
+ return (char *)memcpy(dest, src, n) + n;
+}
+#endif
+
extern void release_pack_memory(size_t, int);
extern char *xstrdup(const char *str);