~ubuntu-branches/debian/lenny/libgsf/lenny

« back to all changes in this revision

Viewing changes to gsf/gsf-zip-utils.c

  • Committer: Bazaar Package Importer
  • Author(s): J.H.M. Dassen (Ray)
  • Date: 2006-11-06 22:45:03 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 dapper)
  • Revision ID: james.westby@ubuntu.com-20061106224503-g6pmv1m82zy8jya9
Tags: 1.14.3-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 *
16
16
 * You should have received a copy of the GNU Lesser General Public License
17
17
 * along with this program; if not, write to the Free Software
18
 
 * Foundation, Outc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 
18
 * Foundation, Outc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
19
19
 * USA
20
20
 */
21
21
 
37
37
{
38
38
        g_return_if_fail (dirent != NULL);
39
39
 
40
 
        if (dirent->name != NULL) {
41
 
                g_free (dirent->name);
42
 
                dirent->name = NULL;
43
 
        }
 
40
        g_free (dirent->name);
 
41
        dirent->name = NULL;
 
42
 
44
43
        g_free (dirent);
45
44
}
46
45
 
74
73
        g_free (vdir);
75
74
}
76
75
 
77
 
/* Comparison doesn't have to be UTF-8 safe, as long as it is consistent */
78
 
static gint
79
 
gsf_vdir_compare (gconstpointer ap, gconstpointer bp)
80
 
{
81
 
        GsfZipVDir *a = (GsfZipVDir *) ap;
82
 
        GsfZipVDir *b = (GsfZipVDir *) bp;
83
 
 
84
 
        if (!a || !b) {
85
 
                if (!a && !b)
86
 
                        return 0;
87
 
                else
88
 
                        return a ? -1 : 1;
89
 
        }
90
 
        return strcmp (a->name, b->name);
91
 
}
92
 
 
93
76
void
94
77
gsf_vdir_add_child (GsfZipVDir *vdir, GsfZipVDir *child)
95
78
{
96
 
        vdir->children = g_slist_insert_sorted (vdir->children,
97
 
                                                (gpointer) child,
98
 
                                                gsf_vdir_compare);
 
79
        GSList *tail = g_slist_append (NULL, child);
 
80
        if (vdir->children)
 
81
                vdir->last_child->next = tail;
 
82
        else
 
83
                vdir->children = tail;
 
84
        vdir->last_child = tail;
99
85
}
100