The following commit has been merged in the master branch:
commit d09cc137115dbb68b9e82f6683ce8df4d1b65286
Author: Guillem Jover <[email protected]>
Date: Fri Nov 11 05:17:08 2011 +0100
libdpkg: Add new m_strndup()
diff --git a/lib/dpkg/dpkg.h b/lib/dpkg/dpkg.h
index a242606..447c319 100644
--- a/lib/dpkg/dpkg.h
+++ b/lib/dpkg/dpkg.h
@@ -134,6 +134,7 @@ void setcloexec(int fd, const char* fn);
void *m_malloc(size_t);
void *m_realloc(void*, size_t);
char *m_strdup(const char *str);
+char *m_strndup(const char *str, size_t n);
int m_asprintf(char **strp, const char *fmt, ...) DPKG_ATTR_PRINTF(2);
void m_dup2(int oldfd, int newfd);
void m_pipe(int fds[2]);
diff --git a/lib/dpkg/mlib.c b/lib/dpkg/mlib.c
index 483bd43..a8ea3a4 100644
--- a/lib/dpkg/mlib.c
+++ b/lib/dpkg/mlib.c
@@ -67,6 +67,12 @@ m_strdup(const char *str)
return must_alloc(strdup(str));
}
+char *
+m_strndup(const char *str, size_t n)
+{
+ return must_alloc(strndup(str, n));
+}
+
int
m_asprintf(char **strp, const char *fmt, ...)
{
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]