44 lines
871 B
C
44 lines
871 B
C
/*
|
|
* Copyright (c) 1993-1995 Argonaut Technologies Limited. All rights reserved.
|
|
*
|
|
* $Id: ocfree.c 2.1 1996/02/10 20:20:04 sam Exp $
|
|
* $Locker: $
|
|
*
|
|
* Device methods
|
|
*/
|
|
#include <stddef.h>
|
|
#include <string.h>
|
|
|
|
#include "drv.h"
|
|
#include "shortcut.h"
|
|
#include "brassert.h"
|
|
|
|
/*
|
|
* Utility function to free al the objects in a container
|
|
*/
|
|
br_error ObjectContainerFree(br_object_container *self, br_token type, char *pattern, br_token_value *tv)
|
|
{
|
|
br_error r;
|
|
br_object **handles;
|
|
br_int_32 count,n,i;
|
|
|
|
r = ObjectContainerCount(self, &count, type, pattern, tv);
|
|
|
|
if(r != BRE_OK)
|
|
return r;
|
|
|
|
if(count == 0)
|
|
return BRE_OK;
|
|
|
|
handles = BrMemAllocate(count * sizeof(*handles), BR_MEMORY_DRIVER);
|
|
|
|
r = ObjectContainerFindMany(self, handles, count, &n, type, pattern, tv);
|
|
|
|
for(i=0; i < n; i++)
|
|
ObjectFree(handles[i]);
|
|
|
|
BrMemFree(handles);
|
|
|
|
return BRE_OK;
|
|
}
|
|
|