Release resources allocated by LibGAlloc

Name

ggiGARelease, ggiGAReleaseVis, ggiGAReleaseList : Release resources allocated by LibGAlloc

Synopsis

#include <ggi/galloc.h>

int ggiGARelease(ggi_visual_t vis, ggiGA_resource_list *list,
                 ggiGA_resource_handle *handle);

int ggiGAReleaseVis(ggi_visual_t vis, ggiGA_resource_list *list,
                 ggiGA_resource_handle *handle);

int ggiGAReleaseList(ggi_visual_t vis, ggiGA_resource_list *list,
                     ggiGA_resource_handle *handle);

Description

ggiGARelease finds the internal resource corresponding to the resource in reqlist referenced by handle, deallocates it, and then removes the resource from reqlist. Resources of type 'GA_RT_FRAME' are simply removed, unless they are the last such in the list, in which case they represent the active video mode and cannot be removed (requests to do this are ignored.)

ggiGAReleaseVis checks that the given vis matches with the visual the handle belongs to (see ggiGAGetVisual(3)). Then it the same as ggiGARelease.

ggiGAReleaseList releases all the resources in list starting from handle. If handle is NULL or the first resource in list, then the whole list get released. Each resource gets released as ggiGARelease does.

Care must be taken that the reqlist used has not been altered with any Add functions since it was used to set the mode, or that it is a result list that was gotten during or since the last call to ggiGASet(3) or ggiGARelease, in which case the handle must belong to said result list.

Return value

Returns 0 on success, or an error code if the removal fails or the supplied parameters are invalid.

Example

ggi_visual_t vis;
ggiGA_resource_list request, result;
ggiGA_resource_props props;
ggi_mode mode;
ggiGA_resource_handle req, res;
ggiInit();
vis = ggiOpen(NULL);
ggiGAAttach(vis);

ggiCheckMode(vis, 640, 480, 640, 480, &mode);

props.size.x     = 320;
props.size.y     = 200;
props.graphtype  = GT_AUTO;

ggiGAAdd(&request, &props, GA_RT_VIDEO_MOTION, &req);
ggiGAAddMode(vis, &request, mode, NULL, NULL);

if (ggiGACheck(vis, request, &result)) {
      print("Check failed\n");
      autopsy(result);
}
else if (ggiGASet(vis, request, &result)) {
      print("Unexpected failure to Set\n");
      autopsy(result);
}

ggiGARelease(vis, request, req);
/* Or:

   res = ggiGAHandle(result, request, req);
   ggiGARelease(vis, result, res);

*/

ggiGADetach(vis);
ggiGAExit();
ggiExit();