91 lines
2.3 KiB
Diff
91 lines
2.3 KiB
Diff
|
Patch-Source: https://github.com/libgit2/rugged/pull/964
|
||
|
safe as we apply the libgit2 fix to libgit.
|
||
|
--
|
||
|
From 508fbc2bcd8fdc400fcc4513b53d5205c4b7e9d4 Mon Sep 17 00:00:00 2001
|
||
|
From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= <cmn@dwim.me>
|
||
|
Date: Tue, 18 Jul 2023 10:27:37 +0200
|
||
|
Subject: [PATCH 1/3] Update libgit2 to v1.7.0
|
||
|
|
||
|
---
|
||
|
vendor/libgit2 | 2 +-
|
||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/ext/rugged/rugged_allocator.c b/ext/rugged/rugged_allocator.c
|
||
|
index 30ee537..0059af6 100644
|
||
|
--- a/ext/rugged/rugged_allocator.c
|
||
|
+++ b/ext/rugged/rugged_allocator.c
|
||
|
@@ -13,58 +13,11 @@ static void *rugged_gmalloc(size_t n, const char *file, int line)
|
||
|
return xmalloc(n);
|
||
|
}
|
||
|
|
||
|
-static void *rugged_gcalloc(size_t nelem, size_t elsize, const char *file, int line)
|
||
|
-{
|
||
|
- return xcalloc(nelem, elsize);
|
||
|
-}
|
||
|
-
|
||
|
-static char *rugged_gstrdup(const char *str, const char *file, int line)
|
||
|
-{
|
||
|
- return ruby_strdup(str);
|
||
|
-}
|
||
|
-
|
||
|
-static char *rugged_gstrndup(const char *str, size_t n, const char *file, int line)
|
||
|
-{
|
||
|
- size_t len;
|
||
|
- char *newstr;
|
||
|
-
|
||
|
- len = strnlen(str, n);
|
||
|
- if (len < n)
|
||
|
- n = len;
|
||
|
-
|
||
|
- newstr = xmalloc(n+1);
|
||
|
- memcpy(newstr, str, n);
|
||
|
- newstr[n] = '\0';
|
||
|
-
|
||
|
- return newstr;
|
||
|
-}
|
||
|
-
|
||
|
-static char *rugged_gsubstrdup(const char *str, size_t n, const char *file, int line)
|
||
|
-{
|
||
|
- char *newstr;
|
||
|
-
|
||
|
- newstr = xmalloc(n+1);
|
||
|
- memcpy(newstr, str, n);
|
||
|
- newstr[n] = '\0';
|
||
|
-
|
||
|
- return newstr;
|
||
|
-}
|
||
|
-
|
||
|
static void *rugged_grealloc(void *ptr, size_t size, const char *file, int line)
|
||
|
{
|
||
|
return xrealloc(ptr, size);
|
||
|
}
|
||
|
|
||
|
-static void *rugged_greallocarray(void *ptr, size_t nelem, size_t elsize, const char *file, int line)
|
||
|
-{
|
||
|
- return xrealloc2(ptr, nelem, elsize);
|
||
|
-}
|
||
|
-
|
||
|
-static void *rugged_gmallocarray(size_t nelem, size_t elsize, const char *file, int line)
|
||
|
-{
|
||
|
- return xmalloc2(nelem, elsize);
|
||
|
-}
|
||
|
-
|
||
|
static void rugged_gfree(void *ptr)
|
||
|
{
|
||
|
xfree(ptr);
|
||
|
@@ -75,14 +28,7 @@ void rugged_set_allocator(void)
|
||
|
git_allocator allocator;
|
||
|
|
||
|
allocator.gmalloc = rugged_gmalloc;
|
||
|
- allocator.gcalloc = rugged_gcalloc;
|
||
|
- allocator.gstrdup = rugged_gstrdup;
|
||
|
- allocator.gstrndup = rugged_gstrndup;
|
||
|
- allocator.gstrndup = rugged_gstrndup;
|
||
|
- allocator.gsubstrdup = rugged_gsubstrdup;
|
||
|
allocator.grealloc = rugged_grealloc;
|
||
|
- allocator.greallocarray = rugged_greallocarray;
|
||
|
- allocator.gmallocarray = rugged_gmallocarray;
|
||
|
allocator.gfree = rugged_gfree;
|
||
|
|
||
|
git_libgit2_opts(GIT_OPT_SET_ALLOCATOR, &allocator);
|