summaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@intel.com>2014-10-11 13:25:51 -0300
committerLucas De Marchi <lucas.demarchi@intel.com>2014-10-11 13:25:51 -0300
commit15a7ae30b36a5a2d50e9b1bfadc30c766a874bff (patch)
treef55b3e5b82c2138c390128b39b77a4f611dcbd97 /shared
parentb4d1f44af16809e70ac5800c7539875832757679 (diff)
downloadkmod-15a7ae30b36a5a2d50e9b1bfadc30c766a874bff.tar.gz
kmod-15a7ae30b36a5a2d50e9b1bfadc30c766a874bff.tar.bz2
kmod-15a7ae30b36a5a2d50e9b1bfadc30c766a874bff.zip
shared: rename prefixes of strbuf functions
Use strbuf_ prefix instead of buf_.
Diffstat (limited to 'shared')
-rw-r--r--shared/strbuf.c22
-rw-r--r--shared/strbuf.h20
2 files changed, 21 insertions, 21 deletions
diff --git a/shared/strbuf.c b/shared/strbuf.c
index 5974660..374aa00 100644
--- a/shared/strbuf.c
+++ b/shared/strbuf.c
@@ -28,7 +28,7 @@
#define BUF_STEP (2048)
-static bool buf_grow(struct buffer *buf, size_t newsize)
+static bool buf_grow(struct strbuf *buf, size_t newsize)
{
void *tmp;
size_t sz;
@@ -49,19 +49,19 @@ static bool buf_grow(struct buffer *buf, size_t newsize)
return true;
}
-void buf_init(struct buffer *buf)
+void strbuf_init(struct strbuf *buf)
{
buf->bytes = NULL;
buf->size = 0;
buf->used = 0;
}
-void buf_release(struct buffer *buf)
+void strbuf_release(struct strbuf *buf)
{
free(buf->bytes);
}
-char *buf_steal(struct buffer *buf)
+char *strbuf_steal(struct strbuf *buf)
{
char *bytes;
@@ -74,7 +74,7 @@ char *buf_steal(struct buffer *buf)
return bytes;
}
-const char *buf_str(struct buffer *buf)
+const char *strbuf_str(struct strbuf *buf)
{
if (!buf_grow(buf, buf->used + 1))
return NULL;
@@ -82,7 +82,7 @@ const char *buf_str(struct buffer *buf)
return buf->bytes;
}
-bool buf_pushchar(struct buffer *buf, char ch)
+bool strbuf_pushchar(struct strbuf *buf, char ch)
{
if (!buf_grow(buf, buf->used + 1))
return false;
@@ -91,32 +91,32 @@ bool buf_pushchar(struct buffer *buf, char ch)
return true;
}
-unsigned buf_pushchars(struct buffer *buf, const char *str)
+unsigned strbuf_pushchars(struct strbuf *buf, const char *str)
{
unsigned i = 0;
int ch;
while ((ch = str[i])) {
- buf_pushchar(buf, ch);
+ strbuf_pushchar(buf, ch);
i++;
}
return i;
}
-void buf_popchar(struct buffer *buf)
+void strbuf_popchar(struct strbuf *buf)
{
assert(buf->used > 0);
buf->used--;
}
-void buf_popchars(struct buffer *buf, unsigned n)
+void strbuf_popchars(struct strbuf *buf, unsigned n)
{
assert(buf->used >= n);
buf->used -= n;
}
-void buf_clear(struct buffer *buf)
+void strbuf_clear(struct strbuf *buf)
{
buf->used = 0;
}
diff --git a/shared/strbuf.h b/shared/strbuf.h
index d3ac55b..0f7ceb1 100644
--- a/shared/strbuf.h
+++ b/shared/strbuf.h
@@ -5,26 +5,26 @@
/*
* Buffer abstract data type
*/
-struct buffer {
+struct strbuf {
char *bytes;
unsigned size;
unsigned used;
};
-void buf_init(struct buffer *buf);
-void buf_release(struct buffer *buf);
-void buf_clear(struct buffer *buf);
+void strbuf_init(struct strbuf *buf);
+void strbuf_release(struct strbuf *buf);
+void strbuf_clear(struct strbuf *buf);
/* Destroy buffer and return a copy as a C string */
-char *buf_steal(struct buffer *buf);
+char *strbuf_steal(struct strbuf *buf);
/*
* Return a C string owned by the buffer invalidated if the buffer is
* changed).
*/
-const char *buf_str(struct buffer *buf);
+const char *strbuf_str(struct strbuf *buf);
-bool buf_pushchar(struct buffer *buf, char ch);
-unsigned buf_pushchars(struct buffer *buf, const char *str);
-void buf_popchar(struct buffer *buf);
-void buf_popchars(struct buffer *buf, unsigned n);
+bool strbuf_pushchar(struct strbuf *buf, char ch);
+unsigned strbuf_pushchars(struct strbuf *buf, const char *str);
+void strbuf_popchar(struct strbuf *buf);
+void strbuf_popchars(struct strbuf *buf, unsigned n);