FreeBSD/contrib/subversion/subversion/libsvn_subr/skel.c
/* Append the concrete representation of SKEL to the string STR. */
Append the concrete representation of SKEL to the string STR.
Append the concrete representation of SKEL to the string STR .
static svn_stringbuf_t *
unparse(const svn_skel_t *skel, svn_stringbuf_t *str)
{
  if (skel->is_atom)
    {
      if (use_implicit(skel))
        svn_stringbuf_appendbytes(str, skel->data, skel->len);
      else
        {
          char buf[200 + SVN_INT64_BUFFER_SIZE];
          apr_size_t length_len;
          length_len = svn__ui64toa(buf, skel->len);
          SVN_ERR_ASSERT_NO_RETURN(length_len > 0);
          svn_stringbuf_ensure(str, str->len + length_len + 1 + skel->len);
          svn_stringbuf_appendbytes(str, buf, length_len);
          svn_stringbuf_appendbyte(str, ' ');
          svn_stringbuf_appendbytes(str, skel->data, skel->len);
        }
    }
  else
    {
      svn_skel_t *child;
      svn_stringbuf_appendbyte(str, '(');
      for (child = skel->children; child; child = child->next)
        {
          unparse(child, str);
          if (child->next)
            svn_stringbuf_appendbyte(str, ' ');
        }
      svn_stringbuf_appendbyte(str, ')');
    }
  return str;
}
static svn_stringbuf_t * unparse ( const svn_skel_t * skel , svn_stringbuf_t * str ) { if ( skel -> is_atom ) { if ( use_implicit ( skel ) ) svn_stringbuf_appendbytes ( str , skel -> data , skel -> len ) ; else { char buf [ 200 + SVN_INT64_BUFFER_SIZE ] ; apr_size_t length_len ; length_len = svn__ui64toa ( buf , skel -> len ) ; SVN_ERR_ASSERT_NO_RETURN ( length_len > 0 ) ; svn_stringbuf_ensure ( str , str -> len + length_len + 1 + skel -> len ) ; svn_stringbuf_appendbytes ( str , buf , length_len ) ; svn_stringbuf_appendbyte ( str , ' ' ) ; svn_stringbuf_appendbytes ( str , skel -> data , skel -> len ) ; } } else { svn_skel_t * child ; svn_stringbuf_appendbyte ( str , ' ' ) ; for ( child = skel -> children ; child ; child = child -> next ) { unparse ( child , str ) ; if ( child -> next ) svn_stringbuf_appendbyte ( str , ' ' ) ; } svn_stringbuf_appendbyte ( str , ' ' ) ; } return str ; }
Append the concrete representation of SKEL to the string STR.
Append the concrete representation of SKEL to the string STR .
/* Append an atom to STR.  */ /* Append the length to STR.  Ensure enough space for at least
           * one 64 bit int. */ /* Make sure we have room for the length, the space, and the
             atom's contents.  */ /* Append a list to STR: an opening parenthesis, the list elements
       * separated by a space, and a closing parenthesis.  */