Changeset 5388:e5cc8e03a3e1 in roaraudio for libroar/vio.c
- Timestamp:
- 01/17/12 11:27:07 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/vio.c
r5381 r5388 53 53 memset((void*)calls, 0, sizeof(struct roar_vio_calls)); 54 54 calls->flags = ROAR_VIO_FLAGS_NONE; 55 calls->refc = 0;55 calls->refc = 1; 56 56 57 57 return 0; … … 202 202 } 203 203 204 int roar_vio_close (struct roar_vio_calls * vio) { 204 205 int roar_vio_ref (struct roar_vio_calls * vio) { 206 if ( vio == NULL ) { 207 roar_err_set(ROAR_ERROR_FAULT); 208 return -1; 209 } 210 211 vio->refc++; 212 213 return 0; 214 } 215 216 int roar_vio_unref (struct roar_vio_calls * vio) { 205 217 int ret; 206 218 207 ROAR_DBG("roar_vio_ close(vio=%p) = ?", vio);208 209 if ( vio == NULL ) { 210 roar_err_set(ROAR_ERROR_FAULT); 211 return -1; 212 } 213 214 if ( vio-> close == NULL ) {219 ROAR_DBG("roar_vio_unref(vio=%p) = ?", vio); 220 221 if ( vio == NULL ) { 222 roar_err_set(ROAR_ERROR_FAULT); 223 return -1; 224 } 225 226 if ( vio->refc == 1 && vio->close == NULL ) { 215 227 roar_err_set(ROAR_ERROR_NOSYS); 216 228 return -1; 217 229 } 230 231 vio->refc--; 232 233 if ( vio->refc ) 234 return 0; 218 235 219 236 roar_err_clear_all(); … … 221 238 roar_err_update(); 222 239 240 if ( vio->flags & ROAR_VIO_FLAGS_FREESELF ) 241 roar_mm_free(vio); 242 223 243 return ret; 224 244 } … … 257 277 258 278 memset((void*)calls, 0, sizeof(struct roar_vio_calls)); 279 calls->flags = ROAR_VIO_FLAGS_NONE; 280 calls->refc = 1; 259 281 260 282 calls->read = roar_vio_basic_read; … … 642 664 643 665 memset((void*)calls, 0, sizeof(struct roar_vio_calls)); 666 calls->flags = ROAR_VIO_FLAGS_NONE; 667 calls->refc = 1; 644 668 645 669 calls->read = roar_vio_pass_read;
Note: See TracChangeset
for help on using the changeset viewer.