aboutsummaryrefslogtreecommitdiff
path: root/src/HTTPD_FileList.c
blob: cf5b3ec2c41f3471623305b7c93c9d7a8cc97c61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "HTTPD_FileList.h"
#include "PtrList.h"

/* wrapper functions to make PtrList type-safe for FileList items */

size_t
HTTPD_FileList_NumberOfItems( const FileList * list )
{
        return List_NumberOfItems( list );
}

FileList *
HTTPD_FileList_New()
{
        return (FileList *)List_New();
}

void
HTTPD_FileList_Delete( FileList * list )
{
        List_Delete( list );
}

void
HTTPD_FileList_FreeItemsInListAndEmpty( FileList * list )
{
        List_FreeItemsInListAndEmpty( list );
}

void
HTTPD_FileList_Append( FileList * list, httpFileItem * item )
{
        List_Append( list, item );
}

httpFileItem *
HTTPD_FileList_Item( const FileList * list, size_t index )
{
        return List_Item( list, index );
}

void
HTTPD_FileList_SortAccordingTo( FileList * list,
                HTTPD_FileListSortComparison comparison )
{
        List_SortAccordingTo( list, (ListSortComparison)comparison );
}

int
HTTPD_FileListCompare_Var_Thorn_Slice(
                const httpFileItem * a, const httpFileItem * b )
{
        int order = Compare( a->varname, b->varname );
        if( order == 0 )
        {
                order = Compare( a->thorn, b->thorn );
                if( order == 0 )
                        return Compare( a->slice, b->slice );
                else
                        return order;
        }
        else
                return order;
}