aboutsummaryrefslogtreecommitdiff
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
parent212825a21d8fa8ec90d7c5b9a1460f845958d445 (diff)
downloadwydawca-3bf61e7ab82244cdeb00c6ba6d602d3cad9b64d4.tar.gz
wydawca-3bf61e7ab82244cdeb00c6ba6d602d3cad9b64d4.tar.bz2
Remove vasprintf module.
-rw-r--r--gnulib.modules3
-rw-r--r--src/lock.c6
-rw-r--r--src/report.c5
-rw-r--r--src/timer.c18
-rw-r--r--src/triplet.c22
5 files changed, 36 insertions, 18 deletions
diff --git a/gnulib.modules b/gnulib.modules
index f274913..9446f4b 100644
--- a/gnulib.modules
+++ b/gnulib.modules
@@ -1,6 +1,5 @@
1xalloc 1xalloc
2c-ctype 2c-ctype
3fnmatch
4obstack 3obstack
5progname 4progname
6getline 5getline
@@ -9,7 +8,5 @@ save-cwd
9backupfile 8backupfile
10strerror 9strerror
11sysexits 10sysexits
12vasprintf
13inttostr 11inttostr
14strftime
15xgethostname 12xgethostname
diff --git a/src/lock.c b/src/lock.c
index 1c3a657..bc8505c 100644
--- a/src/lock.c
+++ b/src/lock.c
@@ -178,6 +178,7 @@ int
178wydawca_lock (const char *lockname) 178wydawca_lock (const char *lockname)
179{ 179{
180 char *tempname = NULL; 180 char *tempname = NULL;
181 size_t size = 0;
181 int rc; 182 int rc;
182 183
183 if (!enable_locking) 184 if (!enable_locking)
@@ -185,7 +186,7 @@ wydawca_lock (const char *lockname)
185 expire_stale_lock (lockname); 186 expire_stale_lock (lockname);
186 187
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 ());
@@ -235,8 +236,9 @@ char *
235wydawca_lockname (const char *tag) 236wydawca_lockname (const char *tag)
236{ 237{
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)
241 xalloc_die (); 243 xalloc_die ();
242 free (tagname); 244 free (tagname);
diff --git a/src/report.c b/src/report.c
index 84a9592..b09c7c7 100644
--- a/src/report.c
+++ b/src/report.c
@@ -34,14 +34,17 @@ report_add (const char *fmt, ...)
34{ 34{
35 va_list ap; 35 va_list ap;
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);
40 if (str) 42 if (str)
41 { 43 {
42 obstack_grow (&report_stk, str, strlen (str)); 44 obstack_grow (&report_stk, str, strlen (str));
43 obstack_1grow (&report_stk, '\n'); 45 obstack_1grow (&report_stk, '\n');
44 } 46 }
47 free (str);
45} 48}
46 49
47void 50void
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 *
159timer_format_time (double t) 159timer_format_time (double t)
160{ 160{
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
165 { 166 {
166 long int s, m, h, d; 167 long int s, m, h, d;
@@ -174,12 +175,14 @@ timer_format_time (double t)
174 s -= m * 60; 175 s -= m * 60;
175 176
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;
184} 187}
185 188
@@ -203,7 +206,12 @@ _fill_meta (void *sym, void *data)
203#define CREATE_DEF(arg) \ 206#define CREATE_DEF(arg) \
204 if (tp->num) \ 207 if (tp->num) \
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)); \
208 tp->def->value = tp->def->storage; \ 216 tp->def->value = tp->def->storage; \
209 tp->def->expand = NULL; \ 217 tp->def->expand = NULL; \
diff --git a/src/triplet.c b/src/triplet.c
index 6bd9e6a..9f051db 100644
--- a/src/triplet.c
+++ b/src/triplet.c
@@ -350,7 +350,8 @@ format_file_data (struct file_triplet *trp, enum file_type type, char **pret)
350 char *user_name; 350 char *user_name;
351 char *group_name; 351 char *group_name;
352 struct tm *tm; 352 struct tm *tm;
353 char *buf; 353 char *buf = NULL;
354 size_t size = 0;
354 355
355 if (!info->name) 356 if (!info->name)
356 return 1; 357 return 1;
@@ -385,10 +386,12 @@ format_file_data (struct file_triplet *trp, enum file_type type, char **pret)
385 if (pad > ugswidth) 386 if (pad > ugswidth)
386 ugswidth = pad; 387 ugswidth = pad;
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;
393 return 0; 396 return 0;
394} 397}
@@ -545,8 +548,10 @@ expand_email_user (struct metadef *def, void *data)
545 struct file_triplet *trp = data; 548 struct file_triplet *trp = data;
546 if (trp->uploader) 549 if (trp->uploader)
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;
551 } 556 }
552 return def->value; 557 return def->value;
@@ -591,7 +596,10 @@ expand_check_result (struct metadef *def, void *data)
591 else if (WIFSIGNALED (status)) 596 else if (WIFSIGNALED (status))
592 { 597 {
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 }
596 else 604 else
597 def->storage = "[unrecognized return code]"; 605 def->storage = "[unrecognized return code]";

Return to:

Send suggestions and report system problems to the System administrator.