From: Nick Bowler Date: Sat, 14 May 2011 01:08:37 +0000 (-0400) Subject: liblbx: Kill lbx_numfiles. X-Git-Url: https://git.draconx.ca/gitweb/liblbx.git/commitdiff_plain/2c0de0824e7a962fe0bff05972629781cec3fd68 liblbx: Kill lbx_numfiles. This function is now redundant. --- diff --git a/src/gui/lbxgui.c b/src/gui/lbxgui.c index 7eed44f..e230d6f 100644 --- a/src/gui/lbxgui.c +++ b/src/gui/lbxgui.c @@ -331,8 +331,7 @@ static int load_archive(const char *path) -1); g_free(basename); - nfiles = lbx_numfiles(lbx); - for (unsigned i = 0; i < nfiles; i++) { + for (unsigned i = 0; i < lbx->nfiles; i++) { struct lbx_statbuf stat; lbx_file_stat(lbx, i, &stat); diff --git a/src/lbx.c b/src/lbx.c index 1d92f46..57a72b0 100644 --- a/src/lbx.c +++ b/src/lbx.c @@ -182,13 +182,7 @@ struct lbx *lbx_fopen(const char *file) return lbx_open(p, &lbx_pipe_fops, pipe_close, name); } -size_t lbx_numfiles(struct lbx *pub) -{ - return pub->nfiles; -} - -int -lbx_file_stat(struct lbx *pub, unsigned fileno, struct lbx_statbuf *buf) +int lbx_file_stat(struct lbx *pub, unsigned fileno, struct lbx_statbuf *buf) { struct lbx_priv *lbx = (struct lbx_priv *)pub; static char str[256]; /* FIXME */ diff --git a/src/lbx.h b/src/lbx.h index a7be058..0f09c06 100644 --- a/src/lbx.h +++ b/src/lbx.h @@ -43,7 +43,6 @@ LBX *lbx_open(void *handle, const struct lbx_file_ops *fops, LBX *lbx_fopen(const char *); LBX *lbx_mopen(void *, size_t, const char *); int lbx_close(LBX *); -size_t lbx_numfiles(LBX *); /* File operations */ int lbx_file_stat(LBX *lbx, unsigned fileno, struct lbx_statbuf *out); diff --git a/src/lbxtool.c b/src/lbxtool.c index 9c4b57b..8a5a428 100644 --- a/src/lbxtool.c +++ b/src/lbxtool.c @@ -69,16 +69,15 @@ int filematch(char **argv, const char *name) return i ? -1: 0; } -int list(LBX *lbx, int verbose, char **argv) { - size_t nfiles; +int list(LBX *lbx, int verbose, char **argv) +{ unsigned int i; - nfiles = lbx_numfiles(lbx); if (verbose) { - printf("Files in archive: %zu\n", nfiles); + printf("Files in archive: %u\n", lbx->nfiles); } - for (i = 0; i < nfiles; i++) { + for (i = 0; i < lbx->nfiles; i++) { struct lbx_statbuf stat; lbx_file_stat(lbx, i, &stat); @@ -143,16 +142,15 @@ int extract_file(LBXfile *f, const struct lbx_statbuf *stat) return ret; } -int extract(LBX *lbx, int verbose, char **argv) { - size_t nfiles; +int extract(LBX *lbx, int verbose, char **argv) +{ unsigned int i; - nfiles = lbx_numfiles(lbx); if (verbose) { - printf("Files in archive: %zu\n", nfiles); + printf("Files in archive: %u\n", lbx->nfiles); } - for (i = 0; i < nfiles; i++) { + for (i = 0; i < lbx->nfiles; i++) { struct lbx_statbuf stat; LBXfile *file;