summaryrefslogtreecommitdiffabout
path: root/src
authorSergey Poznyakoff <gray@gnu.org.ua>2011-05-10 17:27:18 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2011-05-10 17:40:37 (GMT)
commit3bf61e7ab82244cdeb00c6ba6d602d3cad9b64d4 (patch) (side-by-side diff)
tree65bcc3fc7425af543a9f3a393abe5cdc3e11112c /src
parent212825a21d8fa8ec90d7c5b9a1460f845958d445 (diff)
downloadwydawca-3bf61e7ab82244cdeb00c6ba6d602d3cad9b64d4.tar.gz
wydawca-3bf61e7ab82244cdeb00c6ba6d602d3cad9b64d4.tar.bz2
Remove vasprintf module.
Diffstat (limited to 'src') (more/less context) (show whitespace changes)
-rw-r--r--src/lock.c6
-rw-r--r--src/report.c5
-rw-r--r--src/timer.c18
-rw-r--r--src/triplet.c22
4 files changed, 36 insertions, 15 deletions
diff --git a/src/lock.c b/src/lock.c
index 1c3a657..bc8505c 100644
--- a/src/lock.c
+++ b/src/lock.c
@@ -180,2 +180,3 @@ wydawca_lock (const char *lockname)
char *tempname = NULL;
+ size_t size = 0;
int rc;
@@ -187,3 +188,3 @@ wydawca_lock (const char *lockname)
/* build the NFS hitching-post to the lock file */
- asprintf (&tempname, "%s.%lu.%lu.%s",
+ grecs_asprintf (&tempname, &size, "%s.%lu.%lu.%s",
lockname,
@@ -237,4 +238,5 @@ wydawca_lockname (const char *tag)
char *lockname = NULL;
+ size_t size = 0;
char *tagname = fix_tagname (tag);
- asprintf (&lockname, "%s/LCK.%s", lockdir, tagname);
+ grecs_asprintf (&lockname, &size, "%s/LCK.%s", lockdir, tagname);
if (!lockname)
diff --git a/src/report.c b/src/report.c
index 84a9592..b09c7c7 100644
--- a/src/report.c
+++ b/src/report.c
@@ -36,4 +36,6 @@ report_add (const char *fmt, ...)
char *str = NULL;
+ size_t size = 0;
+
va_start (ap, fmt);
- vasprintf (&str, fmt, ap);
+ grecs_vasprintf (&str, &size, fmt, ap);
va_end (ap);
@@ -44,2 +46,3 @@ report_add (const char *fmt, ...)
}
+ free (str);
}
diff --git a/src/timer.c b/src/timer.c
index 71f63f9..1634462 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -161,4 +161,5 @@ 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
@@ -176,8 +177,10 @@ timer_format_time (double t)
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;
@@ -205,3 +208,8 @@ _fill_meta (void *sym, void *data)
{ \
- 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)); \
diff --git a/src/triplet.c b/src/triplet.c
index 6bd9e6a..9f051db 100644
--- a/src/triplet.c
+++ b/src/triplet.c
@@ -352,3 +352,4 @@ format_file_data (struct file_triplet *trp, enum file_type type, char **pret)
struct tm *tm;
- char *buf;
+ char *buf = NULL;
+ size_t size = 0;
@@ -387,6 +388,8 @@ format_file_data (struct file_triplet *trp, enum file_type type, char **pret)
- asprintf (&buf,
+ if (grecs_asprintf (&buf, &size,
"%s %s %s %*s %s %s",
- modes, user_name, group_name, ugswidth - pad + slen, sptr,
- timebuf, info->name);
+ modes, user_name, group_name, ugswidth - pad + slen,
+ sptr,
+ timebuf, info->name))
+ xalloc_die ();
*pret = buf;
@@ -547,4 +550,6 @@ expand_email_user (struct metadef *def, void *data)
{
- asprintf (&def->storage, "\"%s\" <%s>",
- trp->uploader->realname, trp->uploader->email);
+ size_t size = 0;
+ if (grecs_asprintf (&def->storage, &size, "\"%s\" <%s>",
+ trp->uploader->realname, trp->uploader->email))
+ xalloc_die ();
def->value = def->storage;
@@ -593,3 +598,6 @@ expand_check_result (struct metadef *def, void *data)
char *p = umaxtostr (WTERMSIG (status), sbuf);
- asprintf (&def->storage, "SIG+%s", p);
+ size_t size = 0;
+ def->storage = NULL;
+ if (grecs_asprintf (&def->storage, &size, "SIG+%s", p))
+ xalloc_die ();
}

Return to:

Send suggestions and report system problems to the System administrator.