Empty LibGAlloc resource list structure
Name
ggiGAEmptyList, ggiGAEmptyFailures, ggiGATruncateList : Empty LibGAlloc resource list structure
Synopsis
#include <ggi/galloc.h> int ggiGAEmptyList(ggiGA_resource_list *list); int ggiGAEmptyFailures(ggiGA_resource_list *list); int ggiGATruncateList(ggiGA_resource_list list, ggiGA_resource_handle *handle);
Description
ggiGAEmptyList empties the list linked list structures and all attached properties, modes, and private structure members but keeps the list header. Use ggiGADestroyList(3) to also free the list header.
ggiGAEmptyFailures empties the rest of the list starting at the first failed resource.
ggiGATruncateList empties the list starting from handle. If handle is the first element in the list, the result is equal to ggiGAEmptyList. On success, handle is always NULL.
Do not worry: if you have used ggiGASet(3) successfully on the list, then GAlloc is keeping an internal copy which you can get back with ggiGAGet(3).
Do worry: If you have gotten any handles, properties, modes, directbuffer structures, or private data structures from the destroyed resources, then they are now pointing at invalid memory addresses. If you want to keep them, you must copy them before calling ggiGAEmptyList or ggiGADestroyList(3).
Return value
Returns GALLOC_OK (== 0) on success, or a non-zero error if passed an invalid list.
Example
ggi_visual_t vis; ggiGA_resource_list list; ggiGA_resource_handle handle; struct ggiGA_resource_props *props, copy; ggiGAGet(vis, &list); handle = ggiGAHandle(list, oldrequesthandle); props = ggiGAGetProperties(handle); if (props != NULL) memcpy(©, props, sizeof(struct ggiGA_resource_props)); ggiGAEmptyList(list); ggiGAIsEmptyList(list) == NULL; ggiGADestroyList(list); list == NULL;