summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 633d1fe)
raw | patch | inline | side by side (parent: 633d1fe)
author | Heikki Orsila <heikki.orsila@iki.fi> | |
Sun, 27 Apr 2008 09:48:30 +0000 (12:48 +0300) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 28 Apr 2008 05:22:14 +0000 (22:22 -0700) |
Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.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 a18235e6d053322a85805d1b07b631c6739deb93..167c3fe63a4fd9ca4abf5c16694e22a9ae22717b 100644 (file)
--- a/git-compat-util.h
+++ b/git-compat-util.h
return ret;
}
+/*
+ * xmemdupz() allocates (len + 1) bytes of memory, duplicates "len" bytes of
+ * "data" to the allocated memory, zero terminates the allocated memory,
+ * and returns a pointer to the allocated memory. If the allocation fails,
+ * the program dies.
+ */
static inline void *xmemdupz(const void *data, size_t len)
{
char *p = xmalloc(len + 1);
return ret;
}
+/*
+ * xread() is the same a read(), but it automatically restarts read()
+ * operations with a recoverable error (EAGAIN and EINTR). xread()
+ * DOES NOT GUARANTEE that "len" bytes is read even if the data is available.
+ */
static inline ssize_t xread(int fd, void *buf, size_t len)
{
ssize_t nr;
}
}
+/*
+ * xwrite() is the same a write(), but it automatically restarts write()
+ * operations with a recoverable error (EAGAIN and EINTR). xwrite() DOES NOT
+ * GUARANTEE that "len" bytes is written even if the operation is successful.
+ */
static inline ssize_t xwrite(int fd, const void *buf, size_t len)
{
ssize_t nr;