aboutsummaryrefslogtreecommitdiff
path: root/win32/strbuf.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-04-13 22:43:15 +0200
committerNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-04-20 19:14:35 +0200
commit7ea0d136d0e819ddec8a5f794fa537b761ae4a3d (patch)
treec532929f7742fc107c683d3d1153e7b47b246aec /win32/strbuf.c
parentcd30b61a228591076fa68b28e30f4198057cb211 (diff)
downloadbusybox-w32-7ea0d136d0e819ddec8a5f794fa537b761ae4a3d.tar.gz
busybox-w32-7ea0d136d0e819ddec8a5f794fa537b761ae4a3d.tar.bz2
busybox-w32-7ea0d136d0e819ddec8a5f794fa537b761ae4a3d.zip
win32: remove git.c (probably not correct)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Diffstat (limited to '')
-rw-r--r--win32/strbuf.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/win32/strbuf.c b/win32/strbuf.c
index 98659d448..27a8157b2 100644
--- a/win32/strbuf.c
+++ b/win32/strbuf.c
@@ -90,6 +90,22 @@ void strbuf_tolower(struct strbuf *sb)
90 sb->buf[i] = tolower(sb->buf[i]); 90 sb->buf[i] = tolower(sb->buf[i]);
91} 91}
92 92
93void *xcalloc(size_t nmemb, size_t size)
94{
95 void *ret = calloc(nmemb, size);
96 if (!ret && (!nmemb || !size))
97 ret = calloc(1, 1);
98 if (!ret) {
99 ret = calloc(nmemb, size);
100 if (!ret && (!nmemb || !size))
101 ret = calloc(1, 1);
102 if (!ret)
103 die("Out of memory, calloc failed");
104 }
105 return ret;
106}
107
108
93struct strbuf **strbuf_split(const struct strbuf *sb, int delim) 109struct strbuf **strbuf_split(const struct strbuf *sb, int delim)
94{ 110{
95 int alloc = 2, pos = 0; 111 int alloc = 2, pos = 0;
@@ -266,7 +282,7 @@ ssize_t strbuf_read(struct strbuf *sb, int fd, size_t hint)
266 for (;;) { 282 for (;;) {
267 ssize_t cnt; 283 ssize_t cnt;
268 284
269 cnt = _xread(fd, sb->buf + sb->len, sb->alloc - sb->len - 1); 285 cnt = read(fd, sb->buf + sb->len, sb->alloc - sb->len - 1);
270 if (cnt < 0) { 286 if (cnt < 0) {
271 if (oldalloc == 0) 287 if (oldalloc == 0)
272 strbuf_release(sb); 288 strbuf_release(sb);