You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2012/06/13 23:14:58 UTC
svn commit: r1350019 - /subversion/trunk/subversion/libsvn_subr/skel.c
Author: stefan2
Date: Wed Jun 13 21:14:58 2012
New Revision: 1350019
URL: http://svn.apache.org/viewvc?rev=1350019&view=rev
Log:
Replace the n-th i64toa implementation with a call to svn__ui64toa.
* subversion/libsvn_subr/skel.c
(putsize): drop
(unparse): call our subr implementation
Modified:
subversion/trunk/subversion/libsvn_subr/skel.c
Modified: subversion/trunk/subversion/libsvn_subr/skel.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/skel.c?rev=1350019&r1=1350018&r2=1350019&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/skel.c (original)
+++ subversion/trunk/subversion/libsvn_subr/skel.c Wed Jun 13 21:14:58 2012
@@ -136,41 +136,6 @@ getsize(const char *data, apr_size_t len
}
}
-/* Store the ASCII decimal representation of VALUE at DATA. Return
- the length of the representation if all goes well; return zero if
- the result doesn't fit in LEN bytes. */
-static apr_size_t
-putsize(char *data, apr_size_t len, apr_size_t value)
-{
- apr_size_t i = 0;
-
- /* Generate the digits, least-significant first. */
- do
- {
- if (i >= len)
- return 0;
-
- data[i] = (value % 10) + '0';
- value /= 10;
- i++;
- }
- while (value > 0);
-
- /* Put the digits in most-significant-first order. */
- {
- apr_size_t left, right;
-
- for (left = 0, right = i-1; left < right; left++, right--)
- {
- char t = data[left];
- data[left] = data[right];
- data[right] = t;
- }
- }
-
- return i;
-}
-
/* Checking validity of skels. */
static svn_error_t *
@@ -491,11 +456,12 @@ unparse(const svn_skel_t *skel, svn_stri
svn_stringbuf_appendbytes(str, skel->data, skel->len);
else
{
- /* Append the length to STR. */
- char buf[200];
+ /* Append the length to STR. Ensure enough space for at least
+ * one 64 bit int. */
+ char buf[200 + SVN_INT64_BUFFER_SIZE];
apr_size_t length_len;
- length_len = putsize(buf, sizeof(buf), skel->len);
+ length_len = svn__ui64toa(buf, skel->len);
SVN_ERR_ASSERT_NO_RETURN(length_len > 0);