summaryrefslogtreecommitdiffabout
path: root/src
authorSergey Poznyakoff <gray@gnu.org.ua>2011-05-10 17:40:52 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2011-05-10 17:40:52 (GMT)
commit9e81fa8a01af87ce85b5dd0b19e3d621b46b3be8 (patch) (side-by-side diff)
tree093882260404a82337c138b5eefe414aa41f40e4 /src
parent3bf61e7ab82244cdeb00c6ba6d602d3cad9b64d4 (diff)
downloadwydawca-9e81fa8a01af87ce85b5dd0b19e3d621b46b3be8.tar.gz
wydawca-9e81fa8a01af87ce85b5dd0b19e3d621b46b3be8.tar.bz2
Remove inttostr module.
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-rw-r--r--src/triplet.c23
-rw-r--r--src/wydawca.c7
2 files changed, 18 insertions, 12 deletions
diff --git a/src/triplet.c b/src/triplet.c
index 9f051db..bfd58e5 100644
--- a/src/triplet.c
+++ b/src/triplet.c
@@ -343,9 +343,8 @@ format_file_data (struct file_triplet *trp, enum file_type type, char **pret)
char timebuf[sizeof "YYYY-MM-DD HH:MM:SS +0000"];
struct passwd *pw;
struct group *grp;
- char sbuf[INT_BUFSIZE_BOUND (uintmax_t)];
- char *sptr;
- size_t slen;
+ char *sptr = NULL;
+ size_t slen = 0;
int pad;
char *user_name;
char *group_name;
@@ -378,7 +377,8 @@ format_file_data (struct file_triplet *trp, enum file_type type, char **pret)
group_name = grp->gr_name;
/* Size */
- sptr = umaxtostr (info->sb.st_size, sbuf);
+ if (grecs_asprintf (&sptr, &slen, "%lu", (unsigned long) info->sb.st_size))
+ xalloc_die ();
/* Figure out padding and format the buffer */
slen = strlen (sptr);
@@ -392,6 +392,7 @@ format_file_data (struct file_triplet *trp, enum file_type type, char **pret)
sptr,
timebuf, info->name))
xalloc_die ();
+ free (sptr);
*pret = buf;
return 0;
}
@@ -584,25 +585,27 @@ expand_check_result (struct metadef *def, void *data)
{
struct file_triplet *trp = data;
int status = trp->check_result;
- char sbuf[INT_BUFSIZE_BOUND (uintmax_t)];
if (status == 0)
return def->value = "0";
else if (WIFEXITED (status))
{
- char *p = umaxtostr (WEXITSTATUS (status), sbuf);
- def->storage = xstrdup (p);
+ size_t size = 0;
+ def->storage = NULL;
+ if (grecs_asprintf (&def->storage, &size,
+ "%d", WEXITSTATUS (status)))
+ xalloc_die ();
}
else if (WIFSIGNALED (status))
{
- char *p = umaxtostr (WTERMSIG (status), sbuf);
size_t size = 0;
def->storage = NULL;
- if (grecs_asprintf (&def->storage, &size, "SIG+%s", p))
+ if (grecs_asprintf (&def->storage, &size, "SIG+%d",
+ WTERMSIG (status)))
xalloc_die ();
}
else
- def->storage = "[unrecognized return code]";
+ return def->value = "[unrecognized return code]";
return def->value = def->storage;
}
diff --git a/src/wydawca.c b/src/wydawca.c
index 12649d3..171b97b 100644
--- a/src/wydawca.c
+++ b/src/wydawca.c
@@ -175,8 +175,11 @@ stat_mask_p (unsigned long mask)
static const char *
stat_expand (struct metadef *def, void *data)
{
- char sbuf[INT_BUFSIZE_BOUND (wydawca_stat[0])];
- def->storage = xstrdup (uinttostr (wydawca_stat[(int) def->data], sbuf));
+ size_t size = 0;
+ def->storage = NULL;
+ if (grecs_asprintf (&def->storage, &size, "%u",
+ wydawca_stat[(int) def->data]))
+ xalloc_die ();
def->value = def->storage;
return def->value;
}

Return to:

Send suggestions and report system problems to the System administrator.