Manipulating DIET structures

The user will notice that the API to the DIET data structures consists of modifier and accessor functions only: no allocation function is required, since diet_profile_alloc (see Section 3.6) allocates all necessary memory for all argument descriptions. This avoids the temptation for the user to allocate the memory for these data structures twice (which would lead to DIET errors while reading profile arguments). Please see the example in Section 3.7 for a typical example.

Moreover, the user should know that arguments of the _set functions that are passed by pointers are not copied, in order to save memory. This is true for the value arguments, but also for the path in diet_file_set. Thus, the user keeps ownership of the memory zones pointed at by these pointers, and he/she must be very careful not to alter it during a call to DIET.


The DIET Team - Mer 29 nov 2017 15:13:36 EST