Changeset 4975:1b8be0a0ba5f in roaraudio
- Timestamp:
- 05/16/11 15:16:33 (13 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
include/libroar/vio_stack.h
r4708 r4975 44 44 int next; 45 45 46 void (*free)(void*); 47 46 48 struct roar_vio_calls * cur; 47 49 … … 50 52 51 53 int roar_vio_open_stack (struct roar_vio_calls * calls); 54 int roar_vio_open_stack2 (struct roar_vio_calls * calls, void (*func)(void*)); 52 55 int roar_vio_stack_add (struct roar_vio_calls * calls, struct roar_vio_calls * vio); 53 56 -
libroar.ckport
r4970 r4975 268 268 269 269 # VIO Stack: 270 roar_vio_open_stack ok 270 roar_vio_open_stack legacy Use roar_vio_open_stack2 271 roar_vio_open_stack2 ok 271 272 roar_vio_stack_add ok 272 273 … … 610 611 roar_mm_munlock ok 611 612 613 roar_mm_free_retvoid likely Use roar_mm_free when possible (No error checking by caller) 614 612 615 _ROAR_MLOCK legacy Use roar_mm_mlock 613 616 -
libroar/vio_cmd.c
r4956 r4975 62 62 63 63 if ( reader != NULL ) 64 state->reader.cmd = strdup(reader);64 state->reader.cmd = roar_mm_strdup(reader); 65 65 66 66 state->writer.pid = -1; … … 69 69 70 70 if ( writer != NULL ) 71 state->writer.cmd = strdup(writer);71 state->writer.cmd = roar_mm_strdup(writer); 72 72 73 73 // init state … … 125 125 126 126 if ( state->reader.cmd != NULL ) 127 free(state->reader.cmd);127 roar_mm_free(state->reader.cmd); 128 128 129 129 if ( state->writer.cmd != NULL ) 130 free(state->writer.cmd);130 roar_mm_free(state->writer.cmd); 131 131 132 132 roar_vio_close(state->next); … … 241 241 state->child.out = -1; 242 242 243 state->child.cmd = strdup(command);243 state->child.cmd = roar_mm_strdup(command); 244 244 245 245 // init state … … 281 281 282 282 if ( state->child.cmd != NULL ) 283 free(state->child.cmd);283 roar_mm_free(state->child.cmd); 284 284 285 285 roar_mm_free(state); -
libroar/vio_dstr.c
r4964 r4975 770 770 return -1; 771 771 772 if ( roar_vio_open_stack (calls) == -1 )772 if ( roar_vio_open_stack2(calls, NULL) == -1 ) 773 773 return -1; 774 774 … … 776 776 777 777 if ( (def = chain->def) != NULL ) { 778 if ( (tc = malloc(sizeof(struct roar_vio_calls))) == NULL ) {778 if ( (tc = roar_mm_malloc(sizeof(struct roar_vio_calls))) == NULL ) { 779 779 _ret(-1); 780 780 } 781 781 782 782 if ( roar_vio_clear_calls(tc) == -1 ) { 783 free(tc);783 roar_mm_free(tc); 784 784 _ret(-1); 785 785 } … … 809 809 810 810 if ( c->need_vio ) { 811 if ( (tc = malloc(sizeof(struct roar_vio_calls))) == NULL ) {811 if ( (tc = roar_mm_malloc(sizeof(struct roar_vio_calls))) == NULL ) { 812 812 _ret(-1); 813 813 } 814 814 815 815 if ( roar_vio_clear_calls(tc) == -1 ) { 816 free(tc);816 roar_mm_free(tc); 817 817 _ret(-1); 818 818 } -
libroar/vio_stack.c
r4708 r4975 37 37 38 38 int roar_vio_open_stack (struct roar_vio_calls * calls) { 39 return roar_vio_open_stack2(calls, free); 40 } 41 42 int roar_vio_open_stack2 (struct roar_vio_calls * calls, void (*func)(void*)) { 39 43 struct roar_vio_stack * self; 40 44 41 if ( calls == NULL ) 42 return -1; 45 if ( calls == NULL ) { 46 roar_err_set(ROAR_ERROR_FAULT); 47 return -1; 48 } 49 50 if ( func == NULL ) 51 func = roar_mm_free_retvoid; 43 52 44 53 if ( (self = roar_mm_malloc(sizeof(struct roar_vio_stack))) == NULL ) … … 47 56 memset(self, 0, sizeof(struct roar_vio_stack)); 48 57 memset(calls, 0, sizeof(struct roar_vio_calls)); 58 59 self->free = func; 49 60 50 61 calls->inst = self; … … 63 74 struct roar_vio_stack * self; 64 75 65 if ( calls == NULL || vio == NULL ) 66 return -1; 67 68 if ( (self = calls->inst) == NULL ) 69 return -1; 76 if ( calls == NULL || vio == NULL ) { 77 roar_err_set(ROAR_ERROR_FAULT); 78 return -1; 79 } 80 81 if ( (self = calls->inst) == NULL ) { 82 roar_err_set(ROAR_ERROR_FAULT); 83 return -1; 84 } 70 85 71 86 if ( self->next == ROAR_VIO_STACK_MAX ) … … 81 96 int i; 82 97 83 if ( vio == NULL ) 84 return -1; 98 if ( vio == NULL ) { 99 roar_err_set(ROAR_ERROR_FAULT); 100 return -1; 101 } 85 102 86 103 if ( (self = vio->inst) == NULL ) … … 92 109 93 110 for (i = 0; i < self->next; i++) 94 free(self->calls[i]);111 self->free(self->calls[i]); 95 112 } 96 113 -
libroaresd/esdctl.c
r4708 r4975 69 69 70 70 /* print server into to stdout */ 71 void esd_print_server_info( 71 void esd_print_server_info(esd_server_info_t *server_info ) { 72 72 char buf[80] = ""; 73 73 … … 142 142 struct roar_message m; 143 143 144 r = malloc(sizeof(esd_server_info_t));144 r = roar_mm_malloc(sizeof(esd_server_info_t)); 145 145 146 146 if ( r == NULL ) … … 157 157 158 158 if ( roar_req(&con, &m, NULL) == -1 ) { 159 free(r);159 roar_mm_free(r); 160 160 return NULL; 161 161 } 162 162 163 163 if ( m.cmd != ROAR_CMD_OK ) { 164 free(r);164 roar_mm_free(r); 165 165 return NULL; 166 166 } 167 167 168 168 if ( roar_stream_m2s(&s, &m) == -1 ) { 169 free(r);169 roar_mm_free(r); 170 170 return NULL; 171 171 } … … 188 188 /* release all memory allocated for the server properties structure */ 189 189 void esd_free_server_info( esd_server_info_t *server_info ) { 190 if (server_info )191 free(server_info);190 if (server_info != NULL) 191 roar_mm_free(server_info); 192 192 } 193 193 … … 208 208 roar_connect_fh(con, esd); 209 209 210 r = malloc(sizeof(esd_info_t));210 r = roar_mm_malloc(sizeof(esd_info_t)); 211 211 212 212 if ( r == NULL ) … … 234 234 } 235 235 236 if ( (new_player = malloc(sizeof(esd_player_info_t))) == NULL ) {236 if ( (new_player = roar_mm_malloc(sizeof(esd_player_info_t))) == NULL ) { 237 237 ROAR_ERR("esd_get_all_info(*): can not alloc memory for new player! BAD"); 238 238 continue; … … 320 320 player = info->player_list; 321 321 322 while (player ) {322 while (player != NULL) { 323 323 oplayer = player; 324 324 player = player->next; 325 325 326 free(oplayer);326 roar_mm_free(oplayer); 327 327 } 328 328 … … 333 333 sample = sample->next; 334 334 335 free(osample);336 } 337 338 free(info);335 roar_mm_free(osample); 336 } 337 338 roar_mm_free(info); 339 339 } 340 340 } -
roard/driver.c
r4955 r4975 302 302 return -1; 303 303 } else { 304 driver = strdup(device);304 driver = roar_mm_strdup(device); 305 305 306 306 if ( (delm = strstr(driver, "#")) == NULL ) { … … 317 317 318 318 if ( driver != NULL ) 319 free(driver);319 roar_mm_free(driver); 320 320 321 321 return ret; -
roard/driver_sndio.c
r4957 r4975 43 43 } 44 44 45 #define er() if ( self->shandle ) sio_close(self->shandle); \46 if ( self->mhandle ) mio_close(self->mhandle); \47 if ( self->device ) free(self->device);\48 free(self);\45 #define er() if ( self->shandle ) sio_close(self->shandle); \ 46 if ( self->mhandle ) mio_close(self->mhandle); \ 47 if ( self->device ) roar_mm_free(self->device); \ 48 roar_mm_free(self); \ 49 49 return -1 50 50 -
roard/roard.c
r4967 r4975 828 828 if ( *addr == '/' ) { 829 829 if ( (env_roar_proxy_backup = getenv("ROAR_PROXY")) != NULL ) { 830 env_roar_proxy_backup = strdup(env_roar_proxy_backup);830 env_roar_proxy_backup = roar_mm_strdup(env_roar_proxy_backup); 831 831 unsetenv("ROAR_PROXY"); 832 832 } … … 844 844 if ( env_roar_proxy_backup != NULL ) { 845 845 setenv("ROAR_PROXY", env_roar_proxy_backup, 0); 846 free(env_roar_proxy_backup);846 roar_mm_free(env_roar_proxy_backup); 847 847 } 848 848 #else -
roard/sample.c
r4957 r4975 77 77 roar_buffer_free(c->data); 78 78 79 free(c);79 roar_mm_free(c); 80 80 81 81 g_samples[id] = NULL;
Note: See TracChangeset
for help on using the changeset viewer.