diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-01-03 19:40:33 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-01-03 20:03:27 +0200 |
commit | fa78a9f21ff4fd85fb568232c9bee957b9c83497 (patch) | |
tree | 597162dff26a81877b5788fc5015fc8b075354b7 /src/vtab.c | |
parent | 17f28552af10e72a221a0be16417249852774f1b (diff) | |
download | wydawca-fa78a9f21ff4fd85fb568232c9bee957b9c83497.tar.gz wydawca-fa78a9f21ff4fd85fb568232c9bee957b9c83497.tar.bz2 |
Improve memory management and optimize function signatures.
* src/wydawca.h (file_triplet): New members: relative_dir, obstk.
(virt_tab): Remove spool and reldir from argument lists.
(triplet_strdup): New prototype.
(move_file, archive_file, symlink_file)
(rmsymlink_file, dir_move_file, dir_archive_file)
(dir_symlink_file, dir_rmsymlink_file)
(null_move_file, null_archive_file)
(null_symlink_file, null_rmsymlink_file): Remove spool and reldir
from argument lists.
* src/directive.c (run_check_script): Use trp->obstk to
store the program output.
(process_directives): Update calls to vtab interfaces.
* src/diskio.c (dir_move_file)
(dir_archive_file, dir_symlink_file)
(dir_rmsymlink_file): Remove spool and reldir
arguments. Use the corresponding members of
the struct file_triplet.
* src/null.c (null_move_file, null_archive_file)
(null_symlink_file, null_rmsymlink_file): Likewise.
* src/vtab.c (move_file, archive_file)
(symlink_file, rmsymlink_file): Likewise.
* src/triplet.c (hash_triplet_free): Free obstack and uploader_list.
(triplet_strdup): New function.
(register_file): Initialize trp->obstck.
(fill_project_name): Fill relative_dir as well.
(verify_directive_file): Use triplet_strdup to
keep string values.
Diffstat (limited to 'src/vtab.c')
-rw-r--r-- | src/vtab.c | 29 |
1 files changed, 12 insertions, 17 deletions
@@ -54,44 +54,39 @@ url_to_vtab (mu_url_t url, struct virt_tab *vtab) int -move_file (struct file_triplet *trp, const struct spool *spool, - enum file_type file_id, const char *reldir) +move_file (struct file_triplet *trp, enum file_type file_id) { - int rc = spool->vtab.move_file (trp, spool, file_id, reldir); - report_add ("Move %s to %s: %s", trp->file[file_id].name, reldir, + int rc = trp->spool->vtab.move_file (trp, file_id); + report_add ("Move %s to %s: %s", trp->file[file_id].name, trp->relative_dir, rc == 0 ? "OK" : "FAILED"); return rc; } int -archive_file (struct file_triplet *trp, const struct spool *spool, - const char *reldir, const char *file_name) +archive_file (struct file_triplet *trp, const char *file_name) { - int rc = spool->vtab.archive_file (trp, spool, reldir, file_name); - report_add ("Archive and remove %s/%s: %s", reldir, file_name, + int rc = trp->spool->vtab.archive_file (trp, file_name); + report_add ("Archive and remove %s/%s: %s", trp->relative_dir, file_name, rc == 0 ? "OK" : "FAILED"); return rc; } int -symlink_file (struct file_triplet *trp, const struct spool *spool, - const char *reldir, +symlink_file (struct file_triplet *trp, const char *wanted_src, const char *wanted_dst) { - int rc = spool->vtab.symlink_file (trp, spool, reldir, - wanted_src, wanted_dst); + int rc = trp->spool->vtab.symlink_file (trp, wanted_src, wanted_dst); report_add ("Symlink %s to %s in %s/: %s", wanted_src, wanted_dst, - reldir, + trp->relative_dir, rc == 0 ? "OK" : "FAILED"); return rc; } int -rmsymlink_file (struct file_triplet *trp, const struct spool *spool, - const char *reldir, const char *file_name) +rmsymlink_file (struct file_triplet *trp, const char *file_name) { - int rc = spool->vtab.rmsymlink_file (trp, spool, reldir, file_name); - report_add ("Remove symlink %s/%s: %s", reldir, file_name, + int rc = trp->spool->vtab.rmsymlink_file (trp, file_name); + report_add ("Remove symlink %s/%s: %s", trp->relative_dir, file_name, rc == 0 ? "OK" : "FAILED"); return rc; } |