@@ -13,58 +13,11 @@ static void *rugged_gmalloc(size_t n, const char *file, int line)
1313 return xmalloc (n );
1414}
1515
16- static void * rugged_gcalloc (size_t nelem , size_t elsize , const char * file , int line )
17- {
18- return xcalloc (nelem , elsize );
19- }
20-
21- static char * rugged_gstrdup (const char * str , const char * file , int line )
22- {
23- return ruby_strdup (str );
24- }
25-
26- static char * rugged_gstrndup (const char * str , size_t n , const char * file , int line )
27- {
28- size_t len ;
29- char * newstr ;
30-
31- len = strnlen (str , n );
32- if (len < n )
33- n = len ;
34-
35- newstr = xmalloc (n + 1 );
36- memcpy (newstr , str , n );
37- newstr [n ] = '\0' ;
38-
39- return newstr ;
40- }
41-
42- static char * rugged_gsubstrdup (const char * str , size_t n , const char * file , int line )
43- {
44- char * newstr ;
45-
46- newstr = xmalloc (n + 1 );
47- memcpy (newstr , str , n );
48- newstr [n ] = '\0' ;
49-
50- return newstr ;
51- }
52-
5316static void * rugged_grealloc (void * ptr , size_t size , const char * file , int line )
5417{
5518 return xrealloc (ptr , size );
5619}
5720
58- static void * rugged_greallocarray (void * ptr , size_t nelem , size_t elsize , const char * file , int line )
59- {
60- return xrealloc2 (ptr , nelem , elsize );
61- }
62-
63- static void * rugged_gmallocarray (size_t nelem , size_t elsize , const char * file , int line )
64- {
65- return xmalloc2 (nelem , elsize );
66- }
67-
6821static void rugged_gfree (void * ptr )
6922{
7023 xfree (ptr );
@@ -75,14 +28,7 @@ void rugged_set_allocator(void)
7528 git_allocator allocator ;
7629
7730 allocator .gmalloc = rugged_gmalloc ;
78- allocator .gcalloc = rugged_gcalloc ;
79- allocator .gstrdup = rugged_gstrdup ;
80- allocator .gstrndup = rugged_gstrndup ;
81- allocator .gstrndup = rugged_gstrndup ;
82- allocator .gsubstrdup = rugged_gsubstrdup ;
8331 allocator .grealloc = rugged_grealloc ;
84- allocator .greallocarray = rugged_greallocarray ;
85- allocator .gmallocarray = rugged_gmallocarray ;
8632 allocator .gfree = rugged_gfree ;
8733
8834 git_libgit2_opts (GIT_OPT_SET_ALLOCATOR , & allocator );
0 commit comments