aboutsummaryrefslogtreecommitdiff
path: root/src/timer.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-05-10 20:27:18 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2011-05-10 20:40:37 +0300
commit3bf61e7ab82244cdeb00c6ba6d602d3cad9b64d4 (patch)
tree65bcc3fc7425af543a9f3a393abe5cdc3e11112c /src/timer.c
parent212825a21d8fa8ec90d7c5b9a1460f845958d445 (diff)
downloadwydawca-3bf61e7ab82244cdeb00c6ba6d602d3cad9b64d4.tar.gz
wydawca-3bf61e7ab82244cdeb00c6ba6d602d3cad9b64d4.tar.bz2
Remove vasprintf module.
Diffstat (limited to 'src/timer.c')
-rw-r--r--src/timer.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/timer.c b/src/timer.c
index 71f63f9..1634462 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -159,8 +159,9 @@ char *
timer_format_time (double t)
{
char *str = NULL;
+ size_t size = 0;
if (t < 600)
- asprintf (&str, "%0.3f", t);
+ grecs_asprintf (&str, &size, "%0.3f", t);
else
{
long int s, m, h, d;
@@ -174,12 +175,14 @@ timer_format_time (double t)
s -= m * 60;
if (d)
- asprintf (&str, "%ld+%02ld:%02ld:%02ld", d, h, m, s);
+ grecs_asprintf (&str, &size, "%ld+%02ld:%02ld:%02ld", d, h, m, s);
else if (h)
- asprintf (&str, "%02ld:%02ld:%02ld", h, m, s);
+ grecs_asprintf (&str, &size, "%02ld:%02ld:%02ld", h, m, s);
else
- asprintf (&str, "%02ld:%02ld", m, s);
+ grecs_asprintf (&str, &size, "%02ld:%02ld", m, s);
}
+ if (!str)
+ xalloc_die ();
return str;
}
@@ -203,7 +206,12 @@ _fill_meta (void *sym, void *data)
#define CREATE_DEF(arg) \
if (tp->num) \
{ \
- asprintf (&tp->def->kw, "timer:%s:%s", slot->name, #arg); \
+ char *buf = NULL; \
+ size_t size = 0; \
+ grecs_asprintf (&buf, &size, "timer:%s:%s", slot->name, #arg); \
+ if (!buf) \
+ xalloc_die (); \
+ tp->def->kw = buf; \
tp->def->storage = timer_format_time (__cat2__(timer_get_,arg) (slot)); \
tp->def->value = tp->def->storage; \
tp->def->expand = NULL; \

Return to:

Send suggestions and report system problems to the System administrator.