repo

List, download and sync packs with remote repositories
Log | Files | Refs

commit be9bf8a9d75a32005bdd5cb7f9d50b04416f84a6
parent 3f6ad1133fe13890816944190faf7a5665c1fef5
Author: z3bra <contactatz3bradotorg>
Date:   Thu Dec 15 17:32:39 +0100

Remove dynamic allocation from local_load()

Diffstat:
repo.c | 13++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/repo.c b/repo.c @@ -89,24 +89,15 @@ add_repo(struct repos *rlist, char *url) int local_load(struct packs *plist, char *local) { - ssize_t len = 0; - char *fn; + char fn[PATH_MAX] = ""; char buf[LINE_MAX] = ""; struct pack *p = NULL; FILE *list; - len = strlen(local) + strlen(LISTFILE); - fn = malloc(len + 1); - if (!fn) { - perror("malloc"); - return -1; - } - snprintf(fn, len + 1, "%s%s", local, LISTFILE); - fn[len] = 0; + snprintf(fn, PATH_MAX, "%s/%s", local, LISTFILE); list = fopen(fn, "r"); if (!list) { perror(fn); - free(fn); exit(1); }