Merge branch 'maint'
* maint: gitweb: use decode_utf8 directly posix compatibility for t4200 Document 'opendiff' value in config.txt and git-mergetool.txt Allow PERL_PATH="/usr/bin/env perl" Make xstrndup common diff.c: fix "size cache" handling. http-fetch: Disable use of curl multi support for libcurl < 7.16.
This commit is contained in:
@ -197,6 +197,19 @@ static inline void *xmalloc(size_t size)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline char *xstrndup(const char *str, size_t len)
|
||||
{
|
||||
char *p;
|
||||
|
||||
p = memchr(str, '\0', len);
|
||||
if (p)
|
||||
len = p - str;
|
||||
p = xmalloc(len + 1);
|
||||
memcpy(p, str, len);
|
||||
p[len] = '\0';
|
||||
return p;
|
||||
}
|
||||
|
||||
static inline void *xrealloc(void *ptr, size_t size)
|
||||
{
|
||||
void *ret = realloc(ptr, size);
|
||||
|
Reference in New Issue
Block a user