Second thoughts on stringbuffer changes

git-svn-id: http://svn.osgeo.org/postgis/trunk@6367 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Paul Ramsey 2010-12-13 23:50:52 +00:00
parent 447c10e294
commit 79320ce2bb
2 changed files with 4 additions and 22 deletions

View file

@ -114,32 +114,16 @@ char stringbuffer_lastchar(stringbuffer_t *s)
return *(s->str_end - 1);
}
/**
* Append the specified string to the stringbuffer_t, using the given length
*/
void stringbuffer_append_with_size(stringbuffer_t *s, const char *a, size_t alen)
{
int alen0 = alen + 1; /* Length including null terminator */
stringbuffer_makeroom(s, alen0);
memcpy(s->str_end, a, alen0);
s->str_end += alen;
}
/**
* Append the specified string to the stringbuffer_t.
*/
void stringbuffer_append(stringbuffer_t *s, const char *a)
{
int alen = strlen(a); /* Length of string to append */
stringbuffer_append_with_size(s, a, alen);
}
/**
* Append the specified single character to the stringbuffer_t.
*/
void stringbuffer_append_char(stringbuffer_t *s, const char *a)
{
stringbuffer_append_with_size(s, a, 1);
int alen0 = alen + 1; /* Length including null terminator */
stringbuffer_makeroom(s, alen0);
memcpy(s->str_end, a, alen0);
s->str_end += alen;
}
/**

View file

@ -59,8 +59,6 @@ extern void stringbuffer_clear(stringbuffer_t *sb);
void stringbuffer_set(stringbuffer_t *sb, const char *s);
void stringbuffer_copy(stringbuffer_t *sb, stringbuffer_t *src);
extern void stringbuffer_append(stringbuffer_t *sb, const char *s);
extern void stringbuffer_append_char(stringbuffer_t *s, const char *a);
extern void stringbuffer_append_with_size(stringbuffer_t *sb, const char *s, size_t s_size);
extern int stringbuffer_aprintf(stringbuffer_t *sb, const char *fmt, ...);
extern const char *stringbuffer_getstring(stringbuffer_t *sb);
extern char *stringbuffer_getstringcopy(stringbuffer_t *sb);