deps/kb_meme/meme-5.0.1/src/buffer.c
/*
 * buf_getstr
 * gets a maximum of n bytes from the buffer to the string
 * if the buffer finishes before copying the full n bytes it
 * will null terminate the string
 * returns the number of bytes copied, not including the added
 * null byte
 */
buf_getstr
gets a maximum of n bytes from the buffer to the string
if the buffer finishes before copying the full n bytes it
will null terminate the string
returns the number of bytes copied, not including the added
null byte
buf_getstr gets a maximum of n bytes from the buffer to the string if the buffer finishes before copying the full n bytes it will null terminate the string returns the number of bytes copied not including the added null byte
int buf_getstr(BUF_T *buf, char *dest, int n) {
  int i, j;
  for (i = buf->position, j = 0; i < buf->limit && j < n; ++i, ++j) {
    dest[j] = (buf->buffer)[i];
  }
  buf->position += j;
  if (j < n) {
    dest[j] = '\0';
  }
  return j;
}
int buf_getstr ( BUF_T * buf , char * dest , int n ) { int i , j ; for ( i = buf -> position , j = 0 ; i < buf -> limit && j < n ; ++ i , ++ j ) { dest [ j ] = ( buf -> buffer ) [ i ] ; } buf -> position += j ; if ( j < n ) { dest [ j ] = ' \0 ' ; } return j ; }
buf_getstr
 gets a maximum of n bytes from the buffer to the string
 if the buffer finishes before copying the full n bytes it
 will null terminate the string
 returns the number of bytes copied, not including the added
 null byte
buf_getstr gets a maximum of n bytes from the buffer to the string if the buffer finishes before copying the full n bytes it will null terminate the string returns the number of bytes copied not including the added null byte