Reviewed-by: Ruoyu <lian...@ucweb.com>
On 2014年08月20日 17:07, Hitoshi Mitake wrote:
Cc: Ruoyu <lian...@ucweb.com>
Signed-off-by: Hitoshi Mitake <mitake.hito...@lab.ntt.co.jp>
---
include/util.h | 2 ++
lib/util.c | 12 ++++++++++++
2 files changed, 14 insertions(+)
diff --git a/include/util.h b/include/util.h
index 9da872d..69e114b 100644
--- a/include/util.h
+++ b/include/util.h
@@ -573,4 +573,6 @@ static inline uint64_t clock_get_time(void)
return (uint64_t)ts.tv_sec * 1000000000LL + (uint64_t)ts.tv_nsec;
}
+char *xstrdup(const char *s);
+
#endif
diff --git a/lib/util.c b/lib/util.c
index a5b7532..164f755 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -831,3 +831,15 @@ double get_time_interval(const struct timespec *start,
return ((end->tv_nsec - start->tv_nsec) * 0.000000001)
+ end->tv_sec - start->tv_sec;
}
+
+char *xstrdup(const char *s)
+{
+ char *ret;
+
+ ret = strdup(s);
+ if (!ret)
+ panic("Out of memory");
+
+ return ret;
+}
+
--
sheepdog mailing list
sheepdog@lists.wpkg.org
http://lists.wpkg.org/mailman/listinfo/sheepdog