Changeset 1953:50f564826d28 in roaraudio


Ignore:
Timestamp:
06/11/09 02:50:05 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

addding some additional checks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/buffer.c

    r1215 r1953  
    126126 
    127127int roar_buffer_add      (struct roar_buffer * buf, struct roar_buffer *  next) { 
     128 unsigned int deep = 0; 
     129 
    128130 if ( buf == NULL ) 
    129131  return -1; 
    130132 
    131133 ROAR_DBG("buffer_add(buf=%p, next=%p) = ?", buf, next); 
     134 
     135 if ( buf == next ) { 
     136  ROAR_ERR("buffer_add(*): both pointer are of the same destination, This is a error in the application"); 
     137  return -1; 
     138 } 
    132139 
    133140 while ( buf->next != NULL ) { 
     
    135142//  ROAR_DBG("buffer_add(): buf=%p, buf->next=%p", buf, buf->next); 
    136143  buf = buf->next; 
     144  deep++; 
     145 
     146  if ( buf == next ) { 
     147   ROAR_ERR("buffer_add(*): Can not add buffer: loop detected at deep %u. This is a error in the application", deep); 
     148  } 
    137149 } 
    138150 
    139151 buf->next = next; 
     152 
     153 ROAR_DBG("buffer_add(*): adding buffer at deep %u", deep); 
    140154 
    141155 return 0; 
Note: See TracChangeset for help on using the changeset viewer.