change the names in String for more clarity - surf-adblock - Surf adblock web extension
 (HTM) git clone git://git.codemadness.org/surf-adblock
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 8f646ec95953602d0667766aa81e1a329ff05d13
 (DIR) parent 95c5c0d4bd55049c2fbf2eff49580076ac749023
 (HTM) Author: Quentin Rameau <quinq@fifth.space>
       Date:   Sun, 17 Jul 2016 16:15:31 +0200
       
       change the names in String for more clarity
       
       Adapt the names in string_buffer_realloc() too
       
       Diffstat:
         M surf-adblock.c                      |      16 ++++++++--------
       
       1 file changed, 8 insertions(+), 8 deletions(-)
       ---
 (DIR) diff --git a/surf-adblock.c b/surf-adblock.c
       @@ -17,8 +17,8 @@
        /* String data / memory pool */
        typedef struct string {
                char   *data;   /* data */
       -        size_t  len;    /* string length */
       -        size_t  bufsiz; /* allocated size */
       +        size_t  datasz; /* allocated size */
       +        size_t  len;    /* current string length */
        } String;
        
        typedef struct Page {
       @@ -138,13 +138,13 @@ eprintf(const char *fmt, ...)
        }
        
        static void
       -string_buffer_realloc(String *s, size_t newlen)
       +string_buffer_realloc(String *s, size_t newsz)
        {
       -        size_t alloclen;
       +        size_t allocsz;
        
       -        for (alloclen = 64; alloclen <= newlen; alloclen *= 2)
       +        for (allocsz = 64; allocsz <= newsz; allocsz *= 2)
                        ;
       -        if (!(s->data = realloc(s->data, alloclen)))
       +        if (!(s->data = realloc(s->data, allocsz)))
                        eprintf("realloc: %s\n", strerror(errno));
                s->bufsiz = alloclen;
        }
       @@ -155,8 +155,8 @@ string_append(String *s, const char *data, size_t len)
                if (!len)
                        return;
                /* check if allocation is necesary, don't shrink buffer,
       -         * should be more than bufsiz ofcourse. */
       -        if (s->len + len >= s->bufsiz)
       +         * should be more than datasz ofcourse. */
       +        if (s->len + len >= s->datasz)
                        string_buffer_realloc(s, s->len + len + 1);
                memcpy(s->data + s->len, data, len);
                s->len += len;