1get_constants(3)                    GETDATA                   get_constants(3)
2
3
4

NAME

6       get_constants — retrieve a list of constant values from a dirfile
7

SYNOPSIS

9       #include <getdata.h>
10
11       const void *get_constants(DIRFILE *dirfile, gd_type_t return_type);
12

DESCRIPTION

14       The get_constants() function queries a dirfile(5) database specified by
15       dirfile and returns a read-only list of values of the  all  CONST  type
16       fields  defined  in the database after type conversion to the data type
17       specified by return_type.  Notably, this list does  not  include  /META
18       subfields.  For a list of valid symbols to use for return_type, see the
19       getdata(3) man page.
20
21       The dirfile argument must point to a valid  DIRFILE  object  previously
22       created by a call to dirfile_open(3).
23
24       The  array  returned will be de-allocated by a call to dirfile_close(3)
25       and should not be de-allocated by the caller.  The list returned should
26       not be assumed to be in any particular order, although it is guaranteed
27       to be in the same order  as  the  list  of  CONST  fields  returned  by
28       get_field_list_by_type(3).   The  array is unterminated.  The number of
29       values   in   the   array   can   be   obtained   from   a   call    to
30       get_nfields_by_type(3).
31
32       The caller may not modify any values in the array, or the array itself.
33       Doing so may cause database corruption.  The pointer returned is  guar‐
34       anteed  to be valid only until get_constants() is called again with the
35       same arguments, or until the dirfile's metadata is modified (by adding,
36       modifying or deleting an entry), or until the array is deallocated by a
37       call to dirfile_close(3).
38
39       A corresponding list of names for these fields may be obtained by call‐
40       ing get_field_list_by_type(3).
41
42

RETURN VALUE

44       Upon successful completion, get_constants() returns a pointer to an ar‐
45       ray of values containing the values of all the constants defined in the
46       dirfile database.  If no constants are defined in the database, NULL is
47       returned.  On error it returns NULL and sets the  dirfile  error  to  a
48       non-zero error value.  Possible error values are:
49
50       GD_E_ALLOC
51               The library was unable to allocate memory.
52
53       GD_E_BAD_DIRFILE
54               The supplied dirfile was invalid.
55
56       GD_E_BAD_TYPE
57               The return_type specified was invalid.
58
59       The dirfile error may be retrieved by calling get_error(3).  A descrip‐
60       tive error string for the last error encountered can be obtained from a
61       call to get_error_string(3).
62

SEE ALSO

64       dirfile(5),  dirfile_open(3),  get_constant(3),  get_error(3),  get_er‐
65       ror_string(3), get_field_list_by_type(3), get_nfields_by_type(3)
66
67
68
69Version 0.6.0                   6 October 2009                get_constants(3)
Impressum