Changeset 5438:4eb05969f66c in roaraudio
- Timestamp:
- 03/20/12 17:00:08 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- libroar
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/plugincontainer.c
r5436 r5438 57 57 58 58 static void * _copy_kv(struct roar_keyval ** copy, struct roar_keyval * src, size_t len) { 59 size_t buflen, i; 59 size_t buflen = 0; 60 size_t i; 60 61 void * ret; 61 62 char * p; 62 63 struct roar_keyval * c; 63 64 64 buflen = len * (sizeof(struct roar_keyval) + 2 /* terminating \0s */);65 66 65 for (i = 0; i < len; i++) { 67 66 if ( src[i].key != NULL ) 68 buflen += roar_mm_strlen(src[i].key) ;67 buflen += roar_mm_strlen(src[i].key) + 1; 69 68 if ( src[i].value != NULL ) 70 buflen += roar_mm_strlen(src[i].value); 71 } 69 buflen += roar_mm_strlen(src[i].value) + 1; 70 } 71 72 c = roar_mm_malloc(len * sizeof(struct roar_keyval)); 73 if ( c == NULL ) 74 return NULL; 75 76 memset(c, 0, len * sizeof(struct roar_keyval)); 72 77 73 78 ret = roar_mm_malloc(buflen); … … 77 82 memset(ret, 0, buflen); 78 83 79 c = ret; 80 p = ret + len*sizeof(struct roar_keyval); 84 p = ret; 81 85 82 86 for (i = 0; i < len; i++) { … … 178 182 int roar_plugincontainer_ref(struct roar_plugincontainer * cont) { 179 183 if ( cont == NULL ) { 184 ROAR_DBG("roar_plugincontainer_ref(cont=%p) = -1 // error=FAULT", cont); 180 185 roar_err_set(ROAR_ERROR_FAULT); 181 186 return -1; … … 184 189 cont->refc++; 185 190 191 ROAR_DBG("roar_plugincontainer_ref(cont=%p) = 0", cont); 186 192 return 0; 187 193 } … … 191 197 192 198 if ( cont == NULL ) { 199 ROAR_DBG("roar_plugincontainer_unref(cont=%p) = -1 // error=FAULT", cont); 193 200 roar_err_set(ROAR_ERROR_FAULT); 194 201 return -1; … … 197 204 cont->refc--; 198 205 199 if ( cont->refc ) 206 if ( cont->refc ) { 207 ROAR_DBG("roar_plugincontainer_unref(cont=%p) = 0", cont); 200 208 return 0; 209 } 201 210 202 211 while (cont->numhandles) { … … 220 229 roar_mm_free(cont); 221 230 231 ROAR_DBG("roar_plugincontainer_unref(cont=%p) = 0", cont); 222 232 return 0; 223 233 } -
libroar/roardl.c
r5431 r5438 110 110 int roar_dl_para_ref (struct roar_dl_librarypara * para) { 111 111 if ( para == NULL ) { 112 ROAR_DBG("roar_dl_para_ref(para=%p) = -1 // error=FAULT", para); 112 113 roar_err_set(ROAR_ERROR_FAULT); 113 114 return -1; … … 116 117 para->refc++; 117 118 119 ROAR_DBG("roar_dl_para_ref(para=%p) = 0", para); 118 120 return 0; 119 121 } … … 121 123 int roar_dl_para_unref (struct roar_dl_librarypara * para) { 122 124 if ( para == NULL ) { 125 ROAR_DBG("roar_dl_para_unref(para=%p) = -1 // error=FAULT", para); 123 126 roar_err_set(ROAR_ERROR_FAULT); 124 127 return -1; … … 127 130 para->refc--; 128 131 129 if ( para->refc ) 132 if ( para->refc ) { 133 ROAR_DBG("roar_dl_para_unref(para=%p) = 0", para); 130 134 return 0; 135 } 131 136 132 137 if ( para->notifycore != NULL ) … … 140 145 roar_mm_free(para); 141 146 147 ROAR_DBG("roar_dl_para_unref(para=%p) = 0", para); 142 148 return 0; 143 149 } … … 408 414 int roar_dl_ref (struct roar_dl_lhandle * lhandle) { 409 415 if ( (void*)lhandle < (void*)128 ) { 416 ROAR_DBG("roar_dl_ref(lhandle=%p) = -1 // error=BADFH", lhandle); 410 417 roar_err_set(ROAR_ERROR_BADFH); 411 418 return -1; … … 414 421 lhandle->refc++; 415 422 423 ROAR_DBG("roar_dl_ref(lhandle=%p) = 0", lhandle); 416 424 return 0; 417 425 } … … 421 429 422 430 if ( (void*)lhandle < (void*)128 ) { 431 ROAR_DBG("roar_dl_unref(lhandle=%p) = -1 // error=BADFH", lhandle); 423 432 roar_err_set(ROAR_ERROR_BADFH); 424 433 return -1; 425 434 } 426 435 427 lhandle->refc++; 428 429 if ( lhandle->refc ) 436 lhandle->refc--; 437 438 if ( lhandle->refc ) { 439 ROAR_DBG("roar_dl_unref(lhandle=%p) = 0", lhandle); 430 440 return 0; 441 } 431 442 432 443 if ( lhandle->lib != NULL && lhandle->lib->unload != NULL ) { … … 457 468 roar_mm_free(lhandle); 458 469 470 ROAR_DBG("roar_dl_unref(lhandle=%p) = %i", lhandle, ret); 459 471 return ret; 460 472 }
Note: See TracChangeset
for help on using the changeset viewer.