Changeset 5901:64d1f534671b in roaraudio


Ignore:
Timestamp:
04/14/13 16:59:26 (6 years ago)
Author:
phi
Branch:
default
Message:

added roar_mm_free_noerror() and make some use out of it

Files:
10 edited

Legend:

Unmodified
Added
Removed
  • include/libroar/memmgr.h

    r5823 r5901  
    7474// this should only be used in case a function pointer of this type is required. 
    7575void roar_mm_free_retvoid(void *ptr); 
     76 
     77// dummy function doing the same as roar_mm_free() but does not return any error 
     78// or alter global error states. 
     79void roar_mm_free_noerror(void *ptr); 
    7680 
    7781// memory locking: 
  • libroar/basic.c

    r5897 r5901  
    152152  roar_err_update(); 
    153153  ROAR_ERR("_start_server_win32(server='%s', ...): Can not start server: %s: %s", server, daemonimage, roar_errorstring); 
    154   err = roar_error; 
    155   roar_mm_free(daemonimage); 
    156   roar_error = err; 
     154  roar_mm_free_noerror(daemonimage); 
    157155  return -1; 
    158156 } 
     
    201199 if ( socketpair(AF_UNIX, SOCK_STREAM, 0, socks) == -1 ) { 
    202200  roar_err_from_errno(); 
    203   err = roar_error; 
    204   roar_mm_free(daemonimage); 
    205   roar_error = err; 
     201  roar_mm_free_noerror(daemonimage); 
    206202  return -1; 
    207203 } 
  • libroar/buffer.c

    r5823 r5901  
    111111 
    112112 if ( roar_buffer_new_no_ma(buf, len, bufdata) == -1 ) { 
    113   err = roar_error; 
    114   roar_mm_free(bufdata); 
    115   roar_err_set(err); 
     113  roar_mm_free_noerror(bufdata); 
    116114  return -1; 
    117115 } 
  • libroar/cdrom.c

    r5896 r5901  
    5454 int fh[2]; 
    5555 char * bin_cdparanoia = NULL, * dev_stdin = NULL; 
    56  int err; 
    5756 
    5857 ROAR_DBG("roar_cdrom_run_cdparanoia(cdrom=%i, data=%i, track=%i, pos='%s') = ?", cdrom, data, track, pos); 
     
    9897 dev_stdin = roar_libroar_get_path("dev-stdin", 0, NULL, NULL); 
    9998 if ( dev_stdin == NULL ) { 
    100   err = roar_error; 
    101   roar_mm_free(bin_cdparanoia); 
    102   roar_error = err; 
     99  roar_mm_free_noerror(bin_cdparanoia); 
    103100  return -1; 
    104101 } 
  • libroar/libroar.c

    r5837 r5901  
    179179pid_t roar_fork(const struct roar_libroar_forkapi * api) { 
    180180 void * context = NULL; 
    181  int err; 
    182181 pid_t ret; 
    183182 
     
    195194    api->failed(&context, api->userdata); 
    196195 
    197    if ( context != NULL ) { 
    198     err = roar_error; 
    199     roar_mm_free(context); 
    200     roar_error = err; 
    201    } 
     196   if ( context != NULL ) 
     197    roar_mm_free_noerror(context); 
    202198   return (pid_t)-1; 
    203199  } 
     
    208204   api->failed(&context, api->userdata); 
    209205 
    210   if ( context != NULL ) { 
    211    err = roar_error; 
    212    roar_mm_free(context); 
    213    roar_error = err; 
    214   } 
     206  if ( context != NULL ) 
     207   roar_mm_free_noerror(context); 
    215208  return (pid_t)-1; 
    216209 } 
     
    224217 } 
    225218 
    226  if ( context != NULL ) { 
    227   err = roar_error; 
    228   roar_mm_free(context); 
    229   roar_error = err; 
    230  } 
     219 if ( context != NULL ) 
     220  roar_mm_free_noerror(context); 
    231221 
    232222 return ret; 
  • libroar/memmgr.c

    r5823 r5901  
    267267} 
    268268 
     269void roar_mm_free_noerror(void *ptr) { 
     270 struct roar_error_state state; 
     271 
     272 if ( ptr == NULL ) 
     273  return; 
     274 
     275 roar_err_store(&state); 
     276 roar_mm_free(ptr); 
     277 roar_err_restore(&state); 
     278} 
     279 
    269280#if defined(ROAR_USE_MEMMGR) || !defined(ROAR_HAVE_STRDUP) 
    270281char * roar_mm_strdup(const char *s) { 
  • libroar/roardl.c

    r5836 r5901  
    9797  ret->args_store = roar_mm_strdup(args); 
    9898  if ( ret->args_store == NULL ) { 
    99    err = roar_error; 
    100    roar_mm_free(ret); 
    101    roar_error = err; 
     99   roar_mm_free_noerror(ret); 
    102100   return NULL; 
    103101  } 
  • libroar/vio_cmd.c

    r5896 r5901  
    631631 int pwpipe[2]; 
    632632 int ret; 
    633  int err; 
    634633 
    635634/* 
     
    655654 if ( pw != NULL ) { 
    656655  if ( pipe(pwpipe) == -1 ) { 
    657    err = roar_error; 
    658    roar_mm_free(bin_gpg); 
    659    roar_error = err; 
     656   roar_mm_free_noerror(bin_gpg); 
    660657   return -1; 
    661658  } 
  • libroar/vio_stream.c

    r5896 r5901  
    116116 
    117117 if ( roar_simple_connect(con, server, name) == -1 ) { 
    118   err = roar_error; 
    119   roar_mm_free(con); 
    120   roar_error = err; 
     118  roar_mm_free_noerror(con); 
    121119  return -1; 
    122120 } 
  • libroar/vio_zlib.c

    r5823 r5901  
    516516int roar_vio_open_zlib(struct roar_vio_calls * calls, struct roar_vio_calls * dst, int level, int gzip) { 
    517517 struct roar_vio_gzip * self; 
    518  int err; 
    519518 
    520519 ROAR_DBG("roar_vio_open_zlib(calls=%p, dst=%p, level=%i, gzip=%i) = ?", calls, dst, level, gzip); 
     
    528527 
    529528 if ( _init(self, dst, level, gzip) == -1 ) { 
    530   err = roar_error; 
    531   roar_mm_free(self); 
    532   roar_err_set(err); 
     529  roar_mm_free_noerror(self); 
    533530  ROAR_DBG("roar_vio_open_zlib(calls=%p, dst=%p, level=%i, gzip=%i) = -1 // error=%s", calls, dst, level, gzip, roar_error2str(err)); 
    534531  return -1; 
Note: See TracChangeset for help on using the changeset viewer.