summaryrefslogtreecommitdiffstats
path: root/rpmconstant/rpmconstant_internal.c
blob: db3e9020f88c29e5eb7e71a65cf70419d560081c (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
/* Nanar <nanardon@mandrake.org>
 * $Id$
 */

#include <string.h>
#define RPMCONSTANT_INTERNAL
#include "rpmconstant.h"

const char * rpmConstantName(rpmconstant c)
{
    return c->name;
}

int rpmConstantValue(rpmconstant c)
{
    return c->value;
}

rpmconstant rpmConstantNext(rpmconstant c)
{
    return (c + 1)->name ? c + 1 : NULL;
}

/**/

rpmconstantlist rpmGetConstantList()
{
    return (void *) rpmconstanttype;
}

rpmconstantlist rpmConstantListNext(rpmconstantlist cl)
{
    return (cl + 1)->constant ? cl + 1 : NULL;
}

rpmconstantlist rpmGetConstantListFromContext(const char * context)
{
    rpmconstantlist cl;
    for (cl = rpmGetConstantList(); cl; cl=rpmConstantListNext(cl)) {
        if (context && strcmp(context, rpmConstantListContext(cl)) == 0)
            return cl;
    }
    return NULL;
}

const char * rpmConstantListPrefix (rpmconstantlist cl)
{
    return cl->prefix;
}

const char * rpmConstantListContext (rpmconstantlist cl)
{
    return cl->context;
}

rpmconstant rpmConstantListC(rpmconstantlist cl)
{
    return cl->constant;
}