diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-05-10 20:27:18 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-05-10 20:40:37 +0300 |
commit | 3bf61e7ab82244cdeb00c6ba6d602d3cad9b64d4 (patch) | |
tree | 65bcc3fc7425af543a9f3a393abe5cdc3e11112c /src | |
parent | 212825a21d8fa8ec90d7c5b9a1460f845958d445 (diff) | |
download | wydawca-3bf61e7ab82244cdeb00c6ba6d602d3cad9b64d4.tar.gz wydawca-3bf61e7ab82244cdeb00c6ba6d602d3cad9b64d4.tar.bz2 |
Remove vasprintf module.
Diffstat (limited to 'src')
-rw-r--r-- | src/lock.c | 12 | ||||
-rw-r--r-- | src/report.c | 5 | ||||
-rw-r--r-- | src/timer.c | 18 | ||||
-rw-r--r-- | src/triplet.c | 24 |
4 files changed, 40 insertions, 19 deletions
@@ -180,2 +180,3 @@ wydawca_lock (const char *lockname) | |||
180 | char *tempname = NULL; | 180 | char *tempname = NULL; |
181 | size_t size = 0; | ||
181 | int rc; | 182 | int rc; |
@@ -187,6 +188,6 @@ wydawca_lock (const char *lockname) | |||
187 | /* build the NFS hitching-post to the lock file */ | 188 | /* build the NFS hitching-post to the lock file */ |
188 | asprintf (&tempname, "%s.%lu.%lu.%s", | 189 | grecs_asprintf (&tempname, &size, "%s.%lu.%lu.%s", |
189 | lockname, | 190 | lockname, |
190 | (unsigned long) getpid (), | 191 | (unsigned long) getpid (), |
191 | (unsigned long) time (NULL), xgethostname ()); | 192 | (unsigned long) time (NULL), xgethostname ()); |
192 | if (!tempname) | 193 | if (!tempname) |
@@ -237,4 +238,5 @@ wydawca_lockname (const char *tag) | |||
237 | char *lockname = NULL; | 238 | char *lockname = NULL; |
239 | size_t size = 0; | ||
238 | char *tagname = fix_tagname (tag); | 240 | char *tagname = fix_tagname (tag); |
239 | asprintf (&lockname, "%s/LCK.%s", lockdir, tagname); | 241 | grecs_asprintf (&lockname, &size, "%s/LCK.%s", lockdir, tagname); |
240 | if (!lockname) | 242 | 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, ...) | |||
36 | char *str = NULL; | 36 | char *str = NULL; |
37 | size_t size = 0; | ||
38 | |||
37 | va_start (ap, fmt); | 39 | va_start (ap, fmt); |
38 | vasprintf (&str, fmt, ap); | 40 | grecs_vasprintf (&str, &size, fmt, ap); |
39 | va_end (ap); | 41 | va_end (ap); |
@@ -44,2 +46,3 @@ report_add (const char *fmt, ...) | |||
44 | } | 46 | } |
47 | free (str); | ||
45 | } | 48 | } |
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) | |||
161 | char *str = NULL; | 161 | char *str = NULL; |
162 | size_t size = 0; | ||
162 | if (t < 600) | 163 | if (t < 600) |
163 | asprintf (&str, "%0.3f", t); | 164 | grecs_asprintf (&str, &size, "%0.3f", t); |
164 | else | 165 | else |
@@ -176,8 +177,10 @@ timer_format_time (double t) | |||
176 | if (d) | 177 | if (d) |
177 | asprintf (&str, "%ld+%02ld:%02ld:%02ld", d, h, m, s); | 178 | grecs_asprintf (&str, &size, "%ld+%02ld:%02ld:%02ld", d, h, m, s); |
178 | else if (h) | 179 | else if (h) |
179 | asprintf (&str, "%02ld:%02ld:%02ld", h, m, s); | 180 | grecs_asprintf (&str, &size, "%02ld:%02ld:%02ld", h, m, s); |
180 | else | 181 | else |
181 | asprintf (&str, "%02ld:%02ld", m, s); | 182 | grecs_asprintf (&str, &size, "%02ld:%02ld", m, s); |
182 | } | 183 | } |
184 | if (!str) | ||
185 | xalloc_die (); | ||
183 | return str; | 186 | return str; |
@@ -205,3 +208,8 @@ _fill_meta (void *sym, void *data) | |||
205 | { \ | 208 | { \ |
206 | asprintf (&tp->def->kw, "timer:%s:%s", slot->name, #arg); \ | 209 | char *buf = NULL; \ |
210 | size_t size = 0; \ | ||
211 | grecs_asprintf (&buf, &size, "timer:%s:%s", slot->name, #arg); \ | ||
212 | if (!buf) \ | ||
213 | xalloc_die (); \ | ||
214 | tp->def->kw = buf; \ | ||
207 | tp->def->storage = timer_format_time (__cat2__(timer_get_,arg) (slot)); \ | 215 | 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) | |||
352 | struct tm *tm; | 352 | struct tm *tm; |
353 | char *buf; | 353 | char *buf = NULL; |
354 | size_t size = 0; | ||
354 | 355 | ||
@@ -387,6 +388,8 @@ format_file_data (struct file_triplet *trp, enum file_type type, char **pret) | |||
387 | 388 | ||
388 | asprintf (&buf, | 389 | if (grecs_asprintf (&buf, &size, |
389 | "%s %s %s %*s %s %s", | 390 | "%s %s %s %*s %s %s", |
390 | modes, user_name, group_name, ugswidth - pad + slen, sptr, | 391 | modes, user_name, group_name, ugswidth - pad + slen, |
391 | timebuf, info->name); | 392 | sptr, |
393 | timebuf, info->name)) | ||
394 | xalloc_die (); | ||
392 | *pret = buf; | 395 | *pret = buf; |
@@ -547,4 +550,6 @@ expand_email_user (struct metadef *def, void *data) | |||
547 | { | 550 | { |
548 | asprintf (&def->storage, "\"%s\" <%s>", | 551 | size_t size = 0; |
549 | trp->uploader->realname, trp->uploader->email); | 552 | if (grecs_asprintf (&def->storage, &size, "\"%s\" <%s>", |
553 | trp->uploader->realname, trp->uploader->email)) | ||
554 | xalloc_die (); | ||
550 | def->value = def->storage; | 555 | def->value = def->storage; |
@@ -593,3 +598,6 @@ expand_check_result (struct metadef *def, void *data) | |||
593 | char *p = umaxtostr (WTERMSIG (status), sbuf); | 598 | char *p = umaxtostr (WTERMSIG (status), sbuf); |
594 | asprintf (&def->storage, "SIG+%s", p); | 599 | size_t size = 0; |
600 | def->storage = NULL; | ||
601 | if (grecs_asprintf (&def->storage, &size, "SIG+%s", p)) | ||
602 | xalloc_die (); | ||
595 | } | 603 | } |