summaryrefslogtreecommitdiffabout
path: root/src/triplet.c
authorSergey Poznyakoff <gray@gnu.org.ua>2011-05-13 07:21:43 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2011-05-13 07:33:34 (GMT)
commitde3fbe3e8d4dd2a89f7755906d76055784c437cc (patch) (side-by-side diff)
tree65356dd7b5a9010499550c468e960c93515a7e15 /src/triplet.c
parentf569a6f2628b9ddef4dfb4424aff2dad644a8f19 (diff)
downloadwydawca-de3fbe3e8d4dd2a89f7755906d76055784c437cc.tar.gz
wydawca-de3fbe3e8d4dd2a89f7755906d76055784c437cc.tar.bz2
Drop gnulib.
* bootstrap: Rewrite. * bootstrap.conf: Remove. * configure.ac: Remove gl_EARLY/gl_INIT * src/backup.c: New file. * src/txtacc.c (txtacc_finish): Make sure a new entry is appended only once to the list. * (all sources): Use grecs memory allocation functions. * src/wydawca.h" Include fnmatch.h and regex.h (backup_type): New enum. (simple_backup_suffix): New extern. (find_backup_file_name): New proto. * tests/bkupname.c: New file. * tests/backup00.at: New file. * tests/backup01.at: New file. * tests/backup02.at: New file. * tests/backup03.at: New file. * tests/Makefile.am: Add new tests. * tests/testsuite.at: Add new tests. * grecs: Update.
Diffstat (limited to 'src/triplet.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/triplet.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/triplet.c b/src/triplet.c
index 3083c64..9dfdf2c 100644
--- a/src/triplet.c
+++ b/src/triplet.c
@@ -57,12 +57,13 @@ hash_triplet_free (void *data)
txtacc_free (tp->acc);
/* Free uploader list */
for (up = tp->uploader_list; up; )
{
struct uploader_info *next = up->next;
+ free (up->fpr);
free (up);
up = next;
}
free (tp);
}
@@ -91,13 +92,13 @@ register_file (struct file_info *finfo, const struct spool *spool)
NULL,
hash_triplet_free);
if (!triplet_table)
grecs_alloc_die ();
}
- key.name = xmalloc (finfo->root_len + 1);
+ key.name = grecs_malloc (finfo->root_len + 1);
memcpy (key.name, finfo->name, finfo->root_len);
key.name[finfo->root_len] = 0;
ret = grecs_symtab_lookup_or_install (triplet_table, &key, &install);
if (!ret)
grecs_alloc_die ();
@@ -375,26 +376,26 @@ format_file_data (struct file_triplet *trp, enum file_type type, char **pret)
group_name = "unknown"; /* should not happen */
else
group_name = grp->gr_name;
/* Size */
if (grecs_asprintf (&sptr, &slen, "%lu", (unsigned long) info->sb.st_size))
- xalloc_die ();
+ grecs_alloc_die ();
/* Figure out padding and format the buffer */
slen = strlen (sptr);
pad = strlen (user_name) + 1 + strlen (group_name) + 1 + slen;
if (pad > ugswidth)
ugswidth = pad;
if (grecs_asprintf (&buf, &size,
"%s %s %s %*s %s %s",
modes, user_name, group_name, ugswidth - pad + slen,
sptr,
timebuf, info->name))
- xalloc_die ();
+ grecs_alloc_die ();
free (sptr);
*pret = buf;
return 0;
}
static const char *
@@ -408,13 +409,13 @@ expand_triplet_ls_full (struct metadef *def, void *data)
size += strlen (buf[file_dist]) + 1;
if (format_file_data (trp, file_signature, &buf[file_signature]) == 0)
size += strlen (buf[file_signature]) + 1;
if (format_file_data (trp, file_directive, &buf[file_directive]) == 0)
size += strlen (buf[file_directive]) + 1;
- def->value = def->storage = xmalloc (size + 1);
+ def->value = def->storage = grecs_malloc (size + 1);
def->value[0] = 0;
if (buf[file_dist])
{
strcat (def->value, buf[file_dist]);
strcat (def->value, "\n");
}
@@ -443,13 +444,13 @@ expand_triplet_ls_upload (struct metadef *def, void *data)
if (format_file_data (trp, file_dist, &buf[file_dist]) == 0)
size += strlen (buf[file_dist]) + 1;
if (format_file_data (trp, file_signature, &buf[file_signature]) == 0)
size += strlen (buf[file_signature]) + 1;
- def->value = def->storage = xmalloc (size + 1);
+ def->value = def->storage = grecs_malloc (size + 1);
def->value[0] = 0;
if (buf[file_dist])
{
strcat (def->value, buf[file_dist]);
strcat (def->value, "\n");
}
@@ -549,13 +550,13 @@ expand_email_user (struct metadef *def, void *data)
struct file_triplet *trp = data;
if (trp->uploader)
{
size_t size = 0;
if (grecs_asprintf (&def->storage, &size, "\"%s\" <%s>",
trp->uploader->realname, trp->uploader->email))
- xalloc_die ();
+ grecs_alloc_die ();
def->value = def->storage;
}
return def->value;
}
static const char *
@@ -591,21 +592,21 @@ expand_check_result (struct metadef *def, void *data)
else if (WIFEXITED (status))
{
size_t size = 0;
def->storage = NULL;
if (grecs_asprintf (&def->storage, &size,
"%d", WEXITSTATUS (status)))
- xalloc_die ();
+ grecs_alloc_die ();
}
else if (WIFSIGNALED (status))
{
size_t size = 0;
def->storage = NULL;
if (grecs_asprintf (&def->storage, &size, "SIG+%d",
WTERMSIG (status)))
- xalloc_die ();
+ grecs_alloc_die ();
}
else
return def->value = "[unrecognized return code]";
return def->value = def->storage;
}

Return to:

Send suggestions and report system problems to the System administrator.