summaryrefslogtreecommitdiff
path: root/ustring.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>1999-09-02 12:35:02 +0000
committerSimon Tatham <anakin@pobox.com>1999-09-02 12:35:02 +0000
commitd3c026f08f629659b5efe23fe8bffd3cf9b845f6 (patch)
treee81d86bf7d706e0ac4c7a9a644ab193cd4f03e3c /ustring.c
parent5842eaaf51d9045bc0b199f0b5e82dfc614b2e0c (diff)
downloadhalibut-d3c026f08f629659b5efe23fe8bffd3cf9b845f6.zip
halibut-d3c026f08f629659b5efe23fe8bffd3cf9b845f6.tar.gz
halibut-d3c026f08f629659b5efe23fe8bffd3cf9b845f6.tar.bz2
halibut-d3c026f08f629659b5efe23fe8bffd3cf9b845f6.tar.xz
Redo memory allocation to use mknew macro
[originally from svn r214]
Diffstat (limited to 'ustring.c')
-rw-r--r--ustring.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ustring.c b/ustring.c
index 86f013a..42c5683 100644
--- a/ustring.c
+++ b/ustring.c
@@ -9,10 +9,10 @@
wchar_t *ustrdup(wchar_t *s) {
wchar_t *r;
if (s) {
- r = smalloc((1+ustrlen(s)) * sizeof(wchar_t));
+ r = mknewa(wchar_t, 1+ustrlen(s));
ustrcpy(r, s);
} else {
- r = smalloc(1);
+ r = mknew(wchar_t);
*r = 0;
}
return r;
@@ -85,7 +85,7 @@ wchar_t *ustrftime(wchar_t *wfmt, struct tm *timespec) {
*/
if (wfmt) {
len = ustrlen(wfmt);
- fmt = smalloc(2+len);
+ fmt = mknewa(char, 2+len);
ustrtoa(wfmt, fmt+1, len+1);
fmt[0] = ' ';
} else
@@ -93,15 +93,15 @@ wchar_t *ustrftime(wchar_t *wfmt, struct tm *timespec) {
while (1) {
size += USTRFTIME_DELTA;
- blk = srealloc(blk, size);
+ blk = resize((char *)blk, size);
len = strftime((char *)blk, size-1, fmt, timespec);
if (len > 0)
break;
}
/* Note: +1 for the terminating 0, -1 for the initial space in fmt */
- wblk = srealloc(blk, len * sizeof(wchar_t));
- text = smalloc(len);
+ wblk = resize((wchar_t *)blk, len);
+ text = mknewa(char, len);
strftime(text, len, fmt+1, timespec);
/*
* We operate in the C locale, so this all ought to be kosher