summaryrefslogtreecommitdiff
path: root/src/buf.c
diff options
context:
space:
mode:
authorStefan Reinauer <stefan.reinauer@coreboot.org>2015-05-14 11:16:04 -0700
committerWill Estes <westes575@gmail.com>2015-11-19 19:26:07 -0500
commit0f7b9136ed566f4a79b2d6ca33299babcce3049e (patch)
tree4d7e50ccc92c0917ec491c23aadaf93b5b0c5047 /src/buf.c
parent09eae589d3954a1e1206aa01108ee75ef57776da (diff)
Switch function definitions from mixed K&R to consistent ANSI C.
flex was using K&R function definitions for some functions and ANSI C style in others, sometimes even in the same file. Change the code to consistently use ANSI C. Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/buf.c')
-rw-r--r--src/buf.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/src/buf.c b/src/buf.c
index fa713a6..f2410f0 100644
--- a/src/buf.c
+++ b/src/buf.c
@@ -124,10 +124,7 @@ struct Buf *buf_concat(struct Buf* dest, const struct Buf* src)
/* Appends n characters in str to buf. */
-struct Buf *buf_strnappend (buf, str, n)
- struct Buf *buf;
- const char *str;
- int n;
+struct Buf *buf_strnappend (struct Buf *buf, const char *str, int n)
{
buf_append (buf, str, n + 1);
@@ -138,18 +135,13 @@ struct Buf *buf_strnappend (buf, str, n)
}
/* Appends characters in str to buf. */
-struct Buf *buf_strappend (buf, str)
- struct Buf *buf;
- const char *str;
+struct Buf *buf_strappend (struct Buf *buf, const char *str)
{
return buf_strnappend (buf, str, strlen (str));
}
/* appends "#define str def\n" */
-struct Buf *buf_strdefine (buf, str, def)
- struct Buf *buf;
- const char *str;
- const char *def;
+struct Buf *buf_strdefine (struct Buf *buf, const char *str, const char *def)
{
buf_strappend (buf, "#define ");
buf_strappend (buf, " ");
@@ -203,9 +195,7 @@ struct Buf *buf_m4_undefine (struct Buf *buf, const char* def)
}
/* create buf with 0 elements, each of size elem_size. */
-void buf_init (buf, elem_size)
- struct Buf *buf;
- size_t elem_size;
+void buf_init (struct Buf *buf, size_t elem_size)
{
buf->elts = (void *) 0;
buf->nelts = 0;
@@ -214,8 +204,7 @@ void buf_init (buf, elem_size)
}
/* frees memory */
-void buf_destroy (buf)
- struct Buf *buf;
+void buf_destroy (struct Buf *buf)
{
if (buf && buf->elts)
flex_free (buf->elts);
@@ -229,10 +218,7 @@ void buf_destroy (buf)
* We grow by mod(512) boundaries.
*/
-struct Buf *buf_append (buf, ptr, n_elem)
- struct Buf *buf;
- const void *ptr;
- int n_elem;
+struct Buf *buf_append (struct Buf *buf, const void *ptr, int n_elem)
{
int n_alloc = 0;