1get_mconstants(3) GETDATA get_mconstants(3)
2
3
4
6 get_mconstants — retrieve a list of constant values from a dirfile
7
9 #include <getdata.h>
10
11 const void *get_mconstants(DIRFILE *dirfile, gd_type_t return_type,
12 const char *parent);
13
15 The get_mconstants() function queries a dirfile(5) database specified
16 by dirfile and returns a read-only list of values of the all CONST type
17 metafields for the supplied parent field after type conversion to the
18 data type specified by return_type.
19
20 The dirfile argument must point to a valid DIRFILE object previously
21 created by a call to dirfile_open(3).
22
23 The array returned will be de-allocated by a call to dirfile_close(3)
24 and should not be de-allocated by the caller. The list returned should
25 not be assumed to be in any particular order, although it is guaranteed
26 to be in the same order as the list of CONST fields returned by
27 get_mfield_list_by_type(3). The array is unterminated. The number of
28 values in the array can be obtained from a call to get_nm‐
29 fields_by_type(3).
30
31 The caller may not modify any values in the array, or the array itself.
32 Doing so may cause database corruption. The pointer returned is guar‐
33 anteed to be valid until get_mconstants() is called again with the same
34 arguments, or until the array is deallocated by a call to
35 dirfile_close(3).
36
37 A corresponding list of names for these fields may be obtained by call‐
38 ing get_mfield_list_by_type(3).
39
40
42 Upon successful completion, get_mconstants() returns a pointer to an
43 array of values containing the values of all the CONST metafields for
44 the supplied parent field. If the parent field has no constant
45 metafields, NULL is returned. On error it returns NULL and sets the
46 dirfile error to a non-zero error value. Possible error values are:
47
48 GD_E_ALLOC
49 The library was unable to allocate memory.
50
51 GD_E_BAD_CODE
52 The supplied parent field code was not found, or referred to a
53 metafield itself.
54
55 GD_E_BAD_DIRFILE
56 The supplied dirfile was invalid.
57
58 GD_E_BAD_TYPE
59 The return_type specified was invalid.
60
61 The dirfile error may be retrieved by calling get_error(3). A descrip‐
62 tive error string for the last error encountered can be obtained from a
63 call to get_error_string(3).
64
66 dirfile(5), dirfile_open(3), get_error(3), get_error_string(3),
67 get_field_list_by_type(3), get_nfields_by_type(3)
68
69
70
71Version 0.5.0 8 December 2008 get_mconstants(3)