Changeset 5321:916f049deb4b in roaraudio for libroar/roardl.c


Ignore:
Timestamp:
12/05/11 03:05:49 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added ref/unref support for roardl handles

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/roardl.c

    r5317 r5321  
    214214 
    215215 ret->flags = flags; 
     216 ret->refc  = 1; 
    216217 
    217218 if ( flags & ROAR_DL_FLAG_STATIC ) { 
     
    259260} 
    260261 
    261 int                      roar_dl_close(struct roar_dl_lhandle * lhandle) { 
     262int                      roar_dl_ref    (struct roar_dl_lhandle * lhandle) { 
     263 if ( (void*)lhandle < (void*)128 ) { 
     264  roar_err_set(ROAR_ERROR_BADFH); 
     265  return -1; 
     266 } 
     267 
     268 lhandle->refc++; 
     269 
     270 return 0; 
     271} 
     272 
     273int                      roar_dl_unref  (struct roar_dl_lhandle * lhandle) { 
    262274 int ret = -1; 
    263275 
    264  if ( lhandle == ROAR_DL_HANDLE_DEFAULT || lhandle == ROAR_DL_HANDLE_NEXT ) { 
     276 if ( (void*)lhandle < (void*)128 ) { 
    265277  roar_err_set(ROAR_ERROR_BADFH); 
    266278  return -1; 
    267279 } 
     280 
     281 lhandle->refc++; 
     282 
     283 if ( lhandle->refc ) 
     284  return 0; 
    268285 
    269286 if ( lhandle->lib != NULL && lhandle->lib->unload != NULL ) { 
Note: See TracChangeset for help on using the changeset viewer.