• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/opkg-lede/libopkg/pkg_dest_list.c

  1 /* pkg_dest_list.c - the opkg package management system
  2 
  3    Carl D. Worth
  4 
  5    Copyright (C) 2001 University of Southern California
  6 
  7    This program is free software; you can redistribute it and/or
  8    modify it under the terms of the GNU General Public License as
  9    published by the Free Software Foundation; either version 2, or (at
 10    your option) any later version.
 11 
 12    This program is distributed in the hope that it will be useful, but
 13    WITHOUT ANY WARRANTY; without even the implied warranty of
 14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 15    General Public License for more details.
 16 */
 17 
 18 #include <stdio.h>
 19 
 20 #include "pkg_dest.h"
 21 #include "void_list.h"
 22 #include "pkg_dest_list.h"
 23 #include "libbb/libbb.h"
 24 
 25 void pkg_dest_list_elt_init(pkg_dest_list_elt_t * elt, pkg_dest_t * data)
 26 {
 27         void_list_elt_init((void_list_elt_t *) elt, data);
 28 }
 29 
 30 void pkg_dest_list_elt_deinit(pkg_dest_list_elt_t * elt)
 31 {
 32         void_list_elt_deinit((void_list_elt_t *) elt);
 33 }
 34 
 35 void pkg_dest_list_init(pkg_dest_list_t * list)
 36 {
 37         void_list_init((void_list_t *) list);
 38 }
 39 
 40 void pkg_dest_list_deinit(pkg_dest_list_t * list)
 41 {
 42         pkg_dest_list_elt_t *iter, *n;
 43         pkg_dest_t *pkg_dest;
 44 
 45         list_for_each_entry_safe(iter, n, &list->head, node) {
 46                 pkg_dest = (pkg_dest_t *) iter->data;
 47                 pkg_dest_deinit(pkg_dest);
 48 
 49                 /* malloced in pkg_dest_list_append */
 50                 free(pkg_dest);
 51                 iter->data = NULL;
 52         }
 53         void_list_deinit((void_list_t *) list);
 54 }
 55 
 56 pkg_dest_t *pkg_dest_list_append(pkg_dest_list_t * list, const char *name,
 57                                  const char *root_dir, const char *lists_dir)
 58 {
 59         pkg_dest_t *pkg_dest;
 60 
 61         /* freed in pkg_dest_list_deinit */
 62         pkg_dest = xcalloc(1, sizeof(pkg_dest_t));
 63         pkg_dest_init(pkg_dest, name, root_dir, lists_dir);
 64         void_list_append((void_list_t *) list, pkg_dest);
 65 
 66         return pkg_dest;
 67 }
 68 

This page was automatically generated by LXR 0.3.1.  •  OpenWrt