FreeBSD/contrib/subversion/subversion/libsvn_fs_fs/id.c
/* Return an ID resulting from parsing the string DATA, or NULL if DATA is
   an invalid ID string. *DATA will be modified / invalidated by this call. */
Return an ID resulting from parsing the string DATA, or NULL if DATA is
an invalid ID string. *DATA will be modified / invalidated by this call.
Return an ID resulting from parsing the string DATA or NULL if DATA is an invalid ID string . * DATA will be modified / invalidated by this call .
static svn_fs_id_t *
id_parse(char *data,
         apr_pool_t *pool)
{
  fs_fs__id_t *id;
  char *str;
  id = apr_pcalloc(pool, sizeof(*id));
  id->generic_id.vtable = &id_vtable;
  id->generic_id.fsap_data = id;
  str = svn_cstring_tokenize(".", &data);
  if (str == NULL)
    return NULL;
  if (! part_parse(&id->private_id.node_id, str))
    return NULL;
  str = svn_cstring_tokenize(".", &data);
  if (str == NULL)
    return NULL;
  if (! part_parse(&id->private_id.copy_id, str))
    return NULL;
  str = svn_cstring_tokenize(".", &data);
  if (str == NULL)
    return NULL;
  if (str[0] == 'r')
    {
      apr_int64_t val;
      const char *tmp;
      svn_error_t *err;
      id->private_id.txn_id.revision = SVN_INVALID_REVNUM;
      id->private_id.txn_id.number = 0;
      data = str + 1;
      str = svn_cstring_tokenize("/", &data);
      if (str == NULL)
        return NULL;
      if (!locale_independent_strtol(&id->private_id.rev_item.revision,
                                     str, &tmp))
        return NULL;
      err = svn_cstring_atoi64(&val, data);
      if (err)
        {
          svn_error_clear(err);
          return NULL;
        }
      id->private_id.rev_item.number = (apr_uint64_t)val;
    }
  else if (str[0] == 't')
    {
      id->private_id.rev_item.revision = SVN_INVALID_REVNUM;
      id->private_id.rev_item.number = 0;
      if (! txn_id_parse(&id->private_id.txn_id, str + 1))
        return NULL;
    }
  else
    return NULL;
  return (svn_fs_id_t *)id;
}
static svn_fs_id_t * id_parse ( char * data , apr_pool_t * pool ) { fs_fs__id_t * id ; char * str ; id = apr_pcalloc ( pool , sizeof ( * id ) ) ; id -> generic_id . vtable = & id_vtable ; id -> generic_id . fsap_data = id ; str = svn_cstring_tokenize ( " " , & data ) ; if ( str == NULL ) return NULL ; if ( ! part_parse ( & id -> private_id . node_id , str ) ) return NULL ; str = svn_cstring_tokenize ( " " , & data ) ; if ( str == NULL ) return NULL ; if ( ! part_parse ( & id -> private_id . copy_id , str ) ) return NULL ; str = svn_cstring_tokenize ( " " , & data ) ; if ( str == NULL ) return NULL ; if ( str [ 0 ] == ' ' ) { apr_int64_t val ; const char * tmp ; svn_error_t * err ; id -> private_id . txn_id . revision = SVN_INVALID_REVNUM ; id -> private_id . txn_id . number = 0 ; data = str + 1 ; str = svn_cstring_tokenize ( " " , & data ) ; if ( str == NULL ) return NULL ; if ( ! locale_independent_strtol ( & id -> private_id . rev_item . revision , str , & tmp ) ) return NULL ; err = svn_cstring_atoi64 ( & val , data ) ; if ( err ) { svn_error_clear ( err ) ; return NULL ; } id -> private_id . rev_item . number = ( apr_uint64_t ) val ; } else if ( str [ 0 ] == ' ' ) { id -> private_id . rev_item . revision = SVN_INVALID_REVNUM ; id -> private_id . rev_item . number = 0 ; if ( ! txn_id_parse ( & id -> private_id . txn_id , str + 1 ) ) return NULL ; } else return NULL ; return ( svn_fs_id_t * ) id ; }
Return an ID resulting from parsing the string DATA, or NULL if DATA is
an invalid ID string.
Return an ID resulting from parsing the string DATA or NULL if DATA is an invalid ID string .
/* Alloc a new svn_fs_id_t structure. */ /* Now, we basically just need to "split" this data on `.'
     characters.  We will use svn_cstring_tokenize, which will put
     terminators where each of the '.'s used to be.  Then our new
     id field will reference string locations inside our duplicate
     string.*/ /* Node Id */ /* Copy Id */ /* Txn/Rev Id */ /* This is a revision type ID */ /* This is a transaction type ID */