[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] consistent use of APR in svn_string.[ch]

From: Joe Orton <joe_at_light.plus.com>
Date: 2000-09-10 21:00:00 CEST

apr_size_t was used in some places, but not all, in svn_string.[ch]:
this patch changes size_t's to apr_size_t's, and changes isspace() to
apr_isspace().

Index: include/svn_string.h
===================================================================
RCS file: /cvs/subversion/subversion/include/svn_string.h,v
retrieving revision 1.31
diff -u -r1.31 svn_string.h
--- include/svn_string.h 2000/09/09 16:11:27 1.31
+++ include/svn_string.h 2000/09/10 18:59:25
@@ -61,8 +61,8 @@
 typedef struct svn_string_t
 {
   char *data; /* pointer to the bytestring */
- size_t len; /* length of bytestring */
- size_t blocksize; /* total size of buffer allocated */
+ apr_size_t len; /* length of bytestring */
+ apr_size_t blocksize; /* total size of buffer allocated */
 } svn_string_t;
 
 
@@ -72,14 +72,14 @@
 
 svn_string_t * svn_string_create (const char *cstring,
                                   apr_pool_t *pool);
-svn_string_t * svn_string_ncreate (const char *bytes, const size_t size,
+svn_string_t * svn_string_ncreate (const char *bytes, const apr_size_t size,
                                    apr_pool_t *pool);
 
 /* Set/get a bytestring empty */
 
 void svn_string_setempty (svn_string_t *str);
 svn_boolean_t svn_string_isempty (const svn_string_t *str);
-void svn_string_chop (svn_string_t *str, size_t bytes);
+void svn_string_chop (svn_string_t *str, apr_size_t bytes);
 
 /* Fill bytestring with a character */
 
@@ -108,7 +108,7 @@
 
 /* convenience routines */
 
-size_t svn_string_first_non_whitespace (const svn_string_t *str);
+apr_size_t svn_string_first_non_whitespace (const svn_string_t *str);
 void svn_string_strip_whitespace (svn_string_t *str);
 
 /* Return position of last occurrence of CHAR in STR, or return
Index: libsvn_string/svn_string.c
===================================================================
RCS file: /cvs/subversion/subversion/libsvn_string/svn_string.c,v
retrieving revision 1.44
diff -u -r1.44 svn_string.c
--- libsvn_string/svn_string.c 2000/09/09 16:11:28 1.44
+++ libsvn_string/svn_string.c 2000/09/10 18:59:26
@@ -51,7 +51,7 @@
 
 #include <string.h> /* for memcpy(), memcmp(), strlen() */
 #include <stdio.h> /* for putch() and printf() */
-#include <ctype.h> /* for isspace() */
+#include <apr_lib.h> /* for apr_isspace() */
 #include "svn_string.h" /* loads "svn_types.h" and <apr_pools.h> */
 
 
@@ -59,7 +59,7 @@
 /* Our own realloc, since APR doesn't have one. Note: this is a
    generic realloc for memory pools, *not* for strings. */
 static void *
-my__realloc (char *data, const size_t oldsize, const size_t request,
+my__realloc (char *data, const apr_size_t oldsize, const apr_size_t request,
              apr_pool_t *pool)
 {
   void *new_area;
@@ -87,7 +87,7 @@
 /* Create a new bytestring by copying SIZE bytes from BYTES; requires a
    memory POOL to allocate from. */
 svn_string_t *
-svn_string_ncreate (const char *bytes, const size_t size,
+svn_string_ncreate (const char *bytes, const apr_size_t size,
                     apr_pool_t *pool)
 {
   svn_string_t *new_string;
@@ -142,7 +142,7 @@
 
 /* Chop NBYTES bytes off end of STR, but not more than STR->len. */
 void
-svn_string_chop (svn_string_t *str, size_t nbytes)
+svn_string_chop (svn_string_t *str, apr_size_t nbytes)
 {
   if (nbytes > str->len)
     str->len = 0;
@@ -163,7 +163,7 @@
 
 static void
 ensure_block_capacity (svn_string_t *str,
- size_t minimum_size,
+ apr_size_t minimum_size,
                        apr_pool_t *pool)
 {
   /* Keep doubling capacity until have enough. */
@@ -180,9 +180,9 @@
 /* Copy COUNT bytes from BYTES onto the end of bytestring STR. */
 void
 svn_string_appendbytes (svn_string_t *str, const char *bytes,
- const size_t count, apr_pool_t *pool)
+ const apr_size_t count, apr_pool_t *pool)
 {
- size_t total_len;
+ apr_size_t total_len;
   void *start_address;
 
   if (str == NULL)
@@ -248,14 +248,14 @@
 
 
 /* Return offset of first non-whitespace character in STR, or -1 if none. */
-size_t
+apr_size_t
 svn_string_first_non_whitespace (const svn_string_t *str)
 {
- size_t i;
+ apr_size_t i;
 
   for (i = 0; i < str->len; i++)
     {
- if (! isspace (str->data[i]))
+ if (! apr_isspace (str->data[i]))
         {
           return i;
         }
@@ -270,10 +270,10 @@
 void
 svn_string_strip_whitespace (svn_string_t *str)
 {
- size_t i;
+ apr_size_t i;
 
   /* Find first non-whitespace character */
- size_t offset = svn_string_first_non_whitespace (str);
+ apr_size_t offset = svn_string_first_non_whitespace (str);
 
   /* Go ahead! Waste some RAM, we've got pools! :) */
   str->data += offset;
@@ -284,7 +284,7 @@
 
   for (i = (str->len - 1); i >= 0; i--)
     {
- if (! isspace (str->data[i]))
+ if (! apr_isspace (str->data[i]))
         {
           break;
         }
Received on Sat Oct 21 14:36:08 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.